Audio Reverb with Cortex M4 - Page 1
Forum section: electronics / general

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 13, 2018, 04:51:57 pm
content: 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?

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 13, 2018, 06:30:21 pm
content: 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.htmlIt 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.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 13, 2018, 07:35:33 pm
content: Thanks for the help.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 14, 2018, 08:31:28 am
content: It seems they have removed the Code links, And I can't find them, do you have them yourself?

author: Jan Audio
author_rank: Frequent Contributor
timestamp: December 14, 2018, 05:02:55 pm
content: Use prime numbers only.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 14, 2018, 07:18:51 pm
content: QuoteWhat do you mean?

author: MT
author_rank: Super Contributor
timestamp: December 14, 2018, 09:31:45 pm
content: 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, andfolks 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/

author: diyaudio
author_rank: Frequent Contributor
timestamp: December 15, 2018, 07:07:08 am
content: Quotediscouraging 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.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 15, 2018, 07:19:11 am
content: QuoteReally appreciate your help.

author: MT
author_rank: Super Contributor
timestamp: December 15, 2018, 06:53:30 pm
content: 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=33http://www.spinsemi.com/products.htmlhttp://www.spinsemi.com/programs.phphttps://www.diystompboxes.com/smfforum/index.php

author: nick_d
author_rank: Regular Contributor
timestamp: December 18, 2018, 06:04:46 am
content: 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

author: Jan Audio
author_rank: Frequent Contributor
timestamp: December 18, 2018, 04:32:57 pm
content: Quote from: ali_asadzadeh on December 14, 2018, 07:18:51 pmTo 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.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 18, 2018, 06:28:07 pm
content: QuoteThanks, have you done something yet?

author: Jan Audio
author_rank: Frequent Contributor
timestamp: December 19, 2018, 02:09:33 pm
content: 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.