Author Topic: Simple Audio DSP Module  (Read 50617 times)

markseel

Re: Simple Audio DSP Module
« Reply #40 on: January 04, 2011, 04:44:04 PM »
I'm going to add the option to configure the DSP board for either 32 kHz or 48 kHz sampling rate via the board's programming pin.  Both rates are possible with the current crystal (12.288 MHz) connected to the WM8731 CODEC.  This will allow for a little more delay time (~31 msec vs ~21 msec) for chorus effects.

The CODEC also allows for an 8 KHz sampling rate (would allow for up to 128 msec of delay) but I don't think this will work since the AL3102's PLL is driven by the I2S word clock from the CODEC.  Pretty sure the minimum word clock for the the AL3102's PLL is 32 kHz.

MetalGuy

Re: Simple Audio DSP Module
« Reply #41 on: January 04, 2011, 04:48:24 PM »
Quote
This module is not really going to be useful for delay based effects... Mark addressed this earlier in the thread
http://www.diystompboxes.com/smfforum/index.php?topic=88301.msg745540#msg745540

Thanks for making that clear!
I guess something more serious like an ADSP BlackFin or something will be necessary to do what I need.

mhelin

Re: Simple Audio DSP Module
« Reply #42 on: January 05, 2011, 08:41:57 AM »
I'm going to add the option to configure the DSP board for either 32 kHz or 48 kHz sampling rate via the board's programming pin.  Both rates are possible with the current crystal (12.288 MHz) connected to the WM8731 CODEC.  This will allow for a little more delay time (~31 msec vs ~21 msec) for chorus effects.

The CODEC also allows for an 8 KHz sampling rate (would allow for up to 128 msec of delay) but I don't think this will work since the AL3102's PLL is driven by the I2S word clock from the CODEC.  Pretty sure the minimum word clock for the the AL3102's PLL is 32 kHz.

AL3102's minimum sample rate is 30 kHz.

Btw. I'm quite sure it would be possible to interface regular serial RAM or FRAM to WF DSP. One possible device could be Ramtron's FM25V series 1 Mbit (128 kB ->  max. 1.3 seconds delay time using 16-bits @48 kHz) device FM25V10:

http://www.ramtron.com/files/datasheets/FM25V10ds_r1.1.pdf
http://www.futureelectronics.com/en/technologies/semiconductors/memory/fram-mram/Pages/1995372-FM25V10-G.aspx

Just use the free serial data in/out pins of AL3102 as GP ports to access the F-RAM using SPI.

« Last Edit: January 05, 2011, 08:54:37 AM by mhelin »

mhelin

Re: Simple Audio DSP Module
« Reply #43 on: January 05, 2011, 09:06:19 AM »
Quote
This module is not really going to be useful for delay based effects... Mark addressed this earlier in the thread
http://www.diystompboxes.com/smfforum/index.php?topic=88301.msg745540#msg745540

Thanks for making that clear!
I guess something more serious like an ADSP BlackFin or something will be necessary to do what I need.

Maybe you should check the Line6 ToneCore DSP developer kit first:

http://line6.com/tcddk/



Joecool85

Re: Simple Audio DSP Module
« Reply #44 on: January 06, 2011, 06:09:54 AM »
Maybe you should check the Line6 ToneCore DSP developer kit first:

http://line6.com/tcddk/

Cool!  $199, but still really neat.  I had no idea there was anything like that on the "regular" market.
Life is what you make it.
https://www.ssguitar.com

jasperoosthoek

Re: Simple Audio DSP Module
« Reply #45 on: January 06, 2011, 06:50:39 AM »
Very cool idea but I would prefer one of these boards. Nice and small and it fits in my own enclosure and it doesn't cost 199 bucks ::).
[DIYStompbox user name]@hotmail.com

Joecool85

Re: Simple Audio DSP Module
« Reply #46 on: January 06, 2011, 03:55:13 PM »
Very cool idea but I would prefer one of these boards. Nice and small and it fits in my own enclosure and it doesn't cost 199 bucks ::).

I didn't mean it was a good alternative, just that it was neat that it was out there.
Life is what you make it.
https://www.ssguitar.com

jasperoosthoek

Re: Simple Audio DSP Module
« Reply #47 on: January 06, 2011, 04:23:26 PM »
;D It's not the kind of thing that gets people take their credit cards out when posted on a DIY forum...

Indeed I wouldn't have expected such a thing to be sold by a big company.
[DIYStompbox user name]@hotmail.com

alparent

Re: Simple Audio DSP Module
« Reply #48 on: January 12, 2011, 08:49:24 AM »
OK I might be off track? But anyways!

What I'm looking for is a platform that would teach me.
I read the thread and I'm lost ('cause I know zip about DSP)

I would like something like the Arduino board I've just started to play with.

Something that teaches you, a board, a guide, projects that builds up your knowledge.
Maybe you could offer more then one flavor.

Like a step-by-step introduction to DSP kit (like Arduino) for guys like me (low$, fun to learn with) :icon_redface:
And a full featured kit with all the bells and whistles for you more knowledgeable folks!   

markseel

Re: Simple Audio DSP Module
« Reply #49 on: January 12, 2011, 10:50:41 PM »
I'm probably a minority on this one but I don't know what the Ardruino is all about - I've never used one or even looked into a kit  :icon_redface:  I should look as it seems to be the standard for fun, powerful and easy to use kits.  But I've been programming a long time and I think the DSP module I built is just about as easy as it gets when it comes to getting a DSP system up and running.

I'm a huge fan of the Wavefront and SpinSemi philosophy for Audio DSP's.  Simple architecture, simple instruction set.  Fixed point fractional math is done for you.  You don't have to learn all of the details of a general purpose DSP; no complicated development environment, no thick chip specification or thick user's guide, no CPU and peripheral configuration registers, no boot-loader or RTOS, no need for fixed-point math libraries, no need for commercial compilers, etc.

I think some people may under estimate the power of these audio DSP's.  The AL3102 is 50 MIPS.  But each 'MIP' optionally includes a load from memory, loading of constant, multiply, addition, decimal point adjustment (shift).  That equates to 100's of MIPS for some general purpose DSP's and MCU's.  The FV-1 has some instructions that are even more complicated, not to mention built-in LFO's.

One problem is that this board just a 10-pin SIP - no nice development kit with a board that contains jacks, pots, USB connector, etc.  Another problem is that programming the board involves both Python and assembly-like programming of a DSP.  And no GUI IDE.

But, all you have to do is give the board power, hook up some external parts for the analog stuff, connect a usb/serial adapter and you're on your way to making some noise!  DSP isn't always easy to do correctly but it's not hard to get going with wave-shaping and simple filtering.

There's a lot of smart people on this forum so perhaps others can add stuff to make this a more complete kit like a carrier board with the jacks and usb connector, example code, DSP tutorials, more friendly compiler or IDE, etc.



markseel

Re: Simple Audio DSP Module
« Reply #50 on: February 08, 2011, 09:23:17 PM »
These boards are noisy :icon_frown:

The PCB has separate grounds and power planes and all devices are bypassed with 3 caps (0.1uF, 1.0uF, 10.0uF) at all power supply pins.  The Vmid reference for the CODEC is also bypassed using caps.  Both the analog and digital supply and grounds tie together at one point (at the Vcc and Ground pins on the board).  But it's still noisy  :icon_mad:

The layout is on the website so if anyone has tips on noise reduction through minor layout changes let me know.

Functionally these boards work fine.  I measured about 50 micro-volts RMS of noise at the CODEC analog output with the CODEC's analog inputs tied to ground via a 10K resistor.  So that's about an -90 dB noise floor (assuming 0db is 1 volt RMS) or 15 bits of noise-free ADC samples (from the 24-bit ADC).  Not nearly good enough.

I was interested in doing some distortion algorithms that have gains of around 1000 (60 dB) .  This raises the noise floor up to -20 db !!! and now only 3 or 4 of those 24 bits are noise free.   >:(

So ... what should I do?  I started working on the XMOS board since I thought this board was pretty much done.  I'd rather keep going with the XMOS board but if there's enough interest in the Wavefront-based board then perhaps I'll work out a new layout that included separate voltage regulators for analog and digital with complete separation of analog and digital grounds.

Any Thoughts?

g_u_e_s_t

Re: Simple Audio DSP Module
« Reply #51 on: February 09, 2011, 10:29:00 AM »
what frequency bands is the noise in

im using the same codec
and it needs some heavy filtering at the output
and i dont think its actually good down to 24b anyways

the board looks cool
although its a really tight layout
it will be tough to get really low noise
without going to four layers

another thing i found
is that the codec is really sensitive to timing
of the lrclk pin
although those sorts of errros would probably have a higher noise
than what you are seeing

markseel

Re: Simple Audio DSP Module
« Reply #52 on: February 09, 2011, 11:57:05 AM »
Thanks for the tips G U E S T.  I didn't look at the frequency distribution for the noise.  That would be a good place to start if I were to try to determine the noise source and decide how to quiet it down.  The CODEC has the oscillator and PLL on board and is the timing master (generates word clock) so I think the timing is fine.  The spec indicates that some high-pass filtering at the ADC inputs is present on the chip to lower anti-aliasing of noise into the ADC but I suppose external circuitry would help that if it were part of the problem.  Right, the layout is tight and so proximity to digital devices could be an issue.  Also, I could have used individual LDO's for digital and analog supplies rather than tying them together at the board's VCC pin - that would provide another 40 db of supply noise rejection.  But I'm not sure if supply noise is the issue.  Thanks for the ideas!

markseel

Re: Simple Audio DSP Module
« Reply #53 on: February 09, 2011, 12:09:58 PM »
The ADC on the WM8731 has an SNR of 90 db.  I think that's my noise problem  :icon_eek:

So it seems that the dynamic range bottleneck is the due to the ADC's SNR rating and not to the board design (unless I don't understand the CODEC spec).

Good and bad news I guess.

If anyone wants a board then keep an eye on the web-site in the next week or so because I'll start building to order.
But caution; the SNR is going to be an issue if your 'effect' has really high gain (like a heavy distortion effect).

So ...

How are digital distortion effects implemented to be low noise?  Is there an analog pre-gain block (would require decent analog dynamic range in the signal chain before the CODEC's ADC)?  Noise gating would help but that just cuts out audio when the signal arrives at the noise floor - in this case the clean signal still only has 5 bits of representation.  Is there another way of simulating distortion without using so much digital gain?

g_u_e_s_t

Re: Simple Audio DSP Module
« Reply #54 on: February 09, 2011, 12:40:54 PM »
most distortions are pretty noisey
its hard to avoid

lets say youre amplifying a guitar signal
and you have a pickup of 2k impedance
this gives almost 1uV of thermal noise from the pickup
and after a gain of ten
which is minimal for getting it to fill the ADC range
this is now 10uV without even considering the amplifier noise
which only gives -100dB noise floor

mhelin

Re: Simple Audio DSP Module
« Reply #55 on: February 09, 2011, 05:31:13 PM »
The ADC on the WM8731 has an SNR of 90 db.  I think that's my noise problem  :icon_eek:

Maybe a stupid question but have you initialized the codec to use the left justified mode the DSP uses (Audio Data Format Select register, value 01 = MSB-First, left justified, default is 10=I2S which is left-1 justified - using the I2S format would give 6 dB worse SNR).

Also you could use the common trick to get 6 dB more: sample hte mono (guitar) signal in stereo and sum the channels in DSP.

See http://www.cirrus.com/en/pubs/appNote/AN331REV1.pdf

That presents another trick which is to use the stereo input as differential input (just invert the signal for the other channel before A/D and later calculate the difference). That would also help reducing the common mode noise from converter clock signals on PCB.

Quote
So it seems that the dynamic range bottleneck is the due to the ADC's SNR rating and not to the board design (unless I don't understand the CODEC spec).

SNR of 90 dB is actually quite decent when compared to 1st generation CD players. Can you measure the in-out SNR (etc.) using a PC and RMAA software (http://audio.rightmark.org/download.shtml ). You should get results that are on the level of most onbord audio-codecs (AC97 and cheap HD audio).

- Mikko

« Last Edit: February 09, 2011, 05:39:49 PM by mhelin »

jasperoosthoek

Re: Simple Audio DSP Module
« Reply #56 on: February 09, 2011, 06:54:16 PM »
Nice trick sampling in stereo but it should only give 3dB better SNR. The correlated signal is doubled giving 6dB extra but the uncorrelated noise is increased too by sqrt(2) or 3dB so you gain the difference of the two as SNR.
[DIYStompbox user name]@hotmail.com

mhelin

Re: Simple Audio DSP Module
« Reply #57 on: February 10, 2011, 03:32:22 AM »
Nice trick sampling in stereo but it should only give 3dB better SNR. The correlated signal is doubled giving 6dB extra but the uncorrelated noise is increased too by sqrt(2) or 3dB so you gain the difference of the two as SNR.

Yeah, the paper told that as well, my eyes just locked into the 6 dB mentioned first.  So the 93 dB sampling SNR should be achievable using the stereo inputs mixed and averaged to mono. I would use the "differential mono" trick as well - at least I would test it properly, WM8731 inputs are single ended so I think it would really help reducing the common mode noise emitted from various sources.  Maybe there should also be some analog circuit preceding the A/D like a compressor (optical one is simple and matches the guitar signal well preserving the initial attack and lenghtening the decay nicely) to keep the analog level higher, and the noise gate on the output as well (used at least with high gain distortion and overdrive FX, implemented using an RMS level detector and transistor or FET to gate the signal off, THAT Corporation makes nice chips for that purpose like 4301P, see the app note DN100: http://www.thatcorp.com/datashts/dn100.pdf , that circuit maybe a little bit simplied could be implemented using single 4320 chip which includes RMS detector, VCA and couple of op-amps, see http://www.thatcorp.com/4320_Low-Voltage_Low-Power_Analog_Engine.shtml ).  
« Last Edit: February 10, 2011, 03:47:24 AM by mhelin »

pruttelherrie

Re: Simple Audio DSP Module
« Reply #58 on: February 27, 2011, 06:01:54 AM »
Noise gating would help but that just cuts out audio when the signal arrives at the noise floor - in this case the clean signal still only has 5 bits of representation. 

But in this case you sense at the input and then gate at the output.

markseel

Re: Simple Audio DSP Module
« Reply #59 on: March 20, 2011, 10:50:38 AM »
I used op-amps to create differential inputs for the guitar, amplify by 20 db and soft clip if needed, and send the result and inverted result to both of the CODEC's stereo inputs.  If anyone wants the circuit I'll post it.  Noise performance seemed pretty good although I didn't measure it.

The DSP board works great except that I can't update the DSP RAM with pot values properly.  I'm able to load DSP programs over the DSP's serial bus but when I try to load data into it's RAM the values seem to get corrupted.  I'm writing to the area of memory that's considered the 16 user registers and not to the RAM that's used for sample memory.

I'm using hardware signal from the Atmel to the DSP (Atmel GPIO to DSP Input pin used as GPIO) to allow the DSP program to avoid accessing the memory when the MCU is writing to it (line is high while MCU is writing).  But this didn't solve the problem.  I don't think this is a collision or arbitration problem but rather an issue with how I'm using the serial I/O protocol.

So I'm stuck.  And I really like that XMOS chip!  I'll probably move on from this project on to the next (nextmos board posted in this forum).

I'll make sure the website mentioned in this post is updated within a few days with Gerbers and source code in case anyone wants to do more with this project.