Basic looper for seed w/ sd card write and read

I’ve seen many examples for loopers, samplers, etc for seed. And a few of them even read from the sd card. But there has been no clear example of one that is actually useful beyond experimenting or playing pre-recorded loops from elsewhere. Until now! I made one. Because a proper looper/sampler should 1. live sample input and 2. recall samples after reboot.

I needed this functionality for a project and soon found I would have to cook this one up/piece it together myself. I also soon found out why there may not have been an example already: it can be quite finicky/impossible on a breadboard setup and there is incomplete functionality in libDaisy to properly write to the sd card. Reading to memory is non-existent in the library too. Thankfully hajaba on this forum posted some working code for reading that I modified a little. A few months of development and a pcb design later, and I’ve got it.

Because it’s been quite a long and difficult process for me to get what to many would almost think of for the next project after hello world, I wanted to share this looper code to give others a proper start with sampling and sd card usage. As well as some solutions to pitfalls I encountered along the way.

STEPS

  1. Either download/copy this file daisy_looper/src/main.cpp at main · willemOH/daisy_looper · GitHub and put it in a new seed project or setup as new repo: git clone --recurse-submodules https://github.com/willemOH/daisy_looper going through repo setup as documented here for daisyexamples Getting Started - Daisy (just build-all if you’ve done this before). Note: I’ve had issues here with vs code intellisense and inability to build because of incorrect drivers being built from submodules. If you run into these issues, leave a comment and I’ll share some fixes I’ve found.
  2. If this PR hasn’t been accepted, make those changes to wavwriter.h
  3. If using breadboard, make sure connections between sd card reader and seed are as close as possible. I could not get this to work on breadboard as seen here: Opinions on MicroSD card data line traces if you run into any of those errors, too long connections is why because this works once I got the design onto a pcb with less than 50mm distance between daisy pins and sd card reader pins w/ .3mm trace.

I’ve tried to make this project as readable like example as I can. No doubt it could be better if it were an official example. This is a project that should be an essential example for daisy seed or pod and I would like to see it or a revised version put in the daisy examples repo.

3 Likes

This is amazing, @wailem!! Thank you so much for your hardwork and contribution.

You’re definitely right, since many of the Daisy boards have SD card slot, there should be more examples available that utilize that.

Please feel free to make a PR for DaisyExamples repo, etc..
We have merged a community member’s granular sampler PR before so more examples of how SD card can be utilized would be awesome.

SD card is a recurring topic that we often see so we do want to make it easier for people to get started building a project with it (tutorials, examples, etc.).

Very interesting! My goal is a single button looper that saves each recording session. Im less concerned with recall but that is a great feature to have. Im hopeful I can get it to save each overdub as its own audio file with the right length. Maybe each loop session gets a folder and its filled with all the separate overdubs. I like the idea of loading up the SD card and having a large collection of these looping sessions. I appreciate you sharing all this info and look forward to banging my head against it this weekend.

Welcome to the forum. I’m glad to see that this example has sparked you. It should be pretty set for you except you’ll have to make the adjustments for overdubbing as currently the program records a new loop on each record press. Good luck!

Great I’ll take a look at that example of a community member example project PR and get one made soon. As I mentioned in the post, there is a PR for libDaisy I made that needs to be merged before this example will work for saving loops. When that gets reviewed and merged I’ll get going on the example PR!

1 Like

Unfortunately I’ve found a bug where everything is good for the first record but If you record again without power cycling, the loop on the sd card will have a glitch in it. Mentioning it so people don’t get confused about the erratic behavior. Makes it not so useful as a looper in practice but still a decent example. I’ll update here if this gets fixed.

Ok I improved it. I was sure it was an error in my code but it turned out to be more shortcomings in the WavWriter class. Details for what to expect in second commit message of the updated PR.

1 Like