ival, ivstor (optional) -- controls initial disposition of internal save space. If ivstor is zero the internal “hold” value is set to ival ; else it retains its previous value. Defaults are 0,0 (i.e. init to zero)
Performance
kgate, xgate -- controls whether to hold the signal.
samphold performs a sample-and-hold operation on its input according to the value of gate. If gate != 0, the input samples are passed to the output; if gate = 0, the last output value is repeated. The controlling gate can be a constant, a control signal, or an audio signal.
asrcbuzz10000,440,20,1; band-limited pulse trainadifdiffasrc; emphasize the highsanewbalanceadif,asrc; but retain the poweragateresonasrc,0,440; use a lowpass of the originalasampsampholdanew,agate; to gate the new audiosigaouttoneasamp,100; smooth out the rough edges
Here is another example of the samphold opcode. It uses the file samphold.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o samphold.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1kxline-1,p3,1; between -1 and +1 ktrigmetro1; triggers 1 time per second kvalsampholdkx,ktrig; change value whenever ktrig = 1 printk2kval; will print every time kval changes asigdiskin2"flute.aiff",1+kval,0,1outsasig,asigendin</CsInstruments><CsScore>i1011e</CsScore></CsoundSynthesizer>