Author Topic: Audio Reverb with Cortex M4  (Read 4301 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Audio Reverb with Cortex M4
« on: December 13, 2018, 04:51:57 pm »
Hi,
Recently I have done several cool DSP projects based on CMSIS and PCM audio data on M4, like FIR filters, Graphic Audio Equalizer, FFT and some compression etc... Now I want to implement Reverb Effects on the PCM, do we have some good algorithms to do that, preferably I want it to be done with the CMSIS DSP library. any Ideas?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15574
  • Country: fr
Re: Audio Reverb with Cortex M4
« Reply #1 on: December 13, 2018, 06:30:21 pm »
Don't expect to achieve high-quality reverbs on a Cortex M4. Those can take a lot of processing power.

One of the simplest yet acceptable algorithms I know of and have used is the Schroeder reverb algorithm:
https://valhalladsp.com/2009/05/30/schroeder-reverbs-the-forgotten-algorithm/
https://www.dsprelated.com/freebooks/pasp/Schroeder_Reverberators.html

It uses relatively simple DSP blocks that you probably already have, and can probably run on a Cortex M4 depending on the number of filters you'll use.

 
The following users thanked this post: ali_asadzadeh

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Re: Audio Reverb with Cortex M4
« Reply #2 on: December 13, 2018, 07:35:33 pm »
Thanks for the help. ;) :)
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Re: Audio Reverb with Cortex M4
« Reply #3 on: December 14, 2018, 08:31:28 am »
It seems they have removed the Code links, And I can't find them, do you have them yourself?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Audio Reverb with Cortex M4
« Reply #4 on: December 14, 2018, 05:02:55 pm »
Use prime numbers only.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Re: Audio Reverb with Cortex M4
« Reply #5 on: December 14, 2018, 07:18:51 pm »
Quote
Use prime numbers only.
What do you mean?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline MT

  • Super Contributor
  • ***
  • Posts: 1676
  • Country: aq
Re: Audio Reverb with Cortex M4
« Reply #6 on: December 14, 2018, 09:31:45 pm »
You can do excellent sounding reverb with F4-F7 and it has been done by several people.

It all boils down to what kind of compromises you're willing to make such as choice of algorithms, tolerance for short RT60, metallic/resonant artifacts, etc, etc. Tuning and fine adjust reverbs to sound great is definitely an art, and
folks who do this spends lots of time to get it just right. Quality sounding reverbs is by ear not by math skills.

One example of low computational OK sounding reverbs (quality is relative) is Clouds and Elements modules whos reverb part is about 5.5-6% of available CPU on a F4 168MHz 32-64k RAM. You can also experiment up your reverb using PD and listen how it turns out before start coding.
https://puredata.info/




« Last Edit: December 14, 2018, 10:16:58 pm by MT »
 

Offline diyaudio

  • Frequent Contributor
  • **
  • !
  • Posts: 683
  • Country: za
Re: Audio Reverb with Cortex M4
« Reply #7 on: December 15, 2018, 07:07:08 am »
Quote
Don't expect to achieve high-quality reverbs on a Cortex M4. Those can take a lot of processing power.

discouraging forum members at it again. I have no idea where the theoretical discouraging responses to you question is coming from, in all truth build it and push every cycle out of it, some great sound reverbs was build with a 60MHz DSP in the 90's using a SMID architecture SHARC DSP ADSP-21065  running at a peak of 60MHz.
Line-6 Audio did a lot of work on this processor platform.
(Do note this processor although at 60MHz, has a parallel processing capability allowing the ability to shard out processing by adding more processors together you cannot do this "yet" with a ARM MCU)

Today, using discovery eval board running an ARM Cortex M4 OR M7 (even better) you can, build a killer sounding reverb that exceeds or match sound performance capabilities of past pro-audio platforms,The truth is processor speed is the least of your initial issues, reverb algorithm optimization, dropping down to assembly is a MUST to get every drop out of the hardware, and like those before us understood the trade-offs with dillegence.

On the reverb topic its an interesting subject, one I'm attracted to as well. knowledge says no two reverbs sound the same, or designed the same, as they all are arranged differently.

Here is a quote from Damage Control Engineering. "Strymon"

“Project BigSky” started as a journey of diligent research. We studied, reviewed and examined physical reverb units, algorithm architectures, academic papers and programming techniques from the past five decades. Within BigSky, we utilized traditional reverb elements such as feedback-delay networks, allpass-delay-filter loops, Schroeder reverb sections, multi-tapped delay-lines, as well as all-new reverb elements that we developed along the way. The goal was to find the best starting point for each reverb sound, and then elevate it into the 21st century.
« Last Edit: December 15, 2018, 06:18:32 pm by diyaudio »
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Re: Audio Reverb with Cortex M4
« Reply #8 on: December 15, 2018, 07:19:11 am »
Quote
You can do excellent sounding reverb with F4-F7 and it has been done by several people.

It all boils down to what kind of compromises you're willing to make such as choice of algorithms, tolerance for short RT60, metallic/resonant artifacts, etc, etc. Tuning and fine adjust reverbs to sound great is definitely an art, and
folks who do this spends lots of time to get it just right. Quality sounding reverbs is by ear not by math skills.

One example of low computational OK sounding reverbs (quality is relative) is Clouds and Elements modules whos reverb part is about 5.5-6% of available CPU on a F4 168MHz 32-64k RAM. You can also experiment up your reverb using PD and listen how it turns out before start coding.
https://puredata.info/



Really appreciate your help.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline MT

  • Super Contributor
  • ***
  • Posts: 1676
  • Country: aq
Re: Audio Reverb with Cortex M4
« Reply #9 on: December 15, 2018, 06:53:30 pm »
You can also study FV1 reverb chip, a peculiar short form 24bit floating point cpu i vaguely recall, but there is lots of interesting material for it , they have algo dev forum, also ask people at KVR forum dsp dev section , and guitar effects DIY forum about reverb algos lots of material at both sites to learn from.
https://www.kvraudio.com/forum/viewforum.php?f=33
http://www.spinsemi.com/products.html
http://www.spinsemi.com/programs.php
https://www.diystompboxes.com/smfforum/index.php
« Last Edit: December 15, 2018, 07:01:09 pm by MT »
 
The following users thanked this post: oPossum

Offline nick_d

  • Regular Contributor
  • *
  • Posts: 120
Re: Audio Reverb with Cortex M4
« Reply #10 on: December 18, 2018, 06:04:46 am »
A reverb is a digital filter, nothing more or less. So if you understand digital filters you can create a reverb. One obvious way to start is to go to somewhere echoey and record its impulse response (try to create a very short fast audio pulse and record all the echoes). Convolving an input signal with this impulse response gives you reverb, in theory.

The part that can be tricky is that reverb has a very very long impulse response, on the order of seconds or at least tenths of seconds. Say it is 44100 samples/sec audio and your reverb is 0.2s long, then you need to do 8820 multiply-and-accumulate operations to produce a single output sample, with a naive FIR filter code. This isn't doable on an STM32.

Luckily, IIR filters are much more efficient than FIR filters. As a simple example, suppose you want exactly one echo to come 0.1s after the main sound, and its volume should be 50%. You need a 4410 sample circular buffer to generate the 0.1s delay. The trick then is to fold the echoes into the undelayed signal before storing a sample in the buffer. This gives you an exponential decay of echoes: 50% volume after 0.1s delay, 25% volume after 0.2s, 12.5% after 0.3s and so on. It never fully dies out (subject to your arithmetic precision anyway) hence the term, infinite impulse response.

While this simple approach is computationally efficient (one multiply-and-add plus a RAM read and write per cycle), the problem is that the echoes are not random enough, so it does not sound good. Just "WOWOWOWoWoWowowowo".
What you need is a combination of the approaches.

You could do an impulse response of say 4410 samples with the feedback also, to make it infinite. This is much better, because it acts as 4410 equally spaced taps on a 0.1s delay line, and due to the feedback each tap creates an echo with a different repeating period. By setting most of the taps to zero (for computational efficiency) and putting random numbers <1 in various prime-numbered positions it will sound nice and random. This would be the first attempt.

A problem with this is the taps all feed each other causing confusion. So an improvement might be to have several separate delay lines of different lengths, setting the nonzero taps in them more sparsely, to create the impression of various different echo trains from different room features.

cheers, Nick
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Audio Reverb with Cortex M4
« Reply #11 on: December 18, 2018, 04:32:57 pm »
Quote
Use prime numbers only.
What do you mean?

To avoid ringing use only prime numbers for the delays.
You need more building blocks then delay : allpass filter to make the delay smooth.
for input and output or feedback you need filters, highpass and lowpass,
i would not recomment IIR filter since you can not gate any noises, use FIR.

It seems they also use comb filters,
i wanto make a reverb also, i am no expert,
i can not tell the difference between a comb filter or allpass, exept that comb filter can have feedback somehow.

I have some 19 inch reverb modules, i like to sell when i make my own reverb.

One thing i know : you need external RAM hooked up for sure.
I am specially intrested in designs with multiple MCUs connected together to get a fat sound, all with different analog filtering.
« Last Edit: December 18, 2018, 04:37:39 pm by Jan Audio »
 
The following users thanked this post: ali_asadzadeh

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1952
  • Country: ca
Re: Audio Reverb with Cortex M4
« Reply #12 on: December 18, 2018, 06:28:07 pm »
Quote
To avoid ringing use only prime numbers for the delays.
You need more building blocks then delay : allpass filter to make the delay smooth.
for input and output or feedback you need filters, highpass and lowpass,
i would not recomment IIR filter since you can not gate any noises, use FIR.

It seems they also use comb filters,
i wanto make a reverb also, i am no expert,
i can not tell the difference between a comb filter or allpass, exept that comb filter can have feedback somehow.

I have some 19 inch reverb modules, i like to sell when i make my own reverb.

One thing i know : you need external RAM hooked up for sure.
I am specially intrested in designs with multiple MCUs connected together to get a fat sound, all with different analog filtering.

Thanks, have you done something yet?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Audio Reverb with Cortex M4
« Reply #13 on: December 19, 2018, 02:09:33 pm »
No i wish, still busy with building synthesizers.

By the way : for integer math use FIR filters.
I bet you use floating point in ARM, it dont matters you should de-normal, well at least on PC,
i am no expert enough, just telling what i know, please notify me if im wrong.
« Last Edit: December 19, 2018, 02:13:42 pm by Jan Audio »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf