Hi,
this seems to be working now so it might be useful for others... It is a 8-track monaural looper using Teensy4.1 and it's Audio Adaptor with Line input or high impedance Guitar input and Line output.
The first track recorded sets the length of the loop. Each track can be re- recorded any time and it's playback can be switched on and off.
I am not aware, that a multitrack looper has been documented using SD-card as medium. I think this is a possibility, which is quite new, while existing loopers use RAM and are therefore more limited.
As the recording is done onto SD-card, the storage is permanent. As the storage is LARGE, the loops can be very long. Main challenge of this project is timing. While average speed of SD-cards is very high, they can have "write latency", when they have to erase flash or when they encounter a bad block. These events slow down speed very much and are hard to debug as they are not foreseeable. Enablers for this project are Teensy4.1's high speed and big RAM, which is used for large buffers. Together with the usage of a fast SD-card.

For a proposal of a high impedance buffer, see here: https://forum.pjrc.com/threads/6961...-Signals-for-Teensy-Audio?p=300996#post300996 In my opinion, the sound quality is good enough to be nicely useful for electric guitar.
In my setup I use power from USB. This means that there is a connection of digital GND to the PC here.
User interface is done via ST7735 1.8" TFT display and just two foot switches. (I did a bore for a rot encoder into my enclosure, to prepare future possibilities....)
The AudioLibrary Setup is very straight forward.
ADC -> (Peak Detect + Queue1)
Queue2 -> DAC
So there are 2 audio queues. One is used to sample audio into the track. The tracks are summed into the second one to be played.
It holds all track data in one file using 5 64k buffers. It is essential to use a fast SD-card "A2 V30": Sandisk Extreme A2 V30. (64GB)
(I have learned, that wear of the SD card is handled by the controller inside the card.)
The SD-card is formatted to use 64k block size instead of 128k.
File handling is done by the sketch, not by the audio library, which is said not to support ExFAT.
64k Buffers 0 and 1 always hold the start of the loop to be able to switch to the start instantly. No need to read these from the SD-card.
Buffers 2...4 are used rolling: ReadSD - Work - WriteSD
The looper works with the threads library. It's time slices are cut down to only 10 microseconds via "threads.setSliceMicros(10);", time critical threads are set to use 10 slices for high priority.
" int idQueue= threads.addThread(doQueue); // 5
threads.setTimeSlice(idQueue, 10);"
The threads library uses a timer to interrupt whatever is done at the moment including library code.
footThread: User Interface
tftThread: User Interface
doQueue: Read and write the audio queues. Handle the 64k rolling buffers. Mix active tracks by addition plus soft saturation. Fast fade in and fade out at the restart of the loop to reduce "plopp" noise.
fileThread: Read and write 64k rolling buffers to/from the work file on SD-card
Communication between the threads works via global variables.
For the (simple) user interface only 2 footswitches are used. One of them, "A", is sensitive to how long you press it, it has 3 modes: short, medium, long.

At the moment the up to 8 tracks have all the same level and are just added to a monaural output. To be able to convert a loop to a cute audio file, the separate tracks can be exported into a 8-track WAVE file. This can be sent to the PC via "YMODEM" protocol, which takes some time. The program Teraterm can receive this type of transfer. I added this transfer, because in my enclosure, the SD-card is not accessible from outside. The program Audacity can work with the 8-track WAVE file format.
Attached, there are two pictures of the setup in an enclosure. It is rather large, as I love to have opportunities for additions. Unfortunately I did not find a fine metal low cost enclosure with 2 hights, so this is not shielded. On the other hand, wrapping the setup in aluminium foil did not improve SNR, so no harm done.
Thanks for the great libraries!!!! Thanks for inputs and hints in this great forum!!!
If someone is using this or parts of it, it would be nice to see some feedback here.
Have fun, Christof
this seems to be working now so it might be useful for others... It is a 8-track monaural looper using Teensy4.1 and it's Audio Adaptor with Line input or high impedance Guitar input and Line output.
The first track recorded sets the length of the loop. Each track can be re- recorded any time and it's playback can be switched on and off.
I am not aware, that a multitrack looper has been documented using SD-card as medium. I think this is a possibility, which is quite new, while existing loopers use RAM and are therefore more limited.
As the recording is done onto SD-card, the storage is permanent. As the storage is LARGE, the loops can be very long. Main challenge of this project is timing. While average speed of SD-cards is very high, they can have "write latency", when they have to erase flash or when they encounter a bad block. These events slow down speed very much and are hard to debug as they are not foreseeable. Enablers for this project are Teensy4.1's high speed and big RAM, which is used for large buffers. Together with the usage of a fast SD-card.

For a proposal of a high impedance buffer, see here: https://forum.pjrc.com/threads/6961...-Signals-for-Teensy-Audio?p=300996#post300996 In my opinion, the sound quality is good enough to be nicely useful for electric guitar.
In my setup I use power from USB. This means that there is a connection of digital GND to the PC here.
User interface is done via ST7735 1.8" TFT display and just two foot switches. (I did a bore for a rot encoder into my enclosure, to prepare future possibilities....)
The AudioLibrary Setup is very straight forward.
ADC -> (Peak Detect + Queue1)
Queue2 -> DAC
So there are 2 audio queues. One is used to sample audio into the track. The tracks are summed into the second one to be played.
It holds all track data in one file using 5 64k buffers. It is essential to use a fast SD-card "A2 V30": Sandisk Extreme A2 V30. (64GB)
(I have learned, that wear of the SD card is handled by the controller inside the card.)
The SD-card is formatted to use 64k block size instead of 128k.
File handling is done by the sketch, not by the audio library, which is said not to support ExFAT.
64k Buffers 0 and 1 always hold the start of the loop to be able to switch to the start instantly. No need to read these from the SD-card.
Buffers 2...4 are used rolling: ReadSD - Work - WriteSD
The looper works with the threads library. It's time slices are cut down to only 10 microseconds via "threads.setSliceMicros(10);", time critical threads are set to use 10 slices for high priority.
" int idQueue= threads.addThread(doQueue); // 5
threads.setTimeSlice(idQueue, 10);"
The threads library uses a timer to interrupt whatever is done at the moment including library code.
footThread: User Interface
tftThread: User Interface
doQueue: Read and write the audio queues. Handle the 64k rolling buffers. Mix active tracks by addition plus soft saturation. Fast fade in and fade out at the restart of the loop to reduce "plopp" noise.
fileThread: Read and write 64k rolling buffers to/from the work file on SD-card
Communication between the threads works via global variables.
For the (simple) user interface only 2 footswitches are used. One of them, "A", is sensitive to how long you press it, it has 3 modes: short, medium, long.

At the moment the up to 8 tracks have all the same level and are just added to a monaural output. To be able to convert a loop to a cute audio file, the separate tracks can be exported into a 8-track WAVE file. This can be sent to the PC via "YMODEM" protocol, which takes some time. The program Teraterm can receive this type of transfer. I added this transfer, because in my enclosure, the SD-card is not accessible from outside. The program Audacity can work with the 8-track WAVE file format.
Attached, there are two pictures of the setup in an enclosure. It is rather large, as I love to have opportunities for additions. Unfortunately I did not find a fine metal low cost enclosure with 2 hights, so this is not shielded. On the other hand, wrapping the setup in aluminium foil did not improve SNR, so no harm done.
Thanks for the great libraries!!!! Thanks for inputs and hints in this great forum!!!
If someone is using this or parts of it, it would be nice to see some feedback here.
Have fun, Christof