A MIDI Keyboard can be read acting as score for instrument 1. Note I have changed writeRun to change run parameter to False. This will only create csound .csd file.
# ex2C01.py # Midi Keyboard In from moduleCsound import * add(startSyn) add(startOpt) add("-+rtmidi=portmidi -Ma -odac") add(stopOpt) add(startIns) header(ksmps=32) add("massign 0, 1 ;assign all MIDI channels to instrument 1") add(""" instr 1 iCps cpsmidi ;get the frequency from the key pressed iAmp ampmidi 0dbfs * 0.3 ;get the amplitude aOut poscil iAmp, iCps ;generate a sine tone outs aOut, aOut ;write it to the output endin """) tags(2) tags(3) writeRun(__file__, False)
No comments:
Post a Comment