Page 1 of 1

Non-linear parameter value mapping request

Posted: 26 Jan 2019 17:07
by Ortseam
Hello! First of all I'd like to thank the developer for this brilliant piece of software. There are few VSTi-s out there which are truly modular. And only few of them sound really good (e.g. MUX modular has perfect routing and regrettably poor sound). With KarmaFX I'm really impressed with the sound crispness and clarity.

The only thing that I'm badly missing now is the possibility to set up a non-linear relationship between two parameters (e.g. note velocity and filter cutoff). It would be so nice to have a kind of "free mapper" which could be inserted in the middle of any yellow wire connection. That could give the user an opportunity to draw an arbitrary graph representing output/input function and set any desired parameter relationship.

At my opinion it could be some kind of "free curve shaper module" that would have one yellow wire input, one yellow wire output and some graph editor inside (possibly similar to the one in additive or envelope module).

This also could be done by adding one new mode to existing distortion module. By the way such module would be very useful at blue (audio) wiring also. For example, there's no possibility to make a rectifier now. With such mode you could do that easily.

Re: Non

Posted: 26 Jan 2019 17:35
by karmafx
Hi Ortseam! Thanks for your post and welcome to the forum! :D

Not bad. Thanks for the idea. If I understand you correctly, you want to be able to draw the remapping curve? I mean in the UI. Is that correct? The question is how you would like this interaction to be. I.e should it be completely free, kind of like the (flexible) Envelope module, or should it be more smooth, i.e. spline based, and perhaps controlled by one of more knobs??

It's not too difficult to imagine this for insertion between modulation modules. I also like the idea of having the same functionality available for audio (blue wires). In that case it is really a programmable waveshaper. However, it becomes more difficult there due to aliasing issues, which are not just fixable by simply oversampling.

But I agree. It would be cool to have the same functionality for both. I'll think about it.
And Thank you. I've added the feature request to my todo list. 8)

Re: Non

Posted: 26 Jan 2019 17:46
by karmafx
Just thought I should add that the drawing could also be sort of like the one in the "additive" module. That is completely free.
I think something like this split into partials would be needed to make it antialiased anyway.

Re: Non

Posted: 26 Jan 2019 18:53
by Ortseam
Thank you so much for fast reply!

Yes the question of what drawing process should be like is important. On the one hand it would be nice to simply draw any curve you like. On the other hand the possibility of making exact geometry is also needed (e.g, two straight lines going from [0;0] point are necessary for precise rectification). Maybe there could be 2 modes: spline and free draw (like in Photoshop Curves filter). Or maybe some integrated one. E.g. LMB click on curve to add new point, ctrl+LMB+drag on curve segment to change the curvature, alt+LMB+drag to add a series of freely positioned new points. Plus some global adjustments for selected points (like "make a spline", straighten, mirror, set to 0, etc.).

Sorry for my unlimited imagination. I understand that it's more easy to say than to do :)

As to aliasing, it's really an issue. Angled curve will produce extrawide spectrum. Good oversamping will be needed. Think it will be necessary to use pre and post process LP filters of high order (8-16 i think) at 4-8x sampling frequency to reduce the aliasing nice.

BTW I've tested the HQ mode of your distortion module and found the aliasing suppressed not so hard. Maybe for soft curves it's enough. But for more sharp ones the algorithm should be stronger maybe.

Re: Non

Posted: 26 Jan 2019 19:00
by Ortseam
Think with nice oversampling algorithm there will not be need to spline the curve necessarily. The first LP filter at oversampled processing algorithm will do the same thing.

Re: Non

Posted: 26 Jan 2019 19:06
by karmafx
ok. So how do you imagine the editing?
Should the curve be edited via control points (like envelope) or free drawing (like additive)?

I could add a HQ option for oversampled output, with a built-in LP filter. But I still imagine aliasing would be a real pain for audio input. :lol:

Re: Non-linear parameter value mapping request

Posted: 26 Jan 2019 19:25
by Ortseam
If I should choose only one of two, I'd have chosen control points (like envelope). Honestly I can hardly imagine what need should make free drawing necessary :)

As to aliasing... Yes. It's a global digital processing pain... I guess, good understanding of this point upon your work on KarmaFX was not the least thing that resulted in so nice sound. So I believe you unreservedly in everything regarding this question. If you think curve splining is must-do, then it should be done. The only thing - maybe it could be done "covertly" - not affecting the graph and confusing the user who draws beautiful straight lines :)

Re: Non-linear parameter value mapping request

Posted: 27 Jan 2019 13:53
by karmafx
Ok! Great! Thanks. Only One or Two points should make it easier I guess. I’ll have to thing about if splines would be better. :)

So just out of curiousity...Which modules do you have in mind for using as input to such a module? Modulation signals specifically. You mentioned note velocity, so I’m imagining the miditrig module in order to control cutoff based on velocity? (If I understood you correctly) What else?

Re: Non-linear parameter value mapping request

Posted: 27 Jan 2019 16:33
by Ortseam
Yes, you understood me correctly.

The variety of modulation signals that may need nonlinear mapping is almost countless of course and I can't forsee all specific cases. But I'll try :)

So about the sources...

1. External sources: velocity|key number|controller value|pitchbend value|aftertouch value.
These sources are got from MidiTrig and MidiData modules and should drive any parameter permitted for such data to be modulated by. Most common examples are Amplifier Gain, Filter Cutoff/Res, OSC detune, FM amount, Portamento time, Attack/Release time. But any other target parameter is also possible.

2. Internal sources: ADSR|Envelope|LFO|EnvFollower(!!). It may seem that desired results may be achieved by existing means but... Let's imagine the simple situation. I have two OSC's connected to two Amplifier modules, the outputs of which are summed. Imagine I'd like this circuit to react on ADSR module level in a next way: At max level (Attack) the only OSC1 is sounding. At 50% level of ADSR output (Sustain) OSC1+OSC2 sum is sounding. From 25% to 0% (the last part of release tail) the only OSC2 is sounding. Seems it would be impossible to set up such behaviour without nonlin mapping. Even if it could be done with 2 ADSR's, the fast and intuitive setting them up would be a pain.
*The task I described is a bit artificial. It's just a straightforward example of layering, which in practice may include more then two layers and need more precise level balance.

As to EnvFollower. I found this module wonderful for making audio controlled patches. But to make sound behaviour "natural" some nonlinear function is desirable. In case when audio level controls multiple parameters (as in my try to make a "flute" driven by keyboard players "shhhh" whispering to mike) this function is absolutely necessary. Cause, as practice shows, sometimes the functions must be whimsically curved to produce a natural sound.

As to destinations...

It's hard for me to imagine the parameters NOT useful for mapped modulation. Combo filter feedback, distortion amount, mixer pan (driven in some special way from saw LFO) - everything will have a great creative potential with mapping function.

BTW. If the task of creating the fully functional module it's too complicated, the mapping functionality could maybe be added to yellow wire arrow (which now has only the function of setting up the linear coefficient from -64 to 64).

Re: Non-linear parameter value mapping request

Posted: 27 Jan 2019 17:50
by Ortseam
And one more consideration on universal nonlinear audio/modulation module. (Sorry for my saga-size posts, but I try to be exact and complete).

As I think, KarmsFX has a great potential not only as modular synthesizer but as modular SFX plugin also. It's set of "elementary bricks" is enough for making such interesting things as band duckers, deessors, auto filters, modulated resonators and so on. Hi quality and well antialised graphic shaper would be a very strong addition to this stuff, as to me.

By the way 95% of graphic shapers on the market today have terrible aliasing.The only hi quality shaper of that kind, that I know a.t.m., is Image Line Waveshaper. Which also is used as a part of Image Line LovePhilter plugin from Juice Pack*. Seems something like this also was in Melda FXpack, but I don't remember it exactly.

* BTW Image Line LovePhilter is slightly similar to KarmaFX in it's modulated FX possibilities. But it's structure is not modular and the variety of different blocks is limited to filters and shapers only. So such shaper module inside KarmaFX would make it completely unique. As for me personally (as I've spent a lot of time constructing guitar amp/cab emulations from simple blocks) this feature would be MORE then useful. Also (once more for me personally) the possibility of making my own detector circuit from shaper based rectifier and LP filter would be extremely valuable**.

** If you like, I could show what may be done (a sound sample of a a flute prototype I'm working on. A.t.m. the audio part is based on KarmaFX oscillators and combo filter, but the modulation part is based on other plugins. With mapping module in audio and modulation circuits I could build it completely in KarmaFX.

UPD: here it is, my Karma Flute prototype sound:

Re: Non-linear parameter value mapping request

Posted: 29 Jan 2019 21:25
by karmafx
Hi Ortseam!

Thanks for some very detailed posts!!
I really like your explanations, and I'm actually sold on the idea of having the sort of control that you describe.
Thanks for the flute sound example. It sounds very good indeed!! I'm very impressed by the realistic blowing noise actually.

I'm not sure that aliasing is a big problem for if the mapping module is mainly used for modulation signals (which are relatively low freq), so I'm actually thinking of focusing on this functionality, if you agree.

The module could still have a hq (oversampling) option, but I'm not sure it's needed unless you use the HFO for input for example. Are you using high frequency modulation for the flute?

I'm not saying that the remapping could not also be used for audio btw, but perhaps a different module would be better suited for that (with more focus on antialiasing) ? but please let me know what you think?

Re: Non-linear parameter value mapping request

Posted: 29 Jan 2019 23:31
by Ortseam

Thank you for the feedback!

You're right. In most cases the aliasing won't be a problem if mapping module is used only for modulation "wires". Though it would be so tempting to have 'universal' HF/LF module like it could be in real analog world, I understand the difficulties and accept your point.

As to my flute... The main point why I use external stuff is a need of flexible level detector. My scheme includes the one build from three modules: BPF>rectifier>LPF, that's used for detecting the level of payers "shhh". Rectifier works with oversampling at audio frequencies here. The curve of the rectifier is V-like with symmetric and slightly curved "halves". The output level of this detector modulates Karma's amplifier gain, FM-module 'modindex' pot and NotePitch 'tune' through Karma's audio input.

The reason I'm not using Karma's env follower is that I want to have an access to the rectifier curve to setup natural and intuitive response. The shape of the second filter curve is also very important. But if I had a possibility of mapping the level received from Karma's env follower, maybe I could achieve the same result. That should be checked experimentally to be sure.

As to two different modules for HF and LF... Of course the wish of mine (as an audio engineer who dealt a lot with real analog circuits) is to have no border separating "audio" and "modulation" words. I'd like to have a single module which I could connect whether to blue or to yellow wire. The decision of whether the oversampling is necessary could be made by me at any specific case and checking "HQ" button or maybe even choosing one of several splining/oversampling modes (as it's made in numerous samplers) could give me such possibility. But once again: if it's a problem in terms of coding and (important!) if sound quality will be finally better with two different modules, then two ones is my choice.

PS: one more consideration on LF mapping module. This functionality could be organized inside Envelope module also. It could be done by adding an alternative mode to 'offset' pot. In this mode this pot could set not starting but idle envelope cursor position. Then with 'trigger' checkbox set to 'off' this module could be used as mapper with input signal sent to 'offset' pot...Dunno is it a good idea really but just in case :)

Re: Non-linear parameter value mapping request

Posted: 30 Jan 2019 07:24
by karmafx
Good points. I really appreciate your input and see what you mean.

Regarding envelope and pos. That is indeed a good point. I mean, what you are basically asking for is a method for controlling the position into a programmable envelope using an external module to remap the input. However, I'm still leaning towards a separate "Shaper" module. I think it makes more sense, and also makes it easier to add important features like HQ mode for instance. I will perhaps use the "Envelope" as a base for UI and controls though.

Excuse the ascii art, but something like this.
Pleae let me know if I'm missing some important knobs or controls.

Code: Select all

| Shaper							       |
|/-------------------------\   	-------------------------------------- |
||               	  |   	|                         .....O     | | 
|\-------------------------/   	|                 ...O.....     ..   | |
|amp offset polarity slope    	|    .............                 ..| |
|                    		| 				     | | 
| O    O       O       O   	|------------------------------------| |			       |	
| 								       | 
|X bipolar	X HQ		 				       |
EDIT: Ah, perhaps also a "curve" control, like in the Envelope module.

Re: Non-linear parameter value mapping request

Posted: 30 Jan 2019 07:46
by karmafx
PS: Sounds like you might also need a "Rectifier" module to do the flute thing? If so please let me know, and perhaps point me to what you are using? Thanks.

Re: Non-linear parameter value mapping request

Posted: 30 Jan 2019 15:34
by Ortseam
Looks almost like what I'd like it to be :) But there are some questions/notations, if you don't mind:

1. What is the sense of 'polarity' knob? What will it do?
2. Seems that 'slope' knob should be strongly revised or changed. Look at this image:
pic 1 shows typical piecewise linear mapping (that could be used e.g. for keyboard velocity response correction).
pics 2&3 show two ways of "softening" this curve (convex and concave/convex curves).
pics 4&5 show the affect of 'slope' knob. As you can see, the resulting curve is even more sharply angled and seems to hardly have any practical use.
I think it would be better to replace 'slope' knob with some spline/softening one, that could automatically "shave" the angles down.
3. On bipolar mode. The graph zero point should be moved to the center of the field as shown at pic 6. It would be nice to add vertical coordinate line at this point also.
4. Editing field proportions. I understand that module shaping is unified and that standardized graph editing field has horizontally extended shape. But it would be so nice to have it more close to square (as at pic 7). Maybe there's some possibility to make it so without overall GUI style distortion?

5. And of course thank you so much for your interest! I'll be glad to answer any other question.

PS: By the way, the last pic shows the graph of the rectifier you'd asked me of :) At my mock-up flute that was made with Image Line Fruity WaveShaper.

Re: Non-linear parameter value mapping request

Posted: 01 Feb 2019 10:56
by karmafx
Thanks so much Ortseam!

Some good points indeed.
"polarity" was just meant to be a smooth inverter knob. So basically amplify by -1 to 1.

But I agree with your comments. It might make more sense with a pre/post amplifier settings too, like the fruity one.
I'll think about the square UI thing. It could perhaps be done by making the module smaller horizontally.

Also, although I would love to reuse the envelope UI control, I think it might be needed to make special UI for this. I will have to experiment.

Re: Non-linear parameter value mapping request

Posted: 01 Feb 2019 11:16
by Ortseam
Thank you very much!
I wish you good luck and inspiration! :) Looking forward for any little result.
Feel free to ask me any question if you think it helps.

Re: Non-linear parameter value mapping request

Posted: 03 Mar 2019 11:29
by karmafx

Re: Non-linear parameter value mapping request

Posted: 25 May 2019 13:34
by karmafx
Something like this?!


I opted for using the existing ADSR style envelope editing UI (almost square like you suggested), with a Curve and Bias option.
This means the ramp can have many control points, but also means that the output might alias.
However, this is rarely the case with (non-audio-rate) modulation signals, like LFO's.
I also added a smoothing option, that lowpass filters the output post waveshaping. Amount is just dry/wet mixing.

The panel switch makes it possible to enable a mode that shows a line at the actual lookup in the shaper-display (right).
The left display shows the output for a regular sine LFO input.

Re: Non-linear parameter value mapping request

Posted: 13 Jun 2019 22:31
by Ortseam
Hi! Sorry for my slowpock reaction! There were no news from you for a long time and my checking of this topic became more rare.

I'm so glad to know you're continuing your work on Karma!

And my answer is YES! that's really what I expected to see.

P.S. As to aliasing, I think it could be a nice option to have a switchable (maybe a choice of x2/4/8/16) oversampling. The thing of a great importance here is an order and type of the LP filter used at oversampling algorithm. A love very much the ones Voxengo uses. The aliasing suppression is perfect there (check his free tubeamp If you like I could try to contact him to ask what filters he uses. Seems these ones are the same at all his oversampled plugins and the sound is really superb! And the spectrum seen at analyzer is also beautiful (the "ghosts" mirroring from 22.05 kHz line become unnoticeable below 20 kHz). The other freebie with nice antialiasing is ... It also sounds perfect on my ear. It's not as a guide for you, just as an example of what I'd dream to see ))