Sets the level at which signals from the send are added to the buss.
Note
Up to Csound 6, this opcode was called MixerSetLevel.
Plugin opcode in mixer
The actual sending of the signal to the buss is performed by the mixersend opcode.
Syntax
mixersetlevel(isend,ibuss,kgain)
MixerSetLevelisend,ibuss,kgain
Initialization
isend -- The number of the send, for example the number of the instrument sending the signal (but any integer can be used).
ibuss -- The number of the buss, for example the number of the instrument receiving the signal (but any integer can be used).
Setting the gain for a buss also creates the buss.
Performance
kgain -- The level (any real number) at which the signal from the send will be mixed onto the buss. The default is 0.
Use of the mixer requires that instruments setting gains have smaller numbers than instruments sending signals, and that instruments sending signals have smaller numbers than instruments receiving those signals. However, an instrument may have any number of sends or receives. After the final signal is received, mixerclear must be invoked to reset the busses before the next kperiod.
Examples
In the orchestra, define an instrument to control mixer levels:
instr1mixersetlevel(p4,p5,p6)endin
In the score, use that instrument to set mixer levels:
; SoundFonts; to Chorusi1001002000.9; to Reverbi1001002100.7; to Outputi1001002200.3; Kelley Harpsichord; to Chorusi10032000.30; to Reverbi10032100.9; to Outputi10032200.1; Chorus to Reverbi1002002100.5; Chorus to Outputi1002002200.5; Reverb to Outputi1002102200.2
Here is a complete example of the mixersetlevel opcode. It uses the file Mixer-modern.csd
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in-odac ; -iadc ;;;RT audio out; For Non-realtime ouput leave only the line below:; -o Mixer.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1att:k=expon(0.01,p3,1);create an attackOut:a=poscil(0.7,440)mixersetlevel(1,3,att);impose attack on the gain levelmixersend(Out,1,3,0);send to channel 0endininstr2Out:a=vco2(0.5,110);saw wavemixersetlevel(2,3,0.25);set level to .25 of vco2mixersend(Out,2,3,1);send to channel 1endininstr3;mix instr.1 and 2 with reverbgain1:k=mixergetlevel(1,3);get level form buss 3gain2:k=mixergetlevel(2,3);get level form buss 3a1=mixerreceive(3,0);receive channel 0a2=mixerreceive(3,1);receive channel 1Out:a=a1*gain1+a2*gain2;mix themoutL:a,outR:a=reverbsc(Out,Out,0.85,12000);add a nice reverbout(outL,outR)mixerclear()endin</CsInstruments><CsScore>;f1 0 4096 10 1i102i202i308;reverb stays on for 8 sec.e</CsScore></CsoundSynthesizer>
Here is a complete example of the MixerSetLevel opcode. It uses the file Mixer.csd
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in-odac ; -iadc ;;;RT audio out; For Non-realtime ouput leave only the line below:; -o Mixer.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1kattexpon0.01,p3,1;create an attackaoutposcil.7,440,1MixerSetLevel1,3,katt;impose attack on the gain levelMixerSendaout,1,3,0;send to channel 0endininstr2aoutvco2.5,110;saw waveMixerSetLevel2,3,.25;set level to .25 of vco2MixerSendaout,2,3,1;send to channel 1endininstr3;mix instr.1 and 2 with reverbkgain1MixerGetLevel1,3;get level form buss 3kgain2MixerGetLevel2,3;get level form buss 3a1MixerReceive3,0;receive channel 0a2MixerReceive3,1;receive channel 1aout=a1*kgain1+a2*kgain2;mix themaoutL,aoutRreverbscaout,aout,0.85,12000;add a nice reverboutsaoutL,aoutRMixerClearendin</CsInstruments><CsScore>f104096101i102i202i308;reverb stays on for 8 sec.e</CsScore></CsoundSynthesizer>