LeeHenderson
New member
Forgive me if this is answered elsewhere, but I couldn't find it.
I'm building a looper using Teensy and its audio shield. I made a working version that takes a line-level input from any sound source, and will loop a section of whatever you feed into it, and that works great. But the external sound source keeps going, obviously, unaware it's being looped, so switching back to it produces a jump cut.
My new objective is to have the Teensy play back a file from the SD card; when the loop button is pressed once, it registers the current playhead position as the start of the loop and continues playing, and when it's pressed a second time it registers that playhead position as the end of the loop and jumps back to the start of the loop—the idea is that it would then play that looped section over and over until the loop button is pressed a third time, at which point it would finish its current loop and resume normal playback, seamlessly. The "loopStart" and "loopEnd" values would get wiped as it waits for new loop-button-presses.
Is this possible with the Teensy? I couldn't find a way to either write or read a specific playhead position in the audio file... would this be done by reading the number of the sample, or the milliseconds/microseconds into the file, etc.? Beyond that, I'm fairly certain I know how I would write the sequence of events as different operational modes (start playback, start loop, end loop, resume unlooped playback, etc.)
Thanks for any help anyone can provide!
p.s. - I've just been using the Audio.h library from PJRC, but feel free to redirect me if there's a better solution...
I'm building a looper using Teensy and its audio shield. I made a working version that takes a line-level input from any sound source, and will loop a section of whatever you feed into it, and that works great. But the external sound source keeps going, obviously, unaware it's being looped, so switching back to it produces a jump cut.
My new objective is to have the Teensy play back a file from the SD card; when the loop button is pressed once, it registers the current playhead position as the start of the loop and continues playing, and when it's pressed a second time it registers that playhead position as the end of the loop and jumps back to the start of the loop—the idea is that it would then play that looped section over and over until the loop button is pressed a third time, at which point it would finish its current loop and resume normal playback, seamlessly. The "loopStart" and "loopEnd" values would get wiped as it waits for new loop-button-presses.
Is this possible with the Teensy? I couldn't find a way to either write or read a specific playhead position in the audio file... would this be done by reading the number of the sample, or the milliseconds/microseconds into the file, etc.? Beyond that, I'm fairly certain I know how I would write the sequence of events as different operational modes (start playback, start loop, end loop, resume unlooped playback, etc.)
Thanks for any help anyone can provide!
p.s. - I've just been using the Audio.h library from PJRC, but feel free to redirect me if there's a better solution...