Freeverb with low input levels ==> noise and wierd oscillating "tone" ?

Status
Not open for further replies.

Frassil

Member
Hi!

I'm working on an audio project where i have lots of oscillators (20 pcs).
To avoid digital clipping i have to reduce the output levels of them alot. I works really nice except with freeverb :/

When the levels into the reverb gets really low some wierd "white noise ish" appear at the end, and when the reverb volume gets to 0 some ringing note gets stuck, this "note" or sound changes depending on the roomsize of the reverb.


Here is some sample code that makes the problem im trying to describe, (You got to turn up the volume alot).
The ringing thingy is really annoying :/
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveform       waveform1;      //xy=295,820
AudioEffectEnvelope      envelope1;      //xy=534,810
AudioEffectFreeverb      freeverb1;      //xy=706,775
AudioMixer4              mixer1;         //xy=863,817
AudioOutputI2S           i2s1;           //xy=1103,850
AudioConnection          patchCord1(waveform1, envelope1);
AudioConnection          patchCord2(envelope1, 0, mixer1, 1);
AudioConnection          patchCord3(envelope1, freeverb1);
AudioConnection          patchCord4(freeverb1, 0, mixer1, 0);
AudioConnection          patchCord5(mixer1, 0, i2s1, 0);
AudioConnection          patchCord6(mixer1, 0, i2s1, 1);
// GUItool: end automatically generated code

void setup() {  
  waveform1.begin(WAVEFORM_SQUARE);
  waveform1.frequency(110);  
  waveform1.amplitude(0.05);
  mixer1.gain(0, 1);
  mixer1.gain(1, 0.0);
  freeverb1.roomsize(0.35);
  envelope1.attack(0);
  envelope1.hold(0);
  envelope1.decay(0);
  envelope1.sustain(1.0);
  envelope1.release(2000);
  AudioMemory(100);
}

void loop() {
  envelope1.noteOn();  
  delay(500);
  envelope1.noteOff();  
  delay(4000);  
}
 
Hi,
Have you already tried more damping?
For the sake of speed, this library works only with 16 bits, so yes the resolution is limited. I would assume, that some clipping is a good compromise often.
Regards Christof
 
I’m following this as well...

I haven’t been able to replicate the error myself... but I was going to suggest what Christof just suggested and possibly to put a low pass filter or a band pass filter after the reverb.

I’ve been using Freeverb since it was young and it is a bit raspy ( the imperfection is why I like it) in any iteration, and benefits from band pass filtering.

My failure to replicate the error leads me to suggest double checking your input wiring for meager contact, cold solder or any other common noise introducing buggers.
 
I’m following this as well...

I haven’t been able to replicate the error myself... but I was going to suggest what Christof just suggested and possibly to put a low pass filter or a band pass filter after the reverb.

I’ve been using Freeverb since it was young and it is a bit raspy ( the imperfection is why I like it) in any iteration, and benefits from band pass filtering.

My failure to replicate the error leads me to suggest double checking your input wiring for meager contact, cold solder or any other common noise introducing buggers.
Did you try the example code i did provide? I'm 100% sure it's a software issue, as soon there is no reverb effect i have no such behaviour. Think it shouldn't matter, but are you running teensy 3.6 as well?

Same behaviour both on Audioshield and internal Dacs. Earphones with loud volume is recommended. If i have time i'll upload an audio clip tommorow that's normalized for higher volume.

To bad reverb programming is out of my league :)
 
This really intrigued me so I tried it. I used the code from the first post, but I added USB so I could record directly into Audacity and not lose any fidelity.

The tone is there. Audacity says it's about -57dB down, so I added +20dB using the slider. That was loud enough that I could play it into a Spectroid (an Android app) and see the tone was about 980Hz. At least I think it was.

I tried a few things (added damping, increased the amplitude of the sine oscillator) but nothing seemed to help. I guess you could add a filter after the freeverb to try to knock out that tone, that would be about the only suggestion I would have.
 
My best guess is this may be a numerical precision issue. I must confess, when I implemented Freeverb, I did most of the testing at default settings. Then near the end I added the 2 functions to adjust the settings, and some combinations ran into clipping or other numerical range problems. Since I'd already spent a lot more time than intended, without much idea whether anyone would really use Freeverb, as a last minute fix I set the internal numerical range very conservatively and made a mental note to someday improve it.

Looks like that day has come. Or will come... I've put this on my list of issues to fix, but with Teensy 4.0 releasing soon, I can't work on this right now.

If you want to try tinkering in the code, look for this (and remember there's 2 copies, for mono vs stereo)

Code:
                // TODO: scale numerical range depending on roomsize & damping
                input = sat16(block->data[i] * 8738, 17); // for numerical headroom

and also this near the end:

Code:
                outblock->data[i] = sat16(output * 30, 0);

The ugly truth is those constants (8738, 17, 30, 0) are just numbers I made up... doing some not-so-precise listening tests, admittedly when I was tired of working on Freeverb and kinda desperate to just wrap it up and move on to so many other things so many other people want.

As a starting point, try increasing 8738, or decrease 17 to 16 or maybe even 15. The output will get louder, maybe even start clipping. Decrease 30 if the output clips. If the sound is distorted or otherwise terrible no matter what you do with the output scaling, then you know you've definitely gone too far.

If you gain any insight about what these scaling numbers ought to be, please share here. As you can see from the comment in the code, the required scaling (probably) varies quite a lot depending on the 2 parameters, so please be sure to mention what you used for both of roomsize and damping.
 
Will absolutely share if i find some values that works better. Thanks! Can't wait to get my hands on a T4 :)
 
Been busy. Actually, no I did not try the code, I recreated the conditions in a far more complicated device I built that uses the Freeverb. This code I used has live controls for room size and dampening so it seemed to me a reasonable thing to try...seeing that adding those would have changed the example provided.

I am using a band pass filter afterwards, which is likely why I don’t hear it.

@Paul : Freeverb is kinda sorta loved by open source musicking types. I’ve been using the VST for years. I was tickled to see it ported. I’ll poke around in that source as well. ( I’d like to see a pre-delay aka early reflection control )
 
I've tried a few things to try to reduce the strange noise as described above.

Set input multiply to 0

input = sat16(block->data * 0, 16);

reverb makes no effect as expected, also no noise produced.

Set output multiply to 0

outblockR->data = sat16(outputL * 0, 0);

reverb makes no effect as expected, also no noise produced.

Leaving the input and output multiplies as before, set combdamp1, combdamp2, combfeeback all to 0:

combdamp1 = 0;
combdamp2 = 0;
combfeeback = 0;

strange noise as before, but no reverb effect. So I don't think the numbers @Paul gave above have much to do with the noise, it's more to do with the data flow through the reverb. It's picking up noise from all the sat16s?

I'm not familiar with the audio library, so can't say much more.
Definitely interested in reducing the noise, let me know if I can try some more experiements.
 
I presume this is a limit cycle phenomenon as its IIR with 16 bit intermediate results? Well I presume its IIR. 32 bit intermediate results should help if this the case.
 
Even with that fix, i'm getting some weird 'crackly' artefacts with real-world input noise.
I don't know where the crackles are coming from, but they are not audible in the clean signal but very noticeable
in the reverb output.

This is for guitar effects using a Blackaddr audio TGA Pro board with guitar (single coil) input.
Turning on the HPF in the WM8731 codec gets rid of the noise during silence but makes it worse during playing.

It may be either caused by very short impulses or DC offsets. Adding biquad bandpass filters before or after the freeverb doesn't help.

I've built a version that uses floating point math which doesn't exhibit the crackles, probably because the integer math is saturating at some points on very short impulses. It does exhibit audible hiss, but rather less than the original freeverb just from listening.

Note that the crackles and hiss are only seen on real ADC input, not on silent audio packets.

I'm not sure that using FP math is the 'right' solution though.
 
FP gives 8 more guard bits and no saturation/wraparound issues (till the final output), its the right solution
if you have hardware support for floats I think, otherwise 32 bit fixed point might be the way to go.
Something like Fix8.24 gives 24 bit precision and 42dB of headroom.
 
hi @dirkenstein, I'd be interested in trying a FP version if you are interested in/able to share, cheers, Paul
 
yes, but it will need modification to handle the fact that the floating point library uses dedicated AudioStream_F32 classes etc.

Not a big job but I will look into it.
 
? Has this issue been resolved? I am experiencing the above mentioned freeverb buzzing and crackling noises. In my design, the reverb recovery stage is after all my audio gates. I'll add more gates if that's what's needed, but it would be good to know if the arithmetic changes mentioned above are effective.
 
I did a quick F32 hack of this for my synth project, I put the modified files in https://github.com/laamaa/FreeverbFP in case someone wants to try

I just incorporated this code into my project and unfortunately it didn't work. When it's hooked up the audio stops working completely. Everything compiles and runs, but it stops the sound. When I comment out the freeverb_f32 it starts working again. Sorry for not posting code, the project I'm working on has a lot going on. I might try it on a blank sketch. I simply hooked it up in my with the F32 audio library. Is this tested in T4.1?
 
Did anyone have any success getting the floating point version above (dirkenstein) working either in Audio library form or in standalone mode?
 
hm I don't remember what I did but I'm using the freeverb all the time now and it's good... my code looks perfunctory
the reverb at the very end of the mix

freeverb.png
 
Status
Not open for further replies.
Back
Top