Freeverb for teensy

Status
Not open for further replies.

Avi Harel

Active member
Dear all,
I have written the two building blocks of the freeverb algorithm
as defined in https://ccrma.stanford.edu/~jos/pasp/Freeverb.html
(I basically edited Paul's biquad filter code, as Paul himself suggests).

Installation is very easy : you should add the two lines :

#include "filter_lbcf.h"
#include "filter_ap.h"

to your Audio.h file and add the four files filter_lbcf.* and filter_ap.* to the directory where Audio.h resides

I add an implementation of freeverb
and show the topology (of course these are not objects of the gui so this is just for demonstration)
but of course other topologies are possible
as in http://www.mathworks.com/examples/matlab-dsp-system/2338-adding-reverberation-to-audio-using-freeverb-algorithm
which allows some control.

*my example requires that you have the sample audio files on the sd card
and of course that you have an sd card present...
enjoy and please share your comments
 

Attachments

  • filter_ap.h
    2.9 KB · Views: 364
  • filter_ap.cpp
    3.5 KB · Views: 350
  • filter_lbcf.h
    2.9 KB · Views: 339
  • filter_lbcf.cpp
    3.5 KB · Views: 355
  • freeverb1.ino
    5.7 KB · Views: 359
  • freeverb.JPG
    freeverb.JPG
    68.9 KB · Views: 750
Last edited:
improved example

I have improved my example to include a "wet" and "dry" mix and
I increased the number of LBCF to 16 as originally intended (8 for each channel)
and also 2 AP filters.Some samples sound good but I feel that it takes its toll on the processor
so you should play around with the parameters - amount of mix, value of g etc.
again this example uses the sd card and sample files on the site, it should be
quite easy to change the input to analog input. By the way if you are interested
in a distortion effect the LBCF alone can produce this with some setting
of its parameters (found it by accident but cannot reproduce now)
 

Attachments

  • freeverb4.ino
    8.7 KB · Views: 353
Last edited:
This looks really interesting. After seeing your first post I downloaded the files and plan to try this over the weekend. I was going to extend it to two channels, with an integer offset added to one channel as the paper you linked to suggests.

I recall that someone on the forum was waking 8 and 16-input mixer objects, which might be useful here.
 
I recall that someone on the forum was waking 8 and 16-input mixer objects, which might be useful here.

I was and i have... :), all in the gui too as well, but you'll need to be working off github

Looking forward to playing with this reverb tool, thanks Avi!!!!!
 
This is on my TODO list.

Before merging this into the library, I want to rework it with the delay code that uses the audio memory buffers. Long-term, I also want to do revisit the flange and chorus too. Allocating and passing buffers this way makes implementing the objects easier, but it makes the library API more complex.
 
In order to get the library to compile, I also had to edit utility/dspinst.h and uncomment lines 188 - 194 to provide 'pack_16x16' to the ap filter library file.

I have not been able to get the FilterAP object to work just yet. Still troubleshooting, making sure its not something on my end.
 
@Avi Harel: I've been playing around with your freeverb code (nice job!) but I've found one problem. In setup of freeverb4 you set the levels for mixer4 twice. I think the second ones should be mixer7 which mixes the wet and dry signals.

Pete
 
FYI: I've found that the pack_16b_16b function in dspinst.h does exactly the same thing as pack_16x16. In filter_ap.cpp and filter_lbcf.cpp change the occurrence of pack_16x16 to pack_16b_16b and then there's no need to modify the Audio library each time there's an update.

Pete
 
I made the library modifications and I still can't seem to get anything out of this. I tried modifying the test to use the line input but nothing seems to come out.

Also Avi Harel: The free verb all pass are supposed to be all pass delays, not all pass filters. They are basically a delay line with the input subtracted from the output. I will find you a reference. Its nice to have an all pass filter implementation also though! Love me some all pass filters, but they aren't very useful on their own, mostly useful in feedback loops.
 
I've added a Freeverb implementation. I worked with this code for a while, but it seems to suffer numerical range issues. Use of the biquad code also isn't ideal. In the end I went back to the original freeverb and created a new fixed point version as a single object which scales the data.

https://github.com/PaulStoffregen/Audio/commit/1b69ff6c1746432150cf0af213f6dec4807ebb77

It consumes about 22K of RAM and uses 9% CPU on Teensy 3.6 at 180 MHz.

Later today I'll work on the stereo version and adding the adjustable parameters and documentation....
 
Hi Paul,

I tried to new free verb effect.
It works very nicely.

Only when i use oscillators as input for the freeverb, I can hear a really light noise in the background.
Any idea how i can remove this?
 
Status
Not open for further replies.
Back
Top