Hi Walker, It's a shame no-one with actual experience with the opcode has responded (:-/) but I had some spare time, so I played a bit. All I can say is that 'compress' is one peculiar beast. As increasing the control signal decreases the amplitude of the controlled audio, I would naturally expect a *zero* control to give *maximum* output. On the contrary, a zero control *suppresses* the output! In fact, any DC control value kills the output, and the AC has to be above a certain (small) level to be noticed. (As you found.) I have actually just found that giving the threshold parameter of compress a *large* negative value -- I tried '-10000' -- prevents killing the signal even with zero noise. Not sure about the 'pops'. May depend on the sources/ I used 'mandpluk.aiff for the impulse, and a handy sustained-chord test file I had around for the other. Hope that's some use... -- Pete -- On Tue, May 12, 2020 at 10:58:34AM -0700, walker wrote: > Hey everybody, > > Hope you are all well. Anyways, I am trying to do some side chain > compression on audio files(this problem does not seem to exist with oscil > instruments, if I remember correctly). > > In this example/issue, I have 2 instruments here. instr 1 is the signal > that is to be compressed/sidechained/dipped, a pad or reverb-y/suspended > sample works nicely. instr 2 is the control signal, generally something > shorter like a kick or snare sample. I have routed both of these to global > signals which are the input to 'bus' instrument tracks, instr 20. For this > demo/test the control signal never reaches the DAC, it is just in place to > manipulate the compressed signal. > > Using just two of the diskin2 opcodes to read and play the audio file data, > there are a few issues. > - when the control signal is not producing noise(end of event or audio > file), the compressed signal drops out > - there are some clear discontinuities and pops when this happens > > Hack-y remedy: > Uncomment instr 3, a signal of very quiet white noise. This prevents the > drop outs and discontinuities from happening. To me, this makes the > compress opcode behave like compressors and compressor plug-ins I have used > outside of Csound... The audio results sounds good to me, but it just feels > weird/unnecessary to use noise as the signal stabilizer though... Is there > some kind of zero generating opcode? I have searched, but haven't found > anything... > > Noise amplitude issue: > You will see that in the below code, there are two lines for noise > generation. When the amplitude of noise is 0.0001, my hack works. When the > amplitude is decreased to 0.00001, the discontinuities and pops return. > This is not a major issue, but I don't quite understand.... > > > This code demonstrates should work so long as you supply file paths for > instr's 1 and 2. > > > > > ; Select audio/midi flags here according to platform > -odac ;-iadc ;;;RT audio out and in > ; For Non-realtime ouput leave only the line below: > > > > sr = 44100 > ksmps = 441 > nchnls = 2 > 0dbfs = 1 > > ga_compressed_sig init 0 > ga_control_sig init 0 > > > ; signal to be sidechained/dipped > instr 1 > Sfilename = PAD_OR_LONG_SAMPLE_FILEPATH > ichnls = filenchnls(Sfilename) > ktrans linseg 1, p3,1 > if (ichnls == 1) then > asigL diskin2 Sfilename, ktrans > asigR = asigL > elseif (ichnls == 2) then > asigL, asigR diskin2 Sfilename, ktrans > else > asigL = 0 > asigR = 0 > endif > > ga_compressed_sig += asigL > endin > > ; signal controlling/doing the chaining/dipping > instr 2 > Sfilename = SNARE_OR_SHORT_SAMPLE_FILEPATH > ichnls = filenchnls(Sfilename) > ktrans linseg 1, p3,1 > if (ichnls == 1) then > asigL diskin2 Sfilename, ktrans > asigR = asigL > elseif (ichnls == 2) then > asigL, asigR diskin2 Sfilename, ktrans > else > asigL = 0 > asigR = 0 > endif > > ga_control_sig += asigL > endin > > ;; add noise to control signal to prevent pops, seems hacky tho > ; instr 3 > ; asig noise 0.0001, 0 > ;; asig noise 0.00001, 0 ;discontinuities return > > ; ga_control_sig += asig > ; endin > > instr 20 > > acomp compress ga_compressed_sig, (ga_control_sig / 2), -10, 40, > 60, 300, 0.005, 0.01, 0.0 > outs acomp, acomp > > ga_compressed_sig = 0 > ga_control_sig = 0 > endin > > > > > > i20 0 7 > > i1 0 7 > > i2 0 1 > i2 + 1 > i2 + 1 > i2 + 1 > i2 + 1 > i2 + 1 > i2 + 1 > > i3 0 7 > > e > > > > > > -- > Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here