SendMidi [CMD]

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

SendMidi [CMD]

Post by BoBo » 09 Feb 2018, 03:19

SendMIDI is a multi-platform command-line tool makes it very easy to quickly send MIDI messages to MIDI devices from your computer.

To use it, simply type "sendmidi" or "sendmidi.exe" on the command line and follow it with a series of commands that you want to execute. These commands have purposefully been chosen to be concise and easy to remember, so that it's extremely fast and intuitive to quickly shoot out a few MIDI messages.

These are all the supported commands:

Code: Select all

  dev   name           Set the name of the MIDI output port
  virt  (name)         Use virtual MIDI port with optional name (Linux/macOS)
  list                 Lists the MIDI output ports
  panic                Sends all possible Note Offs and relevant panic CCs
  file  path           Loads commands from the specified program file
  dec                  Interpret the next numbers as decimals by default
  hex                  Interpret the next numbers as hexadecimals by default
  ch    number         Set MIDI channel for the commands (1-16), defaults to 1
  omc   number         Set octave for middle C, defaults to 3
  on    note velocity  Send Note On with note (0-127) and velocity (0-127)
  off   note velocity  Send Note Off with note (0-127) and velocity (0-127)
  pp    note value     Send Poly Pressure with note (0-127) and value (0-127)
  cc    number value   Send Control Change number (0-127) with value (0-127)
  pc    number         Send Program Change number (0-127)
  cp    value          Send Channel Pressure value (0-127)
  pb    value          Send Pitch Bend value (0-16383 or value/range)
  rpn   number value   Send RPN number (0-16383) with value (0-16383)
  nrpn  number value   Send NRPN number (0-16383) with value (0-16383)
  clock bpm            Send 2 beats of MIDI Timing Clock for a BPM (1-999)
  mc                   Send one MIDI Timing Clock
  start                Start the current sequence playing
  stop                 Stop the current sequence
  cont                 Continue the current sequence
  as                   Send Active Sensing
  rst                  Send Reset
  syx   bytes          Send SysEx from a series of bytes (no F0/F7 delimiters)
  syf   path           Send SysEx from a .syx file
  tc    type value     Send MIDI Time Code with type (0-7) and value (0-15)
  spp   beats          Send Song Position Pointer with beat (0-16383)
  ss    number         Send Song Select with song number (0-127)
  tun                  Send Tune Request
  mpe   zone range     Send MPE Configuration for zone (1-2) with range (0-15)
  raw   bytes          Send raw MIDI from a series of bytes
  -h  or  --help       Print Help (this message) and exit
  --version            Print version information and exit
  --                   Read commands from standard input until it's closed
Alternatively, you can use the following long versions of the commands:

Code: Select all

  device virtual decimal hexadecimal channel octave-middle-c note-on note-off
  poly-pressure control-change program-change channel-pressure pitch-bend
  midi-clock continue active-sensing reset system-exclusive
  system-exclusive-file time-code song-position song-select tune-request
  raw-midi
:arrow: [More..] 8-)

User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: SendMidi [CMD]

Post by rommmcek » 23 Aug 2020, 21:43

BoBo wrote:
09 Feb 2018, 03:19
SendMIDI is a multi-platform command
I wonder why nobody gave it a try! I guess the whole topic (Other Utilities & Resources) doesn't have many views...
I had some problems e.g. commands using timestamps and starting with 00:00:00.000 doesn't work for me, even if only one of HH, MM or SS is 00 sometimes spoils the execution... didn't explore further, instead 've used relative timestamp which works perfectly for me, although negative offset is ignored.
However once the commands are executed I was unable to interact with Midi Device (e.g. send position pointer...).

Use sendmidi "file.sdm", or associate the .sdm extension with sendmidi.exe and run it from explorer or use:

Code: Select all

Run, sendmidi "file.sdm"
from an AutoHotkey script (file must be in the same folder as downloaded sendmidi.exe or specify path).

P.s.: Non Windows users should edit the name of the Midi Device in the file!
Attachments
When a man loves a woman - Michael Bolton.zip
(32.87 KiB) Downloaded 93 times

User avatar
alin89c
Posts: 6
Joined: 14 Sep 2021, 23:26
Contact:

Re: SendMidi [CMD]

Post by alin89c » 15 Sep 2021, 00:58

Hi, @rommmcek and @BoBo !

I've been using sendmidi with AppleScript for about a year now and It worked (and still works) beautifully!

This is how I've used it:
do shell script "eval $(/usr/libexec/path_helper -s); sendmidi dev loopD ch 2 on 109 127
In AutoHotKey, the line that generates a Note-On MIDI message looks like this:
run, sendmidi dev loopD ch 2 on 50 127
While the above line works, I'm a bit unsatisfied because the Command Prompt window opens and closes immediately (which on my MAC doesn't happen).
Is there anything I can do to stop this behavior (i.e. stop Command Prompt from popping-up)?

Thank you!

For the ones who would like to make sendmidi work on MAC:
https://www.youtube.com/watch?v=WqPFr9SdOPg&t=2s

EDIT:
I've found the answer to making Command Prompt stay put (thanks to AHK documentation and... Google).
Here's the solution:
run, sendmidi dev loopD ch 2 on 50 127,,hide

Post Reply

Return to “Other Utilities & Resources”