############ TISM TUTORIAL 3 ########## ###### A midi recorder ############## # This tutorial show how to control the sequencer # we use 13 sequences, each sequence is assigned to a midi note (starting at the note 60) # There are different mode : start mode, mute mode, loop mode, copy mode, Null mode # START MODE : when the midi key is pressed, the assigned sequence is started or stopped # MUTE MODE : when the midi key is pressed, the assigned sequence is muted or unmuted # LOOP MODE : when the midi key is pressed, it change the assigned sequence loop status. # COPY MODE : when the midi key is pressed, it replace the sequence by the previous record # NULL MODE : do nothing # the computer keyboard is used to change the mode. on French keyboard : # START MODE : w # MUTE MODE : x # LOOP MODE : c # COPY MODE : v # NULL MODE : < # More over the space bar is used to record. ###### Input / Output ################# # Alsa MIDI Input (device 1) # On Tism port 0 (All messages received will begin by 0) addinprotocol 0 alsamidiraw hw:1,0 # Computer Keyboard Input on Port 1 (messages begin with 1) # Note : The Terminal window where Tism has been lauch # must be FOCUSED to capture keyboard event addinprotocol 1 key /dev/tty printtitle test # Alsa Midi Output (device 1) # On Tism Port 0 (All messages which begin by 0 will sent) addoutprotocol 0 alsamidiraw hw:1,0 ###### Sequences ################### #temporary sequence to store record message set tmp [createseq "recseq" ] #pattern parameters seqchanout $tmp -1 seqmute $tmp 1 seqloop $tmp 1 quantize $tmp 1 32 seqrdef $tmp 1 1 seqdefaultsync $tmp 1 1 beginmarksec $tmp 0 0 endmarksec $tmp 16 0 #create 13 sequences #and its controllers for {set i 0} {$i<13} {incr i} { set tmp [createseq "seq" ]; #pattern parameters seqchanout $tmp -1; seqmute $tmp 1; seqloop $tmp 1; quantize $tmp 1 32; seqrdef $tmp 1 1; seqdefaultsync $tmp 1 1; beginmarksec $tmp 0 0; endmarksec $tmp 16 0; #set base midi note set BASENOTE 60; # start command (group 1) set a [createctrl 1 0 144 0 [ expr $BASENOTE + $i] ]; setscript1 1 $a "toggleplaysync $tmp"; # mute command (group 2) set a [createctrl 2 0 144 0 [ expr $BASENOTE + $i] ]; setscript1 2 $a "seqtogglemute $tmp"; # loop command (group 3); set a [createctrl 3 0 144 0 [ expr $BASENOTE + $i] ]; setscript1 3 $a " seqtoggleloop $tmp"; # copy command (group 4) set a [createctrl 4 0 144 0 [ expr $BASENOTE + $i] ]; setscript1 4 $a " clearseq $tmp; copyseq 0 $tmp"; } ###### Control ###################### #Mode #null mode (set second layer to group 10) #key w set a [createctrl 0 1 60] setscript1 0 $a {setcgroup2 10; printtitle "null mode"} #start mode (set second layer to group 1) #key w set a [createctrl 0 1 119] setscript1 0 $a {setcgroup2 1; printtitle "start mode"} #mute mode (set second layer to group 2) #key x set a [createctrl 0 1 120] setscript1 0 $a {setcgroup2 2; printtitle "mute mode"} #loop mode (set second layer to group 3) #key c set a [createctrl 0 1 99] setscript1 0 $a {setcgroup2 3; printtitle "loop mode"} #copy mode #key v set a [createctrl 0 1 118] setscript1 0 $a {setcgroup2 4; printtitle "copy mode"} #RECORD #key space #syncronized record with internal messages (record time = 4 beats) set a [createctrl 0 1 32] setscript1 0 $a {syncemit 1 1 80 0; syncemit 2 1 80 1 } #internal messages 80 0 and 80 1 #start recording set a [createctrl 0 80 0] setscript1 0 $a {recbegin; print "recbegin"} #stop recording set a [createctrl 0 80 1] setscript1 0 $a {recseq 0; print "recend"} ################ Default value ###### setbpm 120 # first active group : group 0 (key) setcgroup 0 # first active group : group 1 (Midi channel set to 0) setcgroup2 10