Author Topic: Clicky/glitchy Playback from SD card  (Read 55 times)

Kreamyme

  • Newbie
  • *
  • Posts: 3
    • View Profile
Clicky/glitchy Playback from SD card
« on: November 13, 2020, 10:23:04 AM »
Hello!
yesterday Evening I was lost in a new gecho v2 )
Feels like an artefact with so many things to be learnt )

While I really enjoy digging deeper into how things work with gecho,
 I noticed a glitchy playback of anything from SD card (simple 2222 or the wonderful slice mode 222). Like the CPU is overwhelmed or something.
I examined recorded files on a mac - the Sampling rate look suspicious for me (50 780 hz) but the files are played back ok. No clicks or glitches
I tried to downsample it to 44100, tried my own samples, - the playback in Gecho isn't perfect - too clicky.
I kinda hope this is just the card issue, but on the other side - gecho records just fine, it just fails to play em back.
The card is Toshiba 2GB, my concern is that I'm not sure what filesystem it should be.
I formated it on a tascam recorder, it makes FAT16. Not sure if mac can format to FAT32, just MS-DOS FAT is available.
So, to sum it up:
- What filesystem for the SD CArd is preferable?
- is it ok, that files are recorded with 50 780 hz samplerate
- should I buy some SD card that is aproved to work nice with gecho instead of wanton toshiba SD card, I found at home)))?



There's a file in the attachments - it is recorded with gecho (using both mics, line in works fine also) - if you listen to it on a pc/mac whatever - it sound good.

but that's how it sounds on gecho
https://youtu.be/c9cUnzuxbKQ








« Last Edit: November 13, 2020, 10:30:34 AM by Kreamyme »

mario

  • Administrator
  • Full Member
  • *****
  • Posts: 170
    • View Profile
Re: Clicky/glitchy Playback from SD card
« Reply #1 on: November 14, 2020, 05:18:04 PM »
Hi and welcome! :) Happy to hear you are enjoying the lizard synth.

So far I've heard from 3 other people about the same problem. In one case it turned out to be too slow / not genuine card, bought on eBay. In other cases the card seems good enough but for some reason still does not perform well - the problem is that until I get hold of the same problematic card I can't really debug the issue.

Your 2GB card is likely to be just a little bit too slow. Is it Class 4? If yes, that would explain it. I've been using SanDisk Ultra Class 10 (U1) 8GB and 16GB cards without any problems. The other guy who has encountered this problem has used the same type of card, only it was 32GB (which should not make any difference at all so it is quite a mystery, unless the sector size is different and it plays some role - I'll need to get one of those and try, as currently I only have a 32GB Extreme which works well).

If you want to see how your card performs, there is channel #3142 - SD Card speed test, it outputs the result over serial console and you can use PuTTY to see the result. The test writes and reads 2MB of data, with my cards this takes cca 3-3.5 sec to write and 1.5-1.7 sec to read (the read info will show up only when running second time as the file needs to exist on the card first, things are done in this order to rule out any possible cache effect).

The sampling rate of 50.780 kHz is what the loopsynth uses internally. This odd value is simply a result of architecture, the ESP32 chip is driven from 26MHz crystal and the master audio clock is normally derived from it using a PLL (phase locked loop) circuit that gives very stable and low jitter signal.

But then not all values are possible, for example when requesting 48kHz from the I2S controller, 50781.250Hz comes out - this is a consequence of I2S bus timing, where MCLK (master clock) frequency is a nice number, precisely 13MHz (half of the xtal's 26MHz). Without PLL it is possible to obtain exactly 48kHz but that requires MCLK to be an odd / fractional value where the I2S controller uses some tricks to achieve that, and the clock is not smooth. This results in additional "quantization" noise added to the output signal (more theory here if you are interested).

This of course results in whatever is recorded to SD also getting encoded in 50.78 kHz. I personally did not find this to be much of a problem as the software I used to edit audio or video was able to resample the tracks behind the scenes. PC has a lot more power so the algorithms to manipulate audio give a lot better results than if this was attempted in the synth's own small CPU (which would also need to be done in real time).

Some 3rd party sound engines - like Clouds - use 44.1kHz as they require more CPU power and need to squeeze the last bit of it, but where it was possible I decided to keep the ood sampling rate as it sounds noticeably better.

About the card formst - the default format with which the card comes from the shop is usually good. We use FatFS library that supports FAT16, FAT32 and exFAT too - but there is still a limitation in Gecho because of the older ESP-IDF version used, which limits the card size to 32GB - I believe this is because larger cards are SDXC and use exFAT (this will likely be fixed in future firmware once I get time to port the code base over to the new version of the framework).

For best results and especially if you plan to use the material later, it is not advisable to record to SD, rather just take raw audio and record with external device, as from time to time glitch may occur and ruin the recording, for example when the card times out while erasing sectors, or something like that. Of course for the channel #222 to run well, this problem needs to be eliminated.

Kreamyme

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Clicky/glitchy Playback from SD card
« Reply #2 on: November 15, 2020, 11:12:58 AM »
Thanks for the answer!
Not sure if I can use Putty, as far as I can see it is windows based, and I have a mac, and no PC around (And can't visit PC friends frienfs these pandemic days), let's hope it's a card issue.

Anyway I was going to buy a couple more for tascam-portastudio and microgranny, so I just add another to the list for the  Gecho
Will try SanDisk, sounds like these cards are the optimal choice, for the tascam community mention 'em all the time too )
I'll let you know, when I test it, just to let you know if there's anything else beside the card class causing the issue.

Samplerate - ok ) I got the main idea, I'm just  familiar with 41/48/88/96kHz numbrs, and while I understand that samplingRate can be any value, theoreticaly,  just was curious if it's ok and intended )

Thanks again )

Kreamyme

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Clicky/glitchy Playback from SD card
« Reply #3 on: November 22, 2020, 11:02:41 AM »
Got SanDiskExtreme 32Gb - works perfect )
Problem solved )

mario

  • Administrator
  • Full Member
  • *****
  • Posts: 170
    • View Profile
Re: Clicky/glitchy Playback from SD card
« Reply #4 on: November 23, 2020, 11:46:38 AM »
That's great - thanks for the update!

If you still need this in future - I am not sure either what equivalent of PuTTY works best on Mac, but there seems to be a ported version available. Anything that can talk to a COM port without triggering the RTS line (as the hw handshake signal) should work.

I hope the loopsynth will help you to stay creative during the lockdown. Cheers! :)