Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

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

  1. #1
    Junior Member
    Join Date
    Nov 2018
    Posts
    18

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

    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);  
    }

  2. #2
    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

  3. #3
    Member ETMoody3's Avatar
    Join Date
    Mar 2014
    Location
    New Ulm, Mn
    Posts
    79
    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.

  4. #4
    Hi,
    Perhaps a noise gate might be helpful.
    https://forum.pjrc.com/threads/56917...093#post210093

  5. #5
    Junior Member
    Join Date
    Nov 2018
    Posts
    18
    Quote Originally Posted by ETMoody3 View Post
    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

  6. #6
    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.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    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.

  8. #8
    Junior Member
    Join Date
    Nov 2018
    Posts
    18
    Will absolutely share if i find some values that works better. Thanks! Can't wait to get my hands on a T4

  9. #9
    Member ETMoody3's Avatar
    Join Date
    Mar 2014
    Location
    New Ulm, Mn
    Posts
    79
    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 )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •