Can don't we use typical microcontrollers for DSP ?

Started by siam19, July 07, 2021, 02:18:47 PM

Previous topic - Next topic

siam19

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
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

ElectricDruid

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

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

#4
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!
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

siam19

Thanks for the advice! I'm currently fiddling with the Faust language. I'll look into the FV-1 chips you mentioned

Digital Larry

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
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

anotherjim

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.

Vivek

Quote from: Digital Larry on July 11, 2021, 10:39:29 AM

For the FV-1. you can jump start your coding journey by using SpinCAD Designer, which I wrote about 8 years ago

Larry, I thank you for your contributions to the DIY DSP world.

Respects sir !!!

gena_p1

To make more or less professional effects you need fast MCU with float point MPU. Cortex m7 or m4.
STM32H750VBT6 , for example.

Or try make VST.

AVR 8 bit are too slow. 16Mhz@8bit , but FV-1 is 6Mhz@24bit and 1 cycle per command.

Of course you can make effects even on Z80, but they will be good for 1985, not for 2021

Hamuro

Quote from: siam19 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 ?

Just to share my experience, I have developed such pedals using STM32F103 and ESP32-A1S. 

With STM32F103 I can run noise gate, compressor, delay,  distortion, and tremolo at the same time so its a multi effect. It has a chromatic guitar tunner, and you can save and load up to 19 presets. I published the source code at github.com/hamuro80/deepstomp

Unfortunately the STM32F103 has no FPU (floating point unit) so we have to use fix point math for real time processing because forcing it to use floating point computation will be very slow to execute. I had tried to use STM32F4 series for the FPU feature but once I realize that ESP32 has FPU as well the I moved to the ESP32-A1S as the main development since it is much lower in price and it has on-board 24 bit stereo codec.

Now I have successfully developed vocoder, polyphonic pitch shifter, double rotor rotating speaker simulator, and shimmer reverb using ESP32-A1S. I write the codes as Arduino library to ease the development of digital pedal for everyone, download the library at github.com/hamuro80/blackstomp

Blackaddr

Quote from: Hamuro on March 10, 2022, 11:48:45 AM
Now I have successfully developed vocoder, polyphonic pitch shifter, double rotor rotating speaker simulator, and shimmer reverb using ESP32-A1S. I write the codes as Arduino library to ease the development of digital pedal for everyone, download the library at github.com/hamuro80/blackstomp

Hi Hamuro, I've always been interested in DIY pitch shifters. Have you posted the source code for it on your github? I couldn't find it in the blackstomp repo.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Hamuro

Quote from: Blackaddr on March 21, 2022, 07:33:26 AM
Quote from: Hamuro on March 10, 2022, 11:48:45 AM
Now I have successfully developed vocoder, polyphonic pitch shifter, double rotor rotating speaker simulator, and shimmer reverb using ESP32-A1S. I write the codes as Arduino library to ease the development of digital pedal for everyone, download the library at github.com/hamuro80/blackstomp

Hi Hamuro, I've always been interested in DIY pitch shifters. Have you posted the source code for it on your github? I couldn't find it in the blackstomp repo.

I'm sorry that I don't have any plan to share the source code of my polyphonic pitch shifter.  But I can say that my current implementation is just  a ring  buffer with 3 overlapping inverted raised cosine windows for the reading. I think I should explore the FFT-IFFT method for my future proprietary project.