preenfm Forum

PreenFM => preenfm2 and preenfm3 => Topic started by: Toltekradiation on April 23, 2021, 10:48:58 PM

Title: [available in v1.08] global fx attempt : REVERB
Post by: Toltekradiation on April 23, 2021, 10:48:58 PM
hi guys,
i lately did some code in the fx department,
it lead to something i quite like, so i thought i should share it.

First, there is a fx bus on Mix page 3, one can send each timbre to the bus with a send parameter.
Then the bus is send in a "harmonic tremolo" effect, which does soft modulation, hard to explain.
Then it goes in a comb filter, which has an envelope follower and a lfo.
These two filters can be tuned with 2 new Global pages in the Mix section.

it is quite inspired by the mighty fl-201, which do wonderful 3d things to a mix.
https://www.eventideaudio.com/products/legacy/fl-201-instant-flanger

i'm aware that it suffer from aliasing, but right now, the only cure i know for this is oversampling, which would use much more cpu and memory.

So, yes, it is what it is : a crude digital attempt for an instant phlanger, but i found it quite nice if carrefully tuned :D

for more details, here is the readme :
https://github.com/pvig/preenfm3

find the .bin as attachment : it is build over the 0.107 code.
(edit : found bug, updated .bin)
Title: Re: global fx attempt
Post by: matrix12x on April 23, 2021, 11:33:28 PM
Awesome idea! I'll try your code out later this weekend.

Can you post an audio file example?

Regarding aliasing, is it possible that some judicious use of a one pole LPF could ameliorate the aliasing?





Title: Re: global fx attempt
Post by: Toltekradiation on April 24, 2021, 11:30:28 AM
ok, here are two quick snippets :

https://www.dropbox.com/s/fzdxoqjvf0r4ml8/comb_snippet1.mp3?dl=0
https://www.dropbox.com/s/07bxiohnd05jh1o/comb_snippet2.mp3?dl=0

About aliasing, there is already some low pass filters in the feedback loop, and an hermite interpolator as well.
I fear it's not enough to get hi quality audio.
There is also different kind of artefact that are not aliasing, but glitch !

Fortunatelly, it may be good enough, depending on your needs  ;)
Title: Re: global fx attempt
Post by: Toltekradiation on April 24, 2021, 08:11:24 PM
here is another, more useful, audio file example :
https://www.dropbox.com/s/q8mh1cw088fkhkx/comb_snippet6.mp3?dl=0

in this one, focus is made on audio triggering envelope, which is the point in this effect imo.
Title: Re: global fx attempt
Post by: Xavier on April 25, 2021, 10:13:58 AM

Oh Cool. that's great you could make some progress with those global FX  :)
Thanks a lot for sharing.
I'll have a look at your code a bit later when i have more time.

Title: Re: global fx attempt
Post by: Toltekradiation on April 25, 2021, 01:52:48 PM
the code is now gone in a mutation state again :
i'm removing the feedforward path of the comb to get closer to the fl-201 design.
i did not really feel usefulness of it anyway,
so it allow to double the time of the feedback path : the comb can be more used as a delay.
Title: Re: global fx attempt
Post by: Xavier on May 01, 2021, 07:03:55 PM

Let me know when you have something ready to try  :)
Thanks
Title: Re: global fx attempt
Post by: Toltekradiation on May 02, 2021, 06:47:47 PM
Hello Xavier,
I'm still trying to get a good FL201 emulation for the preenfm3: it gets closer but it will remain an approximation anyway.
Anyway, here's the current .bin, usable for some weird chorus reverb  :D
The code is also a bit cleaner than before.
Title: Re: global fx attempt
Post by: matrix12x on May 08, 2021, 03:56:53 AM
Tried out the global FX. very cool. I am having fun with the tremolo.
Title: Re: global fx attempt
Post by: Toltekradiation on May 08, 2021, 09:12:59 PM
glad you like it !  :)
for the delay part of the fx : i'm still trying to figure out how to make it sound nice, lately i tried with some ping pong effect but with not too much satisfaction.
i  keep digging out.
Title: Re: global fx attempt
Post by: Toltekradiation on June 24, 2021, 10:22:22 PM
After many time tweaking the fl-201 attempt ...
 ... i had to make something more useful  ::)

So, with the help of the internet, i did an adaptation of the Jon Dattoro reverb algorithm!
(https://ccrma.stanford.edu/~dattorro/EffectDesignPart1.pdf)

My implementation is a bit noisy when you modulate it, but it's quite low on the cpu usage :)

So here is the .bin if one want check it out.
Title: Re: global fx attempt
Post by: Xavier on June 25, 2021, 08:55:21 AM

WOW....
That's super interesting and really a great job.
Congrats !  :)

That would be great to have that in the firmware.
Current implementation as you said is noisy even if i don't modulate the params.

Do you think there may be some saturation somewhere ?
I may have time in july to take a look at your code :)
Title: Re: global fx attempt
Post by: Toltekradiation on June 25, 2021, 06:56:36 PM
hello Xavier,
thanks for the kind word !  :D

i thought that saturation problem was fixed, i will try to make it better.
i had some troubles getting the levels right in the reverb tank loop.
To solve this issue, i use to lower the timbre volume when saturation happen, but it's not an ideal solution.

It seems i have to learn something more..
Hopefully, there is great help on the internet : there is the valleyaudio Plateau code, which use the same algorithm  :
https://github.com/ValleyAudio/ValleyRackFree/tree/v1.0/src/Plateau
It sound great ! https://valleyaudio.github.io/rack/plateau/

Title: Re: global fx attempt
Post by: matrix12x on June 26, 2021, 10:48:06 PM
Nice! I am super excited to try this out. Any warnings/suggestions re: the settings?
Title: Re: global fx attempt
Post by: matrix12x on June 27, 2021, 04:30:30 AM
Are the two Master FX in series or Parallel? and how would I control the mix between the two? I see the wet/dry option in the Mix page, but was not sure if it was both FX or just the reverb. seems like both...
Title: Re: global fx attempt
Post by: Toltekradiation on June 27, 2021, 11:40:46 AM
the previous fl-201 implementation has been melt into the new one.
there is only one left.
It remains in the envelope section though :)

i updated the readme for the knob overview :
https://github.com/pvig/preenfm3
Title: Re: global fx attempt
Post by: Toltekradiation on June 27, 2021, 04:16:11 PM
here is a version with the output level of the reverb a bit lower, as it could clip sometimes..
There is also different interpolation in this one : i could finaly find the allpass interpolation formula in the part2 of the Dattoro paper !
https://ccrma.stanford.edu/~dattorro/EffectDesignPart2.pdf

it sounds smoother when modulation is applied.

Title: Re: global fx attempt
Post by: Toltekradiation on June 28, 2021, 08:23:15 PM
@Xavier, you were right,  there were a nasty bug in one of the allpass filters which did distord in an ugly way :-[
sorry for that, i had some serious earing fatigue  ::)

fortunately, it's fixed now :
the reverbaration is much clearer and sound quite close to the vst :D
the decay is also much longer.

Title: Re: global fx attempt
Post by: Xavier on June 28, 2021, 08:38:35 PM
@Xavier, you were right,  there were a nasty bug in one of the allpass filters which did distord in an ugly way :-[
sorry for that, i had some serious earing fatigue  ::)

fortunately, it's fixed now :
the reverbaration is much clearer and sound quite close to the vst :D
the decay is also much longer.

Wow... now that sounds GOOD ! very very good !!!
That really adds something great to the preenfm3.

I really don't know how you did that, i have to look at the code !
Not sure I understand all the 12 tweakable params  ;)


Title: Re: global fx attempt
Post by: Toltekradiation on June 28, 2021, 10:24:53 PM
 :) happy to hear you like it too !

the Dattoro Reverb blocks are :

input > lp & hp > pre delay > input diffuser > reverb tank ( (allpass>delay>lp>allpass>delay) > (allpass>delay>allpass>delay) ) > output from various point in the tank


Global page 3 : Master Fx 1

    Pre delay : Time of pre delay
    Pre delay Mix : the input diffuser is fed with a mix of audio input and the pre delayed input.
    Diffusion : set the input & tank diffuser allpass coefficient
    Decay : tank feedback
    Size : size of the tank delay
    Damping : cut off of the tank lowpass

Global page 4 : Master Fx 2

    Mod Speed : lfo speed (4 of them)
    Mod Depth : lfo mod depth, modulate the 4 delay allpass in the tank
    Env Mod : envelope mod depth, make the tail pitch shifting up or down
    Threshold : audio level at which envelope trigger
    Input Tilt : input filter from lowpass ~0 to high pass ~1
    Env Feedback : feedback (decay) modulation with the envelope

the envelope release rate is relative to the decay param.

About the envelope, there is an annoying glitch while in the envelope attack phase, i will try to find a workaround for it..
Title: Re: global fx attempt
Post by: matrix12x on June 29, 2021, 05:32:10 AM
Very excited about this reverb.
Title: Re: global fx attempt
Post by: Xavier on July 08, 2021, 09:35:55 PM
Too bad i don't have time to take a deep look in the next weeks.

I would really like to include it in the firmware, but may be with less parameters, maybe one page.
Would be great also that it does not use CPU if all signals are 100% dry.
That's my plan for when i have time :)
Title: Re: global fx attempt
Post by: matrix12x on July 09, 2021, 05:09:13 AM
That would be awesome!
Title: Re: global fx attempt
Post by: Toltekradiation on July 09, 2021, 07:47:04 AM
hello,
ok, i will try my best to keep only 6 parameters.
Maybe with some kind of presets or something.
Title: Re: global fx attempt
Post by: Toltekradiation on July 12, 2021, 09:48:07 PM
Here it is !

- Most of the bugs are gone (should be)
- Auto bypass of most of the reverb code when there is no send set and the reverb tail is over (if any).

- One parameter page :
* Preset select
* Input Tilt
* Pre delay
* Pre delay Mix
* Mod Speed
* Mod Depth

For now there is still a second page to handle the preset parameters if one want to make new preset.
        * Size
        * Diffusion
        * Damping
        * Decay

The current list of preset go from extra small to extra large volumes, each in dark, warm and bright version, and then some more..
Title: Re: global fx attempt
Post by: matrix12x on July 12, 2021, 10:19:06 PM
Dude, this is amazing work!! You never fail to impress.
Title: Re: global fx attempt
Post by: Toltekradiation on July 12, 2021, 11:22:56 PM
 8) Thanks!
Title: Re: global fx attempt
Post by: matrix12x on August 18, 2021, 02:43:14 AM
@Toltekradiation I noticed on boot, if I go to the 4th screen for Global (Master fx 2) that items 5 and 6 in the list show a 214748 (instead of a text label like decay or something) with a value of 214748. However, if I turn knob 5 or 6 and cycle thru the Global pages, the text next to 5 and 6 on Master fx 2 go blank and the value shows a normal number (between -1 to +1).

I think that some variables for sets 5 and 6 in the Master fx 2 are not initialized with a zero ro something on startup. Note, it does not seem to affect the sound when its weird. The reverb sounds normal.
Title: Re: global fx attempt
Post by: Toltekradiation on August 18, 2021, 09:05:58 PM
it does not matter anymore : i added two more parameters on the Master fx 2 page  ;)

this page is not supposed to live forever anyway : it's only to allow making presets easier.

Here is another .bin with a different set of parameters for the presets, the main parameters (Master fx 1 page) now are :
Quote
Preset
        Group of parameters :
            Size
            Lfo speed
            Lfo Depth
            Decay
            Diffusion
            Notch Base
            Damping
    Pre delay
        Time of pre delay
    Pre delay Mix
        the input diffuser is fed with a mix of audio input and pre delayed input.
    Filter Base
        Input filter hp/lp
    Filter Width
    Notch Spread
        Input is filtered with a 4 pole allpass filter

I hope it's a more useful combination :)
Title: Re: global fx attempt
Post by: matrix12x on August 19, 2021, 03:16:41 AM
cool. Just installed and played with it a little and it seems to work well.
Title: Re: global fx attempt
Post by: Toltekradiation on August 19, 2021, 11:49:33 PM
it has some flaws, i fear ; the reverb saturate too easily (depending on the sound used).
i'm working on this issue, but with not much luck so far.
Title: Re: global fx attempt
Post by: matrix12x on August 20, 2021, 03:03:13 AM
I was coming across the saturation, I just dial down the sends or the instrument levels.

Maybe insert a limiter before the reverb.

Feature request: If you ever get a chance to add a pitch shifter in a feedback loop to the reverb with variable attenuation and pitch (Shimmer), that would be cool.

Title: Re: global fx attempt
Post by: Toltekradiation on August 31, 2021, 08:13:44 AM
i did improve the reverb headroom with different kind of hp&lp filters, same as made by Valley audio, i think it's ok now (attached file).
@matrix12x, sorry for the feature request, i think i will let it as it is, my attempt for shimmer effect was not very convicing.
But if you wish, don't hesitate to set a reverb preset while all parameters are there, i would add yours to the list.

Last step is to allow saving the reverb parameters in the mixer file format, but i have troubles making it work...
Title: Re: global fx attempt
Post by: Xavier on August 31, 2021, 09:52:48 PM
Thanks for the reverb work !
I'll have a look on friday (day off :) ).

Title: Re: global fx attempt
Post by: Toltekradiation on August 31, 2021, 10:57:49 PM
Thank you Xavier.

There is a problem with code structure : the FxBus class is not in the right place, there is some refactoring to be done...
Title: Re: global fx attempt
Post by: Toltekradiation on September 02, 2021, 09:58:23 PM
here is a version with complete reverb parameters, for preset design ( sorry for that, there were 3 missing parameters ) + reverb main level adjustment.
Title: Re: global fx attempt
Post by: Xavier on September 02, 2021, 10:14:51 PM

Thanks :)
Is the latest version available from your git repo ?
Title: Re: global fx attempt
Post by: Toltekradiation on September 02, 2021, 11:17:57 PM
i did not sync my repo:  it's now done :)
Title: Re: global fx attempt
Post by: Xavier on September 03, 2021, 09:52:34 PM
Thanks a lot !!
I played with the reverb today and that's really awesome to be able to have a reverb inside the preenfm3.
Congrats and thanks for the hard work  :)

I worked on your modification with the idea to integrate it in the firmware.
The branch is here, and you can have a look at the latest commit (https://github.com/Ixox/preenfm3/commit/e4dd2368f32a85fb755c74c9a9a091cfadf791c8?w=1) to see the difference with your repo.
https://github.com/Ixox/preenfm3/commits/FXGlobalFX-PVig

I hope you won't be disapointed but for the moment, i only kept the preset in the global param.
I added a volume and an output slection.
These 3 values as well as the send for each instrument are saved with the Mixer on the SD card.
Title: Re: global fx attempt
Post by: Xavier on September 04, 2021, 10:28:40 AM

I changed my mind a little.

I plan to have an option in MENU>CONFIG : "Reverb param".
If set to "All", all params will show up in the global settings.

And i will save all params with the mixer and not the preset.
Title: Re: global fx attempt
Post by: Toltekradiation on September 04, 2021, 11:48:01 AM
hello Xavier,
many thanks for the code integration :)
your additions are very useful !

But, yes, i agree that linking all reverb parameters to the mixer does make sense.

cheers !
 ;D
Title: Re: global fx attempt
Post by: Xavier on September 04, 2021, 06:20:46 PM

I had some time today and there's now an option to show all params :
  MENU>Config>Reverb params : Show or Hide.
Default value is Hide.

So out of the box, you only see the reverb preset.
But all params are available for users who wants that, after modifying the config.

My commit is here :
https://github.com/Ixox/preenfm3/commits/FXGlobalFX-PVig

Let me know if you see anything strange.

Thanks  :)

Title: Re: global fx attempt
Post by: Toltekradiation on September 04, 2021, 08:00:38 PM
The hide/show solution is a great idea but some troubles so far :
well, no luck, the reverb do not produce any sound on my pmf3, i could not spot the problem so far :P.

About the preset param, i think it may be confusing for users :
one may not understand that changing preset will change some, not all, parameters of page 2 & 3 (if in display all mode).

I would separate clearly the two modes : no preset choosing in user mode.

If you wish to go this way i can redefine the presets, with all parameters.

Title: Re: global fx attempt
Post by: Xavier on September 04, 2021, 09:48:43 PM
Yes there's a sound problem with the current version !!!  :o
What did i change at the last minute ?? Will try to find out.


When changing the preset, i apply all default values before the preset specific param.
So all params are reset if they were all changed.
Title: Re: global fx attempt
Post by: Xavier on September 04, 2021, 10:28:33 PM

I pushed a fix.
I moved where the fxBus.init() is called, it works better  :)
Title: Re: global fx attempt
Post by: Toltekradiation on September 05, 2021, 06:11:05 PM
I did a pull request with some fix for the parameter value change.

while i'm at it, i found a bug on config save : it freeze the synth on save, i could not get much information on what happening : in debug mode, the error stack is :
Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)   
   HardFault_Handler() at stm32h7xx_it.c:106 0x80351f6   
   <signal handler called>() at 0xffffffe9   
   dir_find() at ff.c:2 482 0x806719a   
   0x0   

Title: Re: global fx attempt
Post by: Xavier on September 05, 2021, 09:16:25 PM

Thanks for the PR.

The error is when you save the config ?
It works here.
Do you have a pfm3/settings.txt file on your SD ?
Can you save preset and mixers without problem ?
the dir_find in the stack is weird.


Title: Re: global fx attempt
Post by: Toltekradiation on September 05, 2021, 10:13:10 PM
yes i can save mixer, default mixer, presets without problem.
I did not have pfm3/settings.txt on the SD,
so i made an empty one to test : freeze on config save
after reading the SD card again, the settings.txt is gone ???
so i got a working setting.txt from a pfm2, put it to the SD, reboot, save the config again : freeze again, and the settings.txt disappeared..

yes, quite weird.
Title: Re: global fx attempt
Post by: Xavier on September 05, 2021, 10:27:13 PM

The settings file is removed than save again.
https://github.com/Ixox/preenfm3/blob/master/firmware/Src/filesystem/ConfigurationFile.cpp#L90

So i assume it fails when saving after having removed the file.
But i don't know why.

Title: Re: global fx attempt
Post by: Xavier on September 05, 2021, 10:28:33 PM
You can try with windows to copy your all pfm3 directory on your SD card.
Then rename the old one "pfm3.old", and the new one "pfm3".
Just to see if that's not the SD where it tries to save the file.

Or backup your SD card, format it and copy back your files.

Would be interesting to see if that makes any change.
Title: Re: global fx attempt
Post by: Toltekradiation on September 05, 2021, 11:26:20 PM
thanks for the ideas.
i tried but it did not solve the issue, even with deep formatting with the official SD formater.
I will try again tomorrow with a minimal SD card content.
Title: Re: global fx attempt
Post by: Toltekradiation on September 06, 2021, 09:11:13 PM
hmm, this problem is really weird :
i took another SD card, deep formated it, then put the official SD content (pfm3_SD.zip) on it.
With this SD, i could save every kind of files without any problem, ... but not the config  ???
if i follow the action in debug mode, it crash on line 89 in ConfigurationFile.cpp

well, i can still edit the SETTINGS.TXT by hand, so it's not such a big deal ::)
Title: Re: global fx attempt
Post by: Xavier on September 06, 2021, 10:21:33 PM
2 things i have in mind :
1. Make sure you have correctly merged Menu.h and Menu.cpp files.
2. Clean the project & Rebuild ALL so that you don't have old enum in some object file.

I'll make a firmware binary tomorrow to make sure we use the same.
Title: Re: global fx attempt
Post by: Toltekradiation on September 06, 2021, 11:45:04 PM
Thanks for the support :D
you found the problem : i have some trouble with the cleaning of my project :
with the latest v0.107 build from github, everything work perfectly.
but with my local sources, even if i clean before building (Project>Clean in STM32CubeIde), i get the issue.

I work currently on a copy of your branch FXGlobalFX-PVig, which i only slightly modified.
Maybe I have a small drift in my project configuration, i will try to find out what's wrong.

Thanks !
Title: Re: global fx attempt
Post by: Xavier on October 15, 2021, 10:38:55 PM
I built a release with the reverb : v1.08
See more details here :
https://github.com/Ixox/preenfm3/releases
Feedbacks are welcome,
Title: Re: [available in v1.08] global fx attempt : REVERB
Post by: Toltekradiation on October 16, 2021, 05:32:06 PM
Hello Xavier,
i think there is some bugs.

In the preset recall :
In my version, some values were smoothed on preset change ; that part of the code was called continuously to make it happen.
In your integration, you do call FxBus::paramChanged() once on preset change, so the smoothing code should be removed.
here is my commit about it :
https://github.com/pvig/preenfm3/commit/fa6be48fb8f49bd753005f473e1220ad24f88ff9

About the predelay time, lfo speed values,
i did some stupid code mistakes :-X, so these value change does not work anymore.
here is the commit :
https://github.com/pvig/preenfm3/commit/1ebce476547bbc72352021a21a66d388d906fc7a

While i was at it, i changed the order of some parameters in the reverb pages, i think it does more sense :
https://github.com/pvig/preenfm3/commit/bd56ea39c794f8f8ec84d0795f42096f0f69b2a6

Title: Re: [available in v1.08] global fx attempt : REVERB
Post by: Xavier on October 17, 2021, 10:03:23 AM
No problem  ;)
I'll make an other one with your bug fix.
Thanks a lot for the feedback !

Do you think you can get the latest master branch and make a pull request with your bug fix ?
If not i'll integrate myself, no problem.
Title: Re: [available in v1.08] global fx attempt : REVERB
Post by: Toltekradiation on October 17, 2021, 10:34:29 AM
ok, pull request done :)
Title: Re: [available in v1.08] global fx attempt : REVERB
Post by: Xavier on October 17, 2021, 10:47:23 AM
Haha... That was quick.
Thanks a lot  :)
Title: Re: [available in v1.08] global fx attempt : REVERB
Post by: Xavier on October 17, 2021, 11:44:15 AM
1.08a is available with those fixes.
Don't worry if you find others , this reverb is a big feature ;)