Volume Control PV_MagDiv

I was trying to use PV_MagDiv for some noisy Textures.
Where do I put an amp argument to achieve the distortion, clipping, feedback effect i would like to have and then decrease the overall volume? When i change the mul argument for inA or inB for example to 0.01 the result is very different and its also not helping too much for volume control. thanks

SynthDef(\noise, { arg out=0;
    var inA, chainA, inB, chainB, chain;
    inA = PinkNoise.ar(0.2);
    inB = Pulse.ar(100, 0, 0.2);
    chainA = FFT(LocalBuf(2048), inA);
    chainB = FFT(LocalBuf(2048), inB);
    chain = PV_MagDiv(chainA, chainB);
    Out.ar(out, 0.5 * IFFT(chain).dup);

It really depends on what you want to do:

  1. Master volume: your output signal is that IFFT(chain).dup. Multiplying it by something as you’re doing (0.5 in your example) controls your output signal’s volume.
  2. The thing with PV_MagDiv is that if inB has any quiet frequency bin, it will become loud in your processed output. This is why having a quite inA or inB doesn’t help reducing the volume: any silent frequency bin in inB will make for a loud frequency bin in the output. You might have seen the ‘zeroed’ argument that PV_MagDiv takes: you can use it to mitigate its explosive effect.
  3. There is also PV_Compander, in sc3-plugins, which will apply compression bin by bin

hey, thanks for your help.
i really enjoy some of the textures in here, especially the “filtered muddy lofi cranked up amp trough cheap mic” ones in the end (whatever this means).

so i was inspired to explore buffer moduation with fb1 and also came across PV_MagDiv in a recent thread. Also have seen SoftClipAmp in the sc3-plugins, which could do its job. Do you have any other suggestions?

There is also PV_Compander, in sc3-plugins, which will apply compression bin by bin

Oh this sounds interesting. Im still trying to install the sc3-plugins (see my other post)

i was also trying out this example:

c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");

SynthDef("help-magMul2", { arg out=0, soundBufnum=0;
    var inA, chainA, inB, chainB, chain;
    inA = LFSaw.ar([100, 150], 0, 0.2);
    inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
    chainA = FFT(LocalBuf(2048), inA);
    chainB = FFT(LocalBuf(2048), inB);
    chain = PV_MagDiv(chainA, chainB, 0.1);
    Out.ar(out,  0.0001 * IFFT(chain));
}).play(s,[\out, 0, \soundBufnum, c]);

even if i multiply with 0.0001 in the Out.ar the signal is way too loud and if i change the zeroed value to for example 0.01 the sound is losing the type of character im after and getting more polished and clear

I just played the last example you posted and it sounds very quiet on my machine. Is it quiet on yours too?
I tried also your first SynthDef(\noise) with 0.0001, and it’s true that it doesn’t get that softer. It gets softer with 0.00001, but it also loses it’s scratchy quality.
So, two things here:

  1. You are generating a signal with insane amplitude. Try to poll your IFFT ugen to see its values (just put a .poll before your .dup). I get something like:
UGen(IFFT): 0
UGen(IFFT): 6796.27
UGen(IFFT): 8671.07
UGen(IFFT): 15895.1
UGen(IFFT): 11662.9
UGen(IFFT): -3694.33
UGen(IFFT): -3050.54
UGen(IFFT): 10006.8
UGen(IFFT): 8767.2
UGen(IFFT): 5509.76

A digital signal going to your output is meant to oscillate between -1 and 1. This guy oscillates between -4000 and 16000 :slight_smile:. That’s why you need to multiply it for very very small values in order to reduce it’s volume: you need to divide it for around 10000 in order to get it to a normal range.

  1. What happens when you send to your speakers a signal that it’s outside the -1 to 1 range? It clips. This means that numbers greater than 1 will be reduced to 1 (same for -1).
    And it looks like the sound of clipping is exactly what you like :slight_smile:
    No worries, you can achieve kind of the same result with .clip()
// soft but still scratchy
// note: we need a big amp value for clip to have audible effect
{PinkNoise.ar(10000).clip * 0.1}.play

And you can use clip on every UGen, so also on your IFFT. It will make its amplitude more manageable while retaining its scratchy distorted sound. Furthermore, you also have .distort and .softclip available

  1. Bonus: try if you like to use .round() as well. It will make your signal snap between -1, 0 and 1 (it gets rounded to the nearest multiple of 1).
{PinkNoise.ar(2).round.clip * 0.1}.play

! BEWARE !: snappy sounds are not the safest, they can strain your equipment if sustained for long time.

PS. I’m loving this stuff from Michael Speers you posted