notnum — Donne un numéro de note à partir d'un évènement MIDI.
Donne la valeur de l'octet MIDI (0 - 127) représentant le numéro de note de l'évènement courant.
Voici un exemple de l'opcode notnum. Il utilise le fichier notnum.csd.
Exemple 316. Exemple de l'opcode notnum.
Voir les sections Audio en Temps Réel et Options de la Ligne de Commande pour plus d'information sur l'utilisation des options de la ligne de commande.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages MIDI in -odac -iadc -d -M0 ;;;RT audio I/O with MIDI in ; For Non-realtime ouput leave only the line below: ; -o notnum.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1. instr 1 i1 notnum print i1 endin </CsInstruments> <CsScore> ; Play Instrument #1 for 12 seconds. i 1 0 12 e </CsScore> </CsoundSynthesizer>
Voici un exemple de l'opcode notnum utilisé pour produire une sortie audio sortie. Il utilise le fichier
notnum_complex.csd
Exemple 317. Exemple complexe de l'opcode notnum.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages MIDI in -odac -iadc -d -M0 ;;;RT audio I/O with MIDI in </CsOptions> <CsInstruments> sr = 44100 ksmps = 10 nchnls = 2 ; Set MIDI channel 1 to play instr 1. massign 1, 1 instr 1 ; Returns MIDI note number - an integer in range (0-127) iNum notnum ; Convert MIDI note number to Hz iHz = (440.0*exp(log(2.0)*((iNum)-69.0)/12.0)) ; Generate audio by indexing a table; fixed amplitude. aosc oscil 10000, iHz, 1 ; Since there is no enveloping, there will be clicks. outs aosc, aosc endin </CsInstruments> <CsScore> ; Generate a Sine-wave to be indexed at audio rate ; by the oscil opcode. f1 0 16384 10 1 ; Keep the score "open" for 1 hour so that MIDI ; notes can allocate new note events, arbitrarily. f0 3600 e </CsScore> </CsoundSynthesizer>