SynthMaker

try to implement a compressor

Archive · 2005 8 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

pdelrieu ·

Hi, I try to implement a compressor which is a basic effect in theory but I can't find any way to manage : * attack and release time. How to trigger an event after a number of sample (attack or release delay). * how to do float comparaison. if (|input| > threshold) do something. * how to calculate |A| (nearly same as above.

Does any body has an idea.

Regards

Philippe

galaa ·

I've been thinking about this as well. You can use the 'Float Less' component which would enable you to compare the input with a threshold setting and as soon as the threshold was lower than the input the component would output a boolean true. You would then trigger your envelope to start compression. However, at the moment there is no way of triggering an envelope; they are started automatically with a MIDI on signal. I think malc & jorge are working on this though so shouldn't be too long.

If anyone knows a way round this feel free to correct me

rl ·

you could provide your own envelope, e.g. by using the code component. Have a

monoin trigger;

input, and if trigger > 0 start your envelope processing

to implement abs(x):

float x; float absx;

absx = ( x >= 0 ) & x + ( x < 0 ) & (-1 * x);

galaa ·

After playing around with envelopes I've found something that might help. I'll try and explain it best I can. If you set up an amplitude envelope but have it so you can turn it off with a switch. So when the EG is off you multiply the signal by 1 using a selector. Hold down a note with the EG off then switch the EG on and it triggers the envelope. If all the envelopes are triggered by note-on only then it should already have been started when the key is pressed.

If there's a way of 'flicking a switch' with the result of the input/threshold comparison then you have yourself a compression envelope

-Edit- Though I'd stick a picture in just to make it clearer

pdelrieu ·

Thanks for your help. I get deaper in the online documentation and I found the syntax and function available in the code component. I didn't see the conditional syntaxe.

For the envelop I will try, I thought about It but without the code possibility I didn't see how.

When I will have something working I will post it.

regards Philippe

Shifrin ·

I'd guess you could implement a simple envelope follower in the code component, check out http://www.musicdsp.org for some useful code. Once you've got that you can use it to trigger the AD for the compression, hmm, interesting I might have a look at this if I get the time to see if I can do it. If it's not doable (for whatever reason) I'm sure we'll have the necessary tools to do it soon!

Shif.

pdelrieu ·

I made some test for simple compression algo : out = gain*in in compression mode and out= in out of compression mode. I develop the following code : monoin in; monoin thresh; monoin gain; monoout out;

float absx;

absx = ( in >= 0 ) & in + ( in < 0 ) & (-1 * in);

out = (absx>thresh) & gain + (absx <=thresh) & 1.0;

It made a lot of distorsion i think because the switch between compression mode and not is too strict.

I try to develop a simple envelop to trigger the gain or cut the gain after a number of sample. The code is : polyin feedback; polyin nbsample; polyin start; polyout out;

float attack; float remove;

remove =(feedback >=1.0) & feedback + (feedback >=0.0) & feedback; feedback = feedback + (start >0) & (-remove);

attack = 1/nbsample;

out = feedback+attack; out = (out>=1) & 1 + (out<1) & out;

I connect the out to the in feedback but with graph analyser I can't see anything. the feedback is always 0. It is allowed to connect a code module out to the in of the same module ?

I looked for information about compressor and it's more complexe than I thought. The gain depend on the enveloppe of the signal which is calculated using a window of sample. There is no way to have an array of sample ?

regards

Philippe

jorge ·

Hi pdelrieu

pdelrieu wrote: It is allowed to connect a code module out to the in of the same module ?

Yeah, that should be no problem due to the 1-sample-at-a-time sound engine of synthmaker.

pdelrieu wrote: There is no way to have an array of sample ?

Not yet, stefancrs has been asking for both loops and arrays. Loops is already done so we're getting there.

We got your email with a crash report, thanks.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.