The JBS Midish Extra Commands are are a set of commands written for the Midish commandline Midi sequencer, written by Alexandre Ratchov.
Midish comes with a shell program called rmidish, which has its own shell-like language. This language is used to write these "comfort commands", that make Midish/rmidish much more fun to work with. Included are commands to copy, quantise and clear tracks, map channels, creating input/output routings and act on groups. Furthermore a few more transport commands are added. Also some basic step sequencing functionality is provided.
The JBS Midish Extra Commands don't add new functionality to Midish, but they provide higher level functions for an everyday workflow with reasonable amounts of typing.
[Back to top]
You can use these commands in two ways. To test them you may include them on an ad hoc basis:
bash$ rmidish
[...]
rmidish# exec ".Midish_extrarc"
Since it's a Midish script, you can execute it from within rmidish, using the exec command.
Or you can include the commands permanently, by adding this line to the end of your ~/midishrc:
exec "/path/to/your/user_directory/.midish_extrarc"
You may rename the file and put it where you want. Just remember to adapt the code snippets to the new name and location.
[Back to top]
28.03.2016: Version 1.5
- Added: icopy and icopym to copy from a track to itself
- Added: chmap, chmapm, cchmap and cchmapm to copy and map events from one track to another
- Added: position name start, now and end may now be used everywhere, where a position is required
- Fixed: a few minor bugs
[Back to top]
"JBS Midish Extra Commands" © 2014-2019 Jeanette C. <Jeanette (at) Juliencoder (dot) de>
The "JBS Extra Midish Commands" are provided under the GNU General Public License (GPL), version 3, which is provided with this package in the file COPYING.
Midish is © Alexandre 2003-2015, Alexandre Ratchov <alex@caoua.org>
Midish is Copyright © 2008 Willem van Engen <wvengen@stack.nl>
For more information on Midish and its copyright, pleases visit the Midish website at www.midish.org.
[Back to top]
Most commands from the "JBS Midish Extra Commands" deals with tracks and some more deal with intervals and positions. Since there are many similarities, there are a few naming conventions to indicate, how the command works:
- csomething - The command "something" works on the current track or takes the current track as source. Examples: cmute will mute the current track and ccopy will copy notes and other events from the current track.
- isomething - The command "something" takes the current track both as its input and output. "i" is short for identity. Example: icopy will copy notes and other events from the current track to a different position in the current track.
- somethingm - The command "something" takes an interval as a start position and a number of measures. Example: copym will copy copy_measures measures from start_position to dest_position.
[Back to top]
To get the best results and the most enjoyment out of these commands, setup your hardware MIDI devices and channels for them in your ~/.midishrc like this:
dnew 0 "USB MIDI Cable 1" rw # synth1 connected to USB MIDI Cable 1
dnew 1 "USB MIDI Cable 2" rw # synth2 connected to USB MIDI Cable 2
inew keys1 {0 0} # first input channel of synth1
inew keys2 {0 1} # Second input channel of synth one
onew keys1 {0 0} # First output channel of synth1
onew keys2 {0 1} # Second output channel of synth1
inew module1 {1 0} # First input channel of synth2
inew module2 {1 1} # Second input channel of synth2
onew module1 {1 0} # First output channel of synth2
onew module2 {1 1} # Second output channel of synth2
When creating tracks use the rnew command to set up your routing. Example:
tnew piano # create a track called piano
rnew keyboard1 piano_module1 # map everything from the channel keyboard1 to the channel piano_module1
Wherever possible, record only one instrument - one MIDI channel - on a single track.
Wherever possible and not too inconvenient, use commands from this set to work with your MIDI. The commands sometimes make extra notes and have some protection against unwanted actions.
Store some extra info in a separate file. As of version 1.1 Midish can't store dynamically created devices and groups, as they are used by the group commands. So here's the typical info that should be written to a secondary file:
# Load the Midish project file
load "my_project.msh"
# Dynamic devices
dnew 2 "MIDI-Soundcard 1" rw
dnew 3 "MIDI USB Cable 1" rw
dnew 6 "Software Synthesizer" wo
# Groups
let strings = {violin viola cello bass}
let brass = {trumpets horns trombones tuba}
Store the file as my_project.mcfg .
my_project.msh is the Midish project or song file, that Midish stores, when you call save "my_project.msh". The filename extension is arbitrary. On your next rmidish start after storing don't call load "my_project.msh", but call:
exec "my_project.mcfg"
This will then execute all your special setup commands and load the project file for you.
[Back to top]
The transport commands allow you to relocate the position, i.e. forward and rewind.
- fw measures - forward the given number of measures from the current position:
fw 16 # forward 16 measures
- rw measures - rewind the given number of measures from the current position. If the resulting position would be before the beginning, then the position is set to the beginning, i.e. measure 0:
rw 8 # rewind 8 measures
[Back to top]
Track commands fall into a few categories: track information, clearing recorded material, copying events as-is from, copying events and mapping channels and quantising.
Track information
- show - display all tracks with additional information (mute status, used filter and used channel(s))
- sh - display information about the current track (mute status, used filter, used channel(s))
Clearing recorded material
- cclrm start_position clear_measures - remove clear_measures measures from the current track, starting at start_position. The track won't be shortened, just emptied out:
cclrm now 16 # clear 16 measures from the current position
- cclr start_position end_position - remove everything between start_position and end_position from the current track.
cclr 12 16 # remove everything from measure 12 to measure 16
- clrm track start_position clear_measures - remove clear_measures from the track "track", starting at start_position:
clrm piano 8 4 # clear 4 measures from the track piano, starting at measure 8
- clr track start_position end_position - remove everything between start_position and end_position from the track named "track"
clr bass 5 9 # remove all event from measures 5 to 9 from the track bass
Play status
- cmute - mute the current track. It won't play until unmuted by cunmute or Midish's mute command
- cunmute - unmute the current track
- csolo - mute every track but the current, i.e. "solo the current track"
- solo track - solo the track called "track":
solo violin # only violin will play
- nosolo - unmute ALL tracks. Unfortunately there's no way, to save the state of previously muted tracks
Quantising
- cquantm start_position quantise_measures quantise_note precision - quantise quantise_measures, starting at start_position on the current track. Quantise everything to the nearest quantise_note with the given precision. Quantise note is given as a denominator, so 16 means 16th note and 4 means quarter notes:
cquantm start 10 16 100 # quantise 10 measures from measure 0 (start) to the nearest 16th note with 100% precision
- cquant start_position end_position quantise_note precision - just as above, only use start and end positions rather than an interval in measures
- quantm track start_position quantise_measures quantise_note precision - just like cquantm, only not on the current track, but on the track named "track"
- quant track start_position end_position quantise_measures precision - just like cquant, only not on the current track, but on the track named "track"
Copying
- ccopym start_position copy_measures dest_track dest_position - copy copy_measures, starting at start_position from the current track to dest_position on the track dest_track:
ccopym 24 8 bass 16 # copy 8 measures, starting at measure 24 from the current track to the track bass at measure 16
- ccopy start_position end_position dest_track dest_position - just like above, only use two positions instead of an interval in measures
- copym source_track start_position copy_measures dest_track dest_position - just like ccopym, only copy from the source track source_track
- copy source_track start_position end_position dest_track dest_position - just like ccopy, only copy from source track source_track
- icopym start_position copy_measures dest_position - just like ccopym only copy from the current track to the current track. The intervals, may not overlap:
icopym 8 16 23 # ERROR: measure 8 plus 16 measures brings you to measure 24, but measure 23 would overlap
- icopy start_position end_position dest_position - just like ccopy, only copy from the current track to the current track
Channel copying/mapping
- cchmapm start_position copy_measures dest_track - copy/map everything starting at start_position for copy_measures from the current track's default output channel to the dest_track's default output channel at the same start_position
- cchmap start_position end_position dest_track - just like cchmapm, only with start and end_position instead of an interval in measures
- chmapm source_track start_position copy_measures dest_track - just like cchmapm, only with a specified source_track:
chmapm piano 10 8 rhodes # copy 8 bars, starting at measure 2 from the track piano to play on the rhodes track's, using its default output channel
- chmap source_track start_position end_position dest_track - just like cchmap, only with a specified source_track
- cchdup source_channel dest_track - copy source_channel from the current track to dest_track. The whole track will be copied:
cchdup organ_pedal_channel pedals # copy all events on the channel organ_pedal_channel from the current track to the pedals track
- chdup source_track source_channel dest_track - just like above, only with a specified source_track
[Back to top]
The step sequencing commands allow you to enter notes on the rmidish commandline. Additionally the pstep and pstepv commands rely on the settings of plen and pgrid, since they work on a grid of fixed note lengths like traditional, analogue step sequencers.
- pgrid denomination - set the step size of the sequencer, i.e. what's the note length from one step to the next:
pgrid 16 # allow entering of 16th notes
- plen note_length - set the length of a note. This also uses note denominations. The effect of this is the legato or staccato of entered notes:
plen 32 # with the above step size of 16th notes, this means staccato notes, since one note will only play for a 32nd note, followed by a 32nd silence before the next note
- ppenv bar step denomination note velocity - pencil in a MIDI-note note, at velocity velocity and length of denomination to position bar step. Step is given in the current grid size. Both bars and steps are counted from 0:
ppenv 2 1 8 36 127 # add note 36 (low C) at velocity 127 (LOUD!) to bar 2 (the third bar) at step one (the second 16th in our example) and of an 8th note length, so it will overlap with the next 16th
- ppen bar step denomination note - just like above, only assume a velocity of 127 for every note
- pstepv bar step note velocity - add a MIDI note note at velocity velocity to bar bar at grid position step. The grid size and note_length are given by pgrid and plen respectively:
pstepv 6 0 60 108 # add MIDI-note 60 (middle c) at velocity 108 (rather loud) to bar 6 (the 7th bar) and step 0 (the first step)
- pstep bar step note - just like above, only with an assumed velocity of 127
- prepeatv bar step note velocity repeat_count note_length - add MIDI-note note repeat_count times at velocity velocity and length note_length (give as note denomination) to bar bar, at grid position step:
prepeatv 5 11 60 100 8 16 # add MIDI-note 60 (middle c) at velocity 100 and note length of a 16th 8 times, starting on bar 5 (the sixth bar) and grid position 11 (the 12th step)
- prepeat bar step note repeat_count note_length - just like above, only with an assumed velocity of 127
[Back to top]
These commands act on a group of tracks. As of Midish version 1.1, groups can't be stored inside the project files. A way around it, is to store them in an extra file, that can be executed by Midish later on. A group is a simple list of tracks, you can create it like this:
let strings = {violin viola cello bass}
ATTENTION: a group must always be named as a variable, i.e. preceded by a dollar sign ($). So to display all tracks in a group type:
gshow $strings
Now here's how the extra file can look. Imagine your project is called big_hit and the Midish project file is called big_hit.msh:
load "big_hit.msh"
let strings = {violin viola cello bass}
You could store that under the name "big_hit.mcfg". Then when you open your project for the next time, you don't type the load command, but:
exec "big_hit.mcfg"
The group commands cover areas similar to track commands and where appropriate are just the same:
- gnew - shortly explain, how to create a group, as shown above
- gshow group - display all tracks of the group with some extra information:
gshow $strings # show all tracks in the strings group
- gmute group - mute all tracks in the group:
gmute $strings # mute violin, viola, cello and bass
- gunmute group - unmute all tracks in the group:
gunmute $strings # unmute violin, viola, cello and bass
- gsolo group - unmute every track, but those in the group. Reverse that by calling nosolo:
gsolo $strings # only play violin, viola, cello and bass
- gclrm group start_position clear_measures - clear clear_measures, starting at start_position from every track in the group:
gclrm $strings now 8 # clear 8 measures from the current position of violin, viola, cello and bass
- gclr group start_position end_position - just like above, only with start and end_position, instead of an interval in measures
- gquantm group start_position quantise_measures quantise_note precision - quantise every track in the group for quantise_measures, starting at start_position to the nearest quantise_note denomination with a precision of precision percent, just like cquantm:
gquantm $strings 12 16 8 75 # quantise 16 measures, starting at measure 12 to the nearest 8th note with a precision of 75% in violin, viola, cello and bass
- gquant group start_position end_position quantise_note precision - just like above, only with a start and end_position instead of an interval in measures
- gcopym group start_position copy_measures dest_position - copy copy_measure, starting at start_position from the group group to the group at dest_position, a bit like icopym:
gcopym $strings start 8 16 # copy 8 measures from the beginning of the song to measure 16 from the group strings to the group strings
- gcopy group start_position end_position dest_position - just like above, only with start and end_position, instead of an interval in measures
[Back to top]
These commands don't fit in any other category. They range from some device and channel setup to routing input and output channels for tracks.
Track channel routing
- rnew input_channel output_channel - route all events from channel input_channel to channel output_channel on the current track. Events on output_channel will be recorded:
rnew master_keyboard synth_module # route incoming MIDI events from master_keyboard to synth_module
- radd input_channel output_channel - add another routing to the current track. This hasn't been tested yet!
- rsplit input_channel left_output right_output splitpoint - route the channel input_channel to the two output channels left_out and right_out. The MIDI-note splitpoint will be the highest note recorded on the left_out MIDI-channel. Not fully tested!
rsplit master_keyboard bass piano 59 # split the incoming MIDI-events from master_keyboard to output channels bass and piano, where the piano will play from MIDI-note 60 onwards (middle c)
Device and channel setup
These commands will setup new MIDI-devices and channels. It can be useful to add software synthesizers, that aren't always running or MIDI-USB-devices, that will only turn up, once the instrument is turned on.
As of Midish version 1.1 extra devices aren't stored with a project, you can add them in an extra file, where you can also store groups. The order of adding devices and groups is arbitrary. Example:
dnew 5 "LinuxSampler" wo
This will add the software synthesizer with the MIDI-port named "LinuxSampler" as MIDI device number 5. The corresponding channels will be stored in your Midish project. When you add new devices using the functions below, the command to put into your extra file will be printed to the screen.
- snew synth name - add a new software synthesizer or pure audio module with no MIDI output. The MIDI-port name of the device is synth and its name inside Midish is name. The name will be the name of the first output channel, that will automatically be created. Further channels must be added manually:
snew "LinuxSampler" ls # add LinuxSampler with the portname "LinuxSampler" as Midish channel ls
- sdel my_name - will remove the device and accompanying MIDI-channels from Midish:
sdel ls # will remove the device connected to the MIDI-port "LinuxSampler" and remove the output channel named ls
- hnew synth name - just like snew, only it create both input and output channels of name name. This can be useful for keyboards and other devices, that will both send and receive MIDI
- hdel name - will remove the input and output channels name and the connected device
- ionew name new_name channel_number - will create a new pair of input and output channels called "new_name" with the channel number channel_number and the same device as connected with name:
snew "MIDI-Soundcard" synth # will create a MIDI device and the input and output channels named synth
ionew synth synth2 1 # will add input and output channels called synth2 with MIDI-channel 1 (the second channel)
[Back to top]
rmidish - the Midfish shell interface - was never really intended as a program for the real world. It was meant to be an example of how to use Midish as an engine in your own applications. Years later, it is still here though. It does not have all the features you would expect from a graphical - or hardware - MIDI sequencer. This means working around it. One way is by being methodical and systematic. This section shows one way of effectively using Midish.
For using groups and dynamic devices, please see the good practises section above.
An extra script as the project.mcfg can also be used to store further dynamic information that Midish won't store in a project by default.
Too many tracks to see them all
Organising your tracks: the groups have many advantages. You can mute and unmute tracks that belong together, you can copy whole sections within a group, but you can also display tracks in logical units. Especially when a project grows, a full list of tracks won't fit on the screen, that's where groups can help, using the gshow command.
Slimming down audio recording without missing a single track
Organising audio recording and rendering: again a case for groups. Perhaps you have multiple hardware synthesizers and multiple software synthesizers. Once you have completed your composition in MIDI, it's time to record all tracks to audio. You can create small groups of tracks that can be recorded in parallel. Say you have two tracks on synth1 and two tracks on synth2, you can create two groups:
let run1 = {synth1_piano synth2_bass}
let run2 = {synth1_string synth2_drums}
Now you can setup your audio recording and use gsolo $run1 and gsolo $run2 respectively to record your tracks. It looks pointless here, but when you have 20 or 40 tracks in total it makes much more sense.
Which track plays on which synth?
The sh command will list the playback channel of a track. But it is tedious to inspect every track this way. Naming conventions can help. Put the name or initial of the playback synth in the track name. Say you have the Megasynth and the Gigasynth, you can create m_piano and g_bass. This way you see the name and know to which synth they belong.
Recording a piece in section, maybe even nonlinear?
Think of electronic music, or any music that has repeating sections. What many people do is, record a few patterns/sections and then cut, copy and paste them to create the final song. Midish can do that. Again some track naming conventions might help.
- As stated above putting the name or initial of a synth in the trackname helps.
- Also, include the section name or number in a trackname. For example: g_piano_chorus, meaning Gigasynth piano for the chorus. You may just number your sections or again use initials.
For the final result, i.e. the complete song, you can create another batch of tracks without the section names and copy the patterns to these. So you can copy the eight bars from g_piano_intro to g_piano, then the eight bars from g_piano_verse to g_piano ...
For even more control you can create groups to relfect your section tracks. You could create the groups intro, verse, bridge and chorus and add all the necessary tracks to those. Then you might create a group full_song. Now you can easily flip back and forth between sections to see which instruments you might want and the full song to hear how everything fits together.
Midish and Yoshimi
Yoshimi is a software synthesizer that runs on Linux - and other operating systems. Yoshimi can respond to MIDI from the ALSA sequencer. However, I have experienced problems with that. Yoshimi sees an incoming connection, but doesn't react to any data. No notes, no sound.
Yoshimi can also use JACK MIDI. There are several programs to bridge MIDI between JACK and ALSA. You can use a2j_midi_bridge, or any other, to connect Midish to Yoshimi.
- In JACK connect a2j_midi_bridge:playback to Yoshimi's MIDI input port.
- In Midish create a softsynth device to play notes to a2j_midi_bridge's input.
- Now route your Midhs tracks to the a2j_midi_bridge device and Yoshimi will play.
More complex real world scenarios
On Juli-Encoder you can find more articles describing how to synchronise Midish to Nama (and other Linux DAWs) as well as managing bigger projects with software synthesizers. Just check back there and look at the publications page.
Has this manual missed a trick? Have you found other brilliant ways to improve your Midish workflow? Please let Jeanette know.
[Back to top]