Midish command-line MIDI sequencer
Contingut
Instal.lació
Midish is an open-source MIDI sequencer/filter for Unix-like operating systems (tested on OpenBSD and Linux). Implemented as a simple command-line interpreter (like a shell) it's intended to be lightweight, fast and reliable for real-time performance.
Important features:
- real-time MIDI filtering/routing (controller mapping, keyboard splitting, ...)
- track recording, metronome
- track editing (insert, copy, delete, ...)
- progressive track quantization
- multiple MIDI devices handling
- synchronization to external audio and MIDI software/hardware
- import and export of standard MIDI files
- tempo and time-signature changes
- system exclusive messages handling
$ sudo apt-get install libreadline-dev $ cvs -d anoncvs@moule.caoua.org:/midish checkout -P midish $ cd midish $ ./configure $ make $ sudo make install
Funcionament
midish és una solució purament ALSA. El primer que hem de fer és tenir clar els dispositius MIDI que utilitzaré (lectura i escriptura), i editar el fitxer de configuració. Amb aquest fitxer de configuració midish podrà establir les connexions:
Arrenco el fluidsynth i un teclat midi, que són les eines que utilitzaré:
$ fluidsynth -a alsa -m alsa_seq /home/joan/soundfonts/Unison.sf2 $ vkeybd $ aconnect -io client 0: 'System' [type=kernel] 0 'Timer ' 1 'Announce ' client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'FLUID Synth (4753)' [type=user] 0 'Synth input port (4753:0)' client 129: 'Virtual Keyboard' [type=user] 0 'Virtual Keyboard'
Editem el fitxer /etc/midishrc:
dnew 0 "128:0" wo # attach the module (fluidsynth) as dev number 0 dnew 1 "129:0" ro # attach the keyboard (vkeybd) as dev number 1
i millor:
dnew 0 "FLUID Synth (4753)" wo # attach the module (fluidsynth) as dev number 0 dnew 1 "Virtual Keyboard" ro # attach the keyboard (vkeybd) as dev number 1
i ara ja puc arrencar el midish:
$ rmidish
nota: utilitzem rmidish en comptes de midish: both midish and rmidish do the same thing. The only difference is that rmidish has a slightly nicer interface (prompt, command completion, history); it's a simple wrapper around the midish binary using readline.
Per escoltar la cançó que ve de demo:
send EOF character (control-D) to quit [0000:00]> load "sample.sng" # load the file [0000:00]> p # start playback [0004:02]> s # stop playback
i ja puc començar a gravar:
The following session shows how to record a simple track. First, we define a filter named piano that routes any event from device 1, channel 0 (input channel of the keyboard) to device 0, channel 0 (output channel of the sound module). Then we create a new track pi1, we start recording and we save the song into a file.
send EOF character (control-D) to quit [0000:00]> fnew piano # create filter "piano" [0000:00]> fmap {any {1 0}} {any {0 0}} # dev=1,ch=0 -> dev=0,ch=5 [0000:00]> tnew pi1 # create track "pi1" [0000:00]> r # start recording [0006:02]> s # stop recording [0000:00]> save "mysong" # save the song into a file [0000:00]> # EOF (control-D) to quit
El resultat és un fitxer amb format propi de midish:
# # midish (unoffical release) # { tics_per_unit 96 tempo_factor 256 meta { timesig 4 24 tempo 500000 } songfilt piano { filt { evmap any {1 0} > any {0 0} } } songtrk pi1 { curfilt piano mute 0 track { 100 non {0 0} 72 127 4 noff {0 0} 72 0 23 non {0 0} 69 127 1 noff {0 0} 69 0 non {0 0} 70 127 3 noff {0 0} 70 0 } } curtrk pi1 curfilt piano curpos 0 curlen 0 curquant 0 curev any {0..15 0..15} metro { mask rec lo non {0 9} 68 90 hi non {0 9} 67 127 } }
Aleshores la cançó que acabem de crear la podem exportar a un fitxer MIDI (SMF):
$ export "mysong.mid"
que la podem obrir amb el Muscscore, i allà la podem modificar.
Podem donar àlias als dispositius que estem utilitzant. Aquests àlies els podem definir en la línia de comandes del rmidish, però millor fer-ho en el fitxer de configuració /etc/midishrc:
dnew 0 "128:0" wo # attach the module (fluidsynth) as dev number dnew 1 "129:0" ro # attach the keyboard (vkeybd) as dev number 1 #dnew 0 "FLUID Synth (4753)" wo # attach the module (fluidsynth) #dnew 1 "Virtual Keyboard" ro # attach the keyboard (vkeybd) as inew keyboard {1 0}; onew sinte {0 0};
i aleshores per gravar una cançó:
send EOF character (control-D) to quit [0000:00]> fnew piano # create filter "piano" [0000:00]> fmap {any keyboard} {any sinte} [0000:00]> tnew pi1 # create track "pi1" [0000:00]> r # start recording [0006:02]> s # stop recording [0000:00]> save "mysong" # save the song into a file [0000:00]> # EOF (control-D) to quit
En comptes d'utilitzar el mode r (recording), és util utilitzar el mode i (iddle, performance mode), i aleshores s'envia l'entrada a la sortida.
Filtres
Per que soni alguna cosa, com a mínim he d'enviar el que arriba a l'entrada a la sortida:
[0000:00]> fmap {any keyboard} {any sinte}
Puc fer una transposició de notes. Per ex:
[0000:00]> fmap {any keyboard} {any sinte} [0000:00]> fmap {note keyboard 1..100} {note sinte 4..103}
Puc obtenir informació dels filtres aplicats, i també puc fer un reset dels filtres aplicats:
[0000:00]> finfo { evmap any {1 0} > any {0 0} evmap note {1 0} 1..100 > note {0 0} 1..100 } [0000:00]> freset
Per fer la transposició millor així:
[0000:00]> ftransp {any sinte} 3
Time Structure
measure (compàs) is split in beats, and beat is split in ticks. La durada dels ticks està fixada pel tempo. Per defecte:
- 24 ticks per beat
- 4 beats per measure (compàs)
- 120 beats per minut
Així, per defecte una rodona són 96 beats.
Si volem anar al compàs 3 farem:
g 3
metrònom
Té tres modes: off (deshabilitat), on (habilitat) i rec (habilitat en la gravació). Amb la comanda m podem canviar el mode. Per ex:
m on p #reproduir s #aturar
Canvis de temps de compàs (time signature changes)
Veure la documentació.
Canvi de tempo
g 0 #go to measure 0 t 100 #set tempo to 100bpm g 2 #go to measure 2 t 180 #set tempo to 180bpm