Loop pedal - Glitchy sounds when recording Raw to SD card from Audio Adapter Shield

Hi :cool:

I am working on a university project - a loop pedal with generative drum rythms. It is going really well, but I have a small problem.

The first loop I record sounds exactly as it should. No glitch or anything. If I remove that recording, and begin to record a new loop, the sound starts glitching. Here is a video with a demonstration of the issue.

If I restart the Teensy, it works as intended again for the first recording, but not the second and beyond. I have tried to turn of all timers, and other actions, but the problem still persist. The code for recording is based on the Recorder example code in the Audio library. https://github.com/PaulStoffregen/Audio/blob/master/examples/Recorder/Recorder.ino
I measured the time (using the commented out usec variable), and it also looks great - as good time measurements for the second recording as for the first recording.

Here is the class in my code, that takes care of everything related to this:
https://github.com/MariusIrgens/LoopPedal/blob/master/LoopPedal/Looper.h
https://github.com/MariusIrgens/LoopPedal/blob/master/LoopPedal/Looper.cpp

And here is my repo main page - it has some more pictures and information:
https://github.com/MariusIrgens/LoopPedal

I tried a couple of different SD cards: a 4 GB Kingston SDHC (older one), and a Verbatim pro microSDHC 600x with 32GB - both have the same issue. Here is the SD card I am using in the demo:
20230930_204738.jpg

I thought it should be fast enough, right? Why is this only happening on the second recordingMaybe there is something wrong in my code? Can anyone give me some advice on this? It is driving me insane :p
 
I think we may need a bit more information, and a simpler example - ideally using just Arduino and Teensyduino.

I'd recommend you try with Teensyduino 1.59 beta 3, because there were some definite issues with bad interactions between the SPI and Audio libraries. Using SD write buffers bigger than 512 bytes may improve things - about 4k seems to be the sweet spot. Neither of these really hits the "it only happens on the second recording", unless you never played back a file before the first recording, and you did before the second / subsequent recordings. Which you might well do for a looper, but it's hard to tell with 30 or so source files...
 
Thank you so much for the answer. I will definitely try with the beta 3 version and see if that helps, and also bigger buffer.

On the first recording, there has indeed never been any playback of a wavefile yet (drum sounds are synthesis based).

If I start recording a loop, then stop it mid-recording and never play it back, then start recording again, it works perfectly (no glitches).
It is only if I actually play back a recording once, it starts glitching out on subsequent recordings.

I record a loop, and it goes into playback mode. If i remove it, and start recording a new sound, the glitching starts.
 
OK, I can confirm that installing the 0.59.3 board package fixed the issue. Thank you so much h4yn0nnym0u5e!

I will take the repo private for some time while I work on the project, then I will make it public again when it is finished. If anyone needs to have a look at the code, please let me know :)
 
Back
Top