News:

SMF for DIYStompboxes.com!

Main Menu

Digital Looper using dsPIC

Started by potul, May 18, 2011, 02:05:47 AM

Previous topic - Next topic

potul

Hi

My original intention when I started investigating the world of DSP was to work on modulation effects, but once I was there I discovered a neat feature: You easily read and write an SD card (or MMC) using SPI which is available in most PICs. And I thought that could be used for one of the Holy Grails of DIY: A Looper with Overdub capability.
So in the last weeks I've been working to make a proof of concept and see if the recording/reading speed is high enough to allow recording and playing at the same time. It took me some time to have it working, but now it's there.

The unit uses the SDCARD as a memory (easy to interface, easy to find, high capacity and probably you have more than one laying around in a drawer). It is using both the internal 12bits ADC and the 16bits audio DAC of a dspic33F128GP802.
You can see in the video below that it has an LCD, but this is not needed... I just have it there because it is part of my dspic test prototype.

You can see a test video here:



Let me know your thoughts.

egasimus

http://hackaday.com/2010/02/23/looping-foot-pedal/
Been done.

Also check this guy out: http://elm-chan.org/he_a_e.html

However, the world needs more of this kind of projects.

And less PICs. Although IDK about the dsPIC, maybe they fixed their crappy architecture just enough for it to be usable.

This not intended to show any disrespect for your work, though. This is one of the projects I wanna try myself. Keep up the good work :)

potul

Quote from: egasimus on May 18, 2011, 02:16:31 AM
http://hackaday.com/2010/02/23/looping-foot-pedal/
Been done.

Also check this guy out: http://elm-chan.org/he_a_e.html

However, the world needs more of this kind of projects.

And less PICs. Although IDK about the dsPIC, maybe they fixed their crappy architecture just enough for it to be usable.

This not intended to show any disrespect for your work, though. This is one of the projects I wanna try myself. Keep up the good work :)

I know it has been done... I own a BOSS RC-2 !  :)
Seriously, the problem of the project you posted is it only has a recording time of 3s... (not intending to disrespect it, it's a nice project and I was inspired by projects like this one). And as far as I can tell from what I've seen in the web page, it does not overdub, just record-play. (you can't add new layers).
My prototype can record virtually hours, depending on the SD capacity, and uses audio at 16bit 22KHz sampling rate, which should deliver good quality (not now,.... because I get some noise). And because of the high capacity of the card, it can eventually have features like store loops for later use, similar to the commercial units.

Of course I've been leveraging from some projects I found on the web, mostly WAV players using SD/MMC (like the ones in the second link you posted), but I haven't seen any project so far that can record and play simultaneously.

Another thing I would like to highlight, is the rather simple project this is in terms of part count. Only the dsPIC, the needed condensers and resistors to make it work (not even a crystal), voltage regulators, some opamps for buffering and the SD card connector. That's it. And no SMD....

BTW,.... you should take a look at the dsPICs, they are much better than the "old time" PICs. Of course, if I would run a company, I wouldn't use a PIC for a looper, but for the DIY community is a good option.

Regards,

Mat




robertreynisson

This looks exciting.... Keep us posted on how it goes!


slacker

Sound good, I like the idea of using an SD card very neat.

Hides-His-Eyes

how hard is it to learn dsPIC? I presume it's in some kind of OO-C++ language?

potul

dsPIC can be programmed in C. As always in these cases, the language is quite standard (I think is ANSI compliant), what gets tricky is to understand all the registers to configure all peripherals, oscillators, timers and so on.

Taylor

Very nice! I remember we talked about this before, glad to see it coming to fruition, and very much looking forward to watching your progress.

artifus

great stuff! shall be following this thread with interest.

mucha

Looks (sounds) great and interesting!
Would you mind sharing some more details?


potul

I'm still doing some testing, and I haven't had much time to investigate more, but I can share whatever I have now. What details are you interested in?

mucha

Thanks for the quick reply.
I'd love to see some schematic involving the SD card and how you pulled writing, reading and overdubbing to it off.

Dimitree

wow really great, congratulations!

I was studying something like this, but for another purpose: I wanted to store in the SD card wav samples and load them with a midi keyboard, a sort of rompler, but I don't know if it is possible to load more than 1 sample at time (so more than 1 note at time) and do that with low latency.
what do you think?

potul

Quote from: mucha on June 02, 2011, 11:50:12 AM
Thanks for the quick reply.
I'd love to see some schematic involving the SD card and how you pulled writing, reading and overdubbing to it off.

SDCARD is accessed using SPI. You can see some examples of interfacing with SDCARDs here:
http://www.k9spud.com/sdcard/
http://www.uchobby.com/index.php/2008/07/21/dspic-wav-player/

I took it from these examples.
From the SW perspective, I used the microchip MDD library, but only used the "low-level" access to the card, withour any FileSystem.



potul

Quote from: Dimitree on June 02, 2011, 03:54:41 PM
wow really great, congratulations!

I was studying something like this, but for another purpose: I wanted to store in the SD card wav samples and load them with a midi keyboard, a sort of rompler, but I don't know if it is possible to load more than 1 sample at time (so more than 1 note at time) and do that with low latency.
what do you think?

mmm... read speed is usually much faster than write speed, so multiple reads sould be possible, but I can't really tell how many simultaneous samples you could load.
Another thing to consider is that if you want to use standard WAV files in a FAT sdcard, you will need then to use the full FileSystem library, which is much slower than accessing directly the card.

Dimitree

#15
thanks
no I would use a the sdcard just as "eeprom" and with raw audio files (not a true wav if I'm not wrong) so no filesystem needed.
the thing that I don't understand is how can I playback more than 1 file at time (assume just 2)? how the 2 sounds are mixed? it's the same principle that you used on your project when you play over the recorded loop?

potul

mixing 2 signals is as easy as adding them. But... (there is always a but), you need to take care of the overflows. If you add 2 signals that use the full dinamic range, chances are that there will be an overflow.
So, the usual approach is to average them. If you need to mix 2 signals, first you divide them by 2, and then you add them.

So, you need to simultaneously read the 2 files (you can read 512 bytes of each file, store them in a temporary array in RAM), mix them and output to the DAC.

Dimitree

great, and I guess that there's some easy DSP operation that do just this, right?

now I have to do some counts to understand how many samples I can read at the same time

potul

I can't really tell you what's the max transfer rate you can have. It depends highly on the Card, but I've seen some people reporting as much as 2.5 MB/sec

wallymars

Hey man. Could you upload a schematic for this project?  :icon_biggrin: