Author Topic: Can don't we use typical microcontrollers for DSP ?  (Read 314 times)

siam19

Can don't we use typical microcontrollers for DSP ?
« on: July 07, 2021, 02:18:47 PM »
I'm really new to DSP. I have no idea where to start. I was thinking about using general purpose microcontrollers like Atmega328p to make guitar effects but I couldn't find any resources to do so. Is it because of the low data bus size ? Is it because of the clock speed ?

Digital Larry

Digital Larry
DSP tinkerer and former transistor twister

ElectricDruid

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #2 on: July 08, 2021, 07:27:28 PM »
Nothing wrong with using general purpose microcontrollers for DSP, but you need to choose chips with enough power to do the job. There are lots of people doing DSP on the STM 32-bit chips, for example (like the Teensy boards suggested by Larrry). On the AVR/Atmega 8-bit chips that you're talking about...not so much! Just not enough juice to do a decent job!
Those chips have their uses, like for producing modulation sources, or dealing with MIDI, or adding memories, but dealing with audio input/processing/output probably needs something with more power.


niektb

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #3 on: July 09, 2021, 03:07:37 AM »
ElectroSmash has this Uno Guitar Pedal Shield:
https://www.electrosmash.com/pedalshield-uno
This shows that there is something possible in a simple atmega but the sounds aren't very convincing... (Probably also because of the limited ADC and DAC bit)

Digital Larry

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #4 on: July 09, 2021, 10:04:54 AM »
I've given my thoughts about getting started with DSP a few times.  Here's one of them from a couple years ago.

https://www.diystompboxes.com/smfforum/index.php?topic=125197.msg1191043#msg1191043

The older I get (and I am getting pretty old) the more I think that this splits into a few main zones and you should decide which zone you are in before proceeding.

If you want to learn about audio DSP from a theoretical mathematical perspective (independent of any specific language or hardware implementation) then you should take some university courses or if you already know a lot of math you can just dive in with Julius Orion Smith.  https://ccrma.stanford.edu/~jos/filters/filters.html

If you want to USE DSP building blocks such as filters, delays, etc. and quickly build these things up to see what they sound like, again without reference to a specific hardware implementation, check out the Faust language.  It takes some getting used to but I've been using it a lot recently and have come up with some really nice sounding stuff using their libraries.  Ultimately you can port Faust algorithms to some small micros (I tried it with an ESP32) but you may find that the complexity of the algorithm is limited by processing speed, memory, etc.  Whereas if you develop VSTs or standalone apps for your PC, I won't say you have infinite power, but you have quite a lot.  The Faust IDE is a browser-based tool that lets you develop and test stuff almost immediately.  I find this really important.  At some point you have to stop worrying about low level concerns like codec interfaces if you want to get any DSP programming done.

If you want to go into business making pedals, then I'd check out some of the application specific chips such as Spin FV-1,  Experimental Noize FX Core, or Cool Audio V-1000 (?).  These provide reasonable bang for the buck if you are manufacturing but are relatively difficult to develop code for and have architectural limitations such as number of control inputs that you may or may not care about.

Personally I got into the FV-1 pretty heavily about ten years ago, but I wasn't all that interested in going into manufacturing pedals.  It's just the way it worked out.  I don't mess with the FV-1 much any more but we did have some good times together.  Now I am using Faust and developing VSTs.  I wish I'd done this ten years ago!
« Last Edit: July 09, 2021, 10:09:03 AM by Digital Larry »
Digital Larry
DSP tinkerer and former transistor twister

siam19

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #5 on: July 09, 2021, 05:38:12 PM »
Thanks for the advice! I'm currently fiddling with the Faust language. I'll look into the FV-1 chips you mentioned

Digital Larry

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #6 on: July 11, 2021, 10:39:29 AM »
Great.  I found that this online Faust course, given by one of its leading practitioners with guest appearances by the creator, to be very helpful.  You can take it for free.  If you want a downloadable printable and subsequently suitable for framing certificate, you need to pay $20 a month for however long it takes you to complete it.  Just keep in mind these are pre-taped video lectures and all of the assignments are mostly robo-graded which means sometimes you do something right and get 0 points and can't get anyone to even acknowledge it.  Is it worth FREE?  Absolutely.  It's even worth $20/month.

https://www.kadenze.com/courses/real-time-audio-signal-processing-in-faust/info

For the FV-1. you can jump start your coding journey by using SpinCAD Designer, which I wrote about 8 years ago (and no longer think about for the most part).

https://github.com/HolyCityAudio/SpinCAD-Designer
Digital Larry
DSP tinkerer and former transistor twister

anotherjim

Re: Can don't we use typical microcontrollers for DSP ?
« Reply #7 on: July 13, 2021, 05:17:30 PM »
You can fake anything that a BBD delay can do with an MCU. Your 328 can run at 20Mhz. However, inline assembler code is the best way to make the most of it since you can avoid using any of the RAM for the stacks a high-level language will probably demand and have it all for sample buffers. I've done chorus & delay with ATtiny85 and 84 chips which can run just as fast as the Mega328. The 85 can run at 16Mhz without a crystal using up its small pinout. I saw somebody made basic video games like Pong in a Tiny85 with VGA output and not much more than a few resistors and switches.
Apart from having more RAM, the 328 doesn't really bring much you can use that the Tiny chips can't do. The job only needs the ADC and timers for PWM. The basic CPU core and instruction set is mostly the same.

However, if you want to work in a high-level language like C and do the full range of DSP, I think you'd best forget the basic MCU's as already pointed out.
Croeso i Diystompboxes.

If they didn't hear you then you didn't say it.