RobinSchmidt / RS-MET

Codebase for RS-MET products (Robin Schmidt's Music Engineering Tools)
Other
56 stars 6 forks source link

EQ and Delay effects are "exploding", no idea how to debug #176

Closed elanhickler closed 6 years ago

elanhickler commented 6 years ago

Hey Robin, the EQ and Delay effects I added explode when in use. Using an EQ curve other than flat or a delay feedback other than 0 quickly has the effect going to infinite amplitude. Is there something I could have done wrong? Unfortunately I've made a handful of changes to my fork of RS-MET so you can't debug with your base RS-MET. If you learned to use branches you could temporarily use my branch.................................................... but maybe you can tell me how to debug or what I did wrong.

elanhickler commented 6 years ago

ok, this is a highly specific example....................... there's many more cases where it would be desirable to have very long phase-locked crossfades... unless you're creating a sampler/synth hybrid or wavetable synth I guess.....

RobinSchmidt commented 6 years ago

i actually consider the idea of using samples for the transient and some kind of synthesis for the steady state part (under which i would subsume the single-cycle loop) as a very powerful concept for acoustic instrument synthesis. it was introduced back then by roland due to the memory limitations of samplers and romplers at that time:

https://en.wikipedia.org/wiki/Linear_Arithmetic_synthesis

but i think, the idea should not be discarded just because we have much more memory now

elanhickler commented 6 years ago

OrangeTreeSamples would love to make a synth-assisted sample library, but the sound would have to be nearly as good as samples and offer advantages. I'd need to hear an example.

RobinSchmidt commented 6 years ago

"Roland added a suite of sampled attack transients to subtractive synthesis. As well as the attack transients, Roland added a suite of single-cycle sampled waveforms that could be continuously looped"

instead of having the transient and single-cycle samples separate, i would just jump into a single cycle loop somewhere inside the instrument sample, when it has reached a steady state. otherwise, the technique would be very similar

RobinSchmidt commented 6 years ago

would one ore more of your sample-library producers be interested in algorithms to separate harmonic/inharmonic/noisy/transient content in one-shot instrument samples? i have some old matlab prototype code for that which was actually quite promising (for single note, more-or-less tonal content). maybe, if i port that to c++, you could create some reaper-functions from that with which you could quickly generate some money by using this for your sample-library-producer clients

elanhickler commented 6 years ago

yes, I need that for phaselocking and noise reduction. I'll get back to you on that.

RobinSchmidt commented 6 years ago

damn - i currently can't find the code, but the high level algorithm for separating the harmonic content goes like this: -split signal into (approximate) cycles (using (lowpass) zero crossings, only sample-accurate) -on each cycle, do a FFT (arbitrary size FFT, not restricted to powers of 2) -from this FFT data, obtain frequency and amplitude envelopes for an oscillator bank -(bidirectionally) lowpass these envelopes at something like 20 Hz -resynthesize the signal with an oscillator bank with the lowpassed freq- and amp data ->this is the harmonic content, subtracting it from original will give inharmonic/noise/transient

RobinSchmidt commented 6 years ago

inharmonic tonal content would then be separated by linear prediction (if i remember correctly) - and the rest would be excitation/noise and transient which would be separated by simple cutting in the time domain

elanhickler commented 6 years ago

Radar is ready for release, just need the exploding EQ and Delay thing solved.

elanhickler commented 6 years ago

There is some strange things happening with EQ and Delay. I figured the feedback problem might have to do with the modulation system. Removing the mod and meta pointers from EQ and Delay means there's no more feedback, but now when those effects are not bypassed, the GUI freezes. And also there's no sound.

I bet the problem has something to do with the modulation base class

elanhickler commented 6 years ago

Also, if you modulate the EQ frequency, the plugin becomes somewhat unusable. Try it πŸ˜ΈπŸ‘

RobinSchmidt commented 6 years ago

yes, the eq was the first module in which i dared to try to use the modulation system on dynamically created parameters. it's somewhat new ground and probably not yet ready for production

RobinSchmidt commented 6 years ago

there are also issues with modulation when you need to plot a frequency response. so far (without modulation and/or automation), it was no problem to use the same equalizer object to do the actual dsp for the audio-part and to evaluate the frequency response for the gui. when the eq is modulated, that doesn't work anymore. i'll probably need a 2nd eq object just for evaluating the frequency response...

elanhickler commented 6 years ago

it's not the end of the world if EQ is not modulatable for release.

elanhickler commented 6 years ago

...so if you could just make the EQ and delay work... with or without modulation (although it would be disappointing to remove modulation for the delay), that would be very appreciated!

RobinSchmidt commented 6 years ago

i'll look into that tomorrow

RobinSchmidt commented 6 years ago

i have made the pingpongecho available in toolchain and it seems to work there with modulation (i tested only modulating delaytime, though) and removed the modulation and automation features from the eq per-band parameters. it seems to work fine in toolchain as well. if you still get crashes, i may have to try to debug in your codebase

elanhickler commented 6 years ago

there's no more crashes since your fix a few days ago, just explosions

RobinSchmidt commented 6 years ago

yes , ok - i mean explosions. i don't get these in toolchain either

RobinSchmidt commented 6 years ago

soo...is your codebase ready for me to debug with?

elanhickler commented 6 years ago

wait....... fixing build errors.

elanhickler commented 6 years ago

yeah, omg the delay is so weird. It's as if......... feedback control doesn't work or something.

and the gui freezes for enabling delay wtfffffffff is going on!!!!!!!!

delay code is in aptly named:

Soundemote\Shared\se_framework\ElanSynthLib\SynthesizerComponents\filter\Equalizer.h Soundemote\Shared\se_framework\ElanSynthLib\SynthesizerComponents\filter\Equalizer.cpp

RobinSchmidt commented 6 years ago

JerobeamRadarModule::processBlock:

double left = 0, right = 0;
for (int n = 0; n < numSamples; n++)
{
   if (!isSilent)
     jbRadarCore.processSampleFrame(&left, &right);
}   

should be:

for (int n = 0; n < numSamples; n++)
{
   double left = 0, right = 0;
   if (!isSilent)
     jbRadarCore.processSampleFrame(&left, &right);
}   

otherwise, when the radar goes silent within the loop, you call the eq with the same values again and again (whatever values it produced last before it went silent)....although these values should presumably be zero, right? hmm..however - that seems to fix the eq problem

RobinSchmidt commented 6 years ago

the blowup was probably due to feeding DC into the eq...soo it probably did not really blow up exponentially but maybe accumulated incoming DC or something? (although that should really happen only in lowpass filters)

RobinSchmidt commented 6 years ago

it also seems to solve the delay's sizzle which it previously produced. i didn't actually see it blow up, though. no idea why the feedback slider has no effect. where's the code where you connect the parameter with the callback and/or the slider with the parameter?

elanhickler commented 6 years ago

omg everything works!!!!!! TIME TO RELEASE RADAR!!! well.. start the process of releasing.

can't believe I made this mistake. 😞

well I can believe it, but... I guess I won't make the same mistake again!

RobinSchmidt commented 6 years ago

the delay output seems strongly attenuated

elanhickler commented 6 years ago

wat u mean? seems good to me. (change filter settings maybe?)

RobinSchmidt commented 6 years ago

oh - yes - it was the filter. ...changing the delaytime makes a funny noise, though

elanhickler commented 6 years ago

yeah, because it needs smoothing. Need to connect it to my global smoothing time.

wouldn't it be frikkin awesome to make toolchain a module that you can insert... for example, in the delay? so you could put EQ / filter / whatever you want in the delay feedback path instead of having the given built in lowpass highpass... while that would be awesome, actually draggable components is more needed to reorganize effects... or can you think of a more simple way to reorganize effects? i had a crazy idea to use a text editor somehow..... buuut... ehhh.

RobinSchmidt commented 6 years ago

you mean, to plug a whole toolchain into the feedback path of a a delayline? i guess, such things are so close to an actual modular system (like reaktor) that it would make more sense to do such things liberty. in echolab, however, you have a full equalizer in the feedback path (as well as the input path). not sure what other modules i would want to put there, maybe waveshapers? ...hmm...or maybe something like chorus could be interesting as well - would probably more and more diffuse the echoes maybe going a bit into the direction of reverb?

elanhickler commented 6 years ago

f**k it, ill just make the FX section a liberty instance πŸ˜€ πŸ˜†

elanhickler commented 6 years ago

or even a ... button to "turn to the back" and the back of the synth is a liberty instance.

RobinSchmidt commented 6 years ago

sounds more like liberty itself needs "turn-to-front" button (i.e. let the user create a gui, as in reaktor)

elanhickler commented 6 years ago

nooooooooooooooo

robin PLEASE! Do not follow any program that exists right now, they all suck, they all do it wrong IMO, and you are on the verge of doing it right.

edit: Well, you could have a "turn-to-front" feature, just don't let that stop you from doing the editor/back mode better than the competition.

RobinSchmidt commented 6 years ago

i was not actually being serious. i'm quite happy with the current gui concept.

elanhickler commented 6 years ago

... πŸ˜’

elanhickler commented 6 years ago

resolved!