metro — Trigger Metronome
Generate a metronomic signal to be used in any circumstance an isochronous trigger is needed.
ktrig - output trigger signal
kfreq - frequency of trigger bangs in cps
metro is a simple opcode that outputs a sequence of isochronous bangs (that is 1 values) each 1/kfreq seconds. Trigger signals can be used in any circumstance, mainly to temporize realtime algorithmic compositional structures.
Note | |
---|---|
metro will produce a trigger signal of 1 when its phase is exactly 0 or 1. If you want to skip the initial trigger, use a very small value like 0.00000001. |
Here is an example of the metro opcode. Play metro.csd
Here is another example of the metro opcode. Play metro-2.csd
Example 585. Another example of the metro opcode.
<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 metro-2.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 instr 1 kpch random 1,20 ;produce values at k-rate ktrig metro 10 ;trigger 10 times per second kval samphold kpch, ktrig ;change value whenever ktrig = 1 asig buzz 1, 220, kval, 1;harmonics outs asig, asig endin </CsInstruments> <CsScore> f 1 0 4096 10 1 ; sine i 1 0 10 e </CsScore> </CsoundSynthesizer>
More information on this opcode in the Floss Manuals: https://flossmanual.csound.com/csound-language/control-structures