DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: stfala on September 02, 2015, 10:27:08 AM

Title: Digital delay uni project.
Post by: stfala on September 02, 2015, 10:27:08 AM
Hello all.

I am looking to design and build a simple delay pedal for a uni project. I have previously built various analogue-based pedals but have little to no experience concerning the digital side of pedal building.

My original plan was to get an Arduino, input audio using ADC, process the signal with delay and output through DAC. If all was well I would program an ATMega with the code, shrink the project into an enclosure sized pcb with maybe some EQ or other analogue effects added. I am aware that it would be easier to simply get a dedicated delay chip for this purpose, but it is more the learning experience I am concerned with here.

Having read up on the AVR chips a little more, it seems that they are not going to cut the mustard in terms of sound quality if the chip is stand alone.

As stated previously, I am quite the beginner at this kind of thing so apologies if I any of these ideas seem crude, but I have various questions:
What external ADC/DACs and RAM would I need for a decent amount of delay time with about 16bit (or at least decent quality) audio?
What external circuitry would I need around the AVR? (input buffer, amplification etc..)
Are there any other microcontrollers that would be better suited for this kind of project?
Would 'C' be best suited for this project or another language?

As I said, this project is more about learning than the simplicity of buying a dedicated chip to achieve what this could achieve. I've played around with Arduino's and enjoy the simplicity of them and how intuitive they are. This is the only reason I have so far chose to use AVR; if an obvious alternative is available for this project, i'd be interested.

Any help on this subject would be greatly appreciated.
Cheers!
Title: Re: Digital delay uni project.
Post by: g_u_e_s_t on September 03, 2015, 03:51:28 PM
its a bit of a pain to add external memory to the arduino.  the onboard memory does 20ms or so, and you may want something on the order of 1s.  i have a few projects ive done along these lines (along with analysis of the arduino's ADC and PWM capabilities): openmusiclabs.com.  be sure to check out the microdec project.

its probably easier to get a micrcontroller that already has a fair bit of memory on it.  the teensy3.0 is better, and has a good codec board as well.  the ST nucleo (32f4 series) is dirt cheap and has tons of memory.
Title: Re: Digital delay uni project.
Post by: stfala on September 07, 2015, 04:45:01 AM
Thanks,I'll check those out!
Title: Re: Digital delay uni project.
Post by: cloudscapes on September 07, 2015, 09:30:50 AM
You can interface to external memory quite easily, such as serial SRAM like one of these:
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=270141&mid=&lang=en

Only need 4 pins to interface to it, and an SPI interface which all microcontrollers support. SPI is hard to do the first time, but after that it's effortless.

The downside to external serial SRAM is you use a few more clock cycles than you would with the microcontroller's internal RAM, or with parallel RAM, because of the serial'nes of it. It'll mean losing a few % of your top samplerate.
Title: Re: Digital delay uni project.
Post by: cloudscapes on September 07, 2015, 09:33:57 AM
I built a microcontroller based delay early this year and logged my progress in this thread, if it can be of any help:

http://www.diystompboxes.com/smfforum/index.php?topic=109314.0

I used a PIC32 rather than arduino, but I'm sure a lot of the theory still stands. I used external serial RAM, and external ADC and DAC, and managed a top samplerate of 72KHz even with some DSP math on each samples.
Title: Re: Digital delay uni project.
Post by: cloudscapes on September 07, 2015, 01:16:08 PM
I'll dump tidbits of info in this thread from time to time.

On the analog side, what you'll really want is a low pass filter in front of whatever ADC you'll be using. As steep as you can get it (4th order at least). Rule of thumb is it starts rolling off at a frequency that is roughly double your sampling frequency. Personally though, just experiment. A bit before, and your delay will be really dark, but you'll filter off a lot more noise. A bit after will give you more high end, but you might hear some aliasing.

I like using filterlab when designing fixed analog filters:
http://www.microchip.com/pagehandler/en_us/devtools/filterlab-filter-design-software.html
Usually a quad opamp is enough to give you an 8 order filter, which is probably good enough for an ADC.

A audio signal is 'polluted' with a TON of frequencies, and most are above audio range! Noise in the hundreds and millions of KHz. We can't hear those with ears obviously, but a microcontroller's ADC can pick it up without filters. Even if you're sampling at an audible frequency, it'll pick up all this high frequency noise. And turn it into new audible noise in your delay.
Title: Re: Digital delay uni project.
Post by: hymenoptera on September 07, 2015, 03:33:39 PM
Quote from: cloudscapes on September 07, 2015, 01:16:08 PM
....
Rule of thumb is it starts rolling off at a frequency that is roughly double your sampling frequency.
...

Just posting to say I think you mean *half* the sampling freq.  ;)
Title: Re: Digital delay uni project.
Post by: cloudscapes on September 07, 2015, 05:17:02 PM
Quote from: hymenoptera on September 07, 2015, 03:33:39 PM
Quote from: cloudscapes on September 07, 2015, 01:16:08 PM
....
Rule of thumb is it starts rolling off at a frequency that is roughly double your sampling frequency.
...

Just posting to say I think you mean *half* the sampling freq.  ;)

Indeed.  :icon_mrgreen: That's what I get for posting at work
Title: Re: Digital delay uni project.
Post by: hymenoptera on September 07, 2015, 06:58:45 PM
  :-X  ::)
Title: Re: Digital delay uni project.
Post by: stfala on September 09, 2015, 11:33:33 AM
Thanks again! I'm thinking now I may actually try using both an AVR and PIC and doing some kind of comparison.
Title: Re: Digital delay uni project.
Post by: ElectricDruid on October 04, 2015, 04:59:34 PM
If you're not interested in the actual hardware design so much, you could look at the Axoloti project. The Axoloti board has all the hardware you'd need, and you could concentrate on the DSP coding. I don't know what your focus is, so that might not be what you're after.

http://www.axoloti.com/axoloti-core/

The STM 32F4 processor that it uses was already mentioned, and both it (32-bit 168MHz) and the RAM (8MB!) are waaaaayyyyy overkill for delay but cheap enough that who cares?

HTH,
Tom