CLI midi player with play pause & tempo change

Support & discussion regarding DAWs and MIDI sequencers.

Moderators: MattKingUSA, khz

Post Reply
retnev
Established Member
Posts: 157
Joined: Sat Mar 25, 2017 2:13 am
Has thanked: 4 times
Been thanked: 3 times

CLI midi player with play pause & tempo change

Post by retnev »

I have been trying to find a command line midi player that would pause, do tempo changes and skip forward backward

Anyone have an idea of such CLI tool

Before I have to write one, I better make sure it doesnt exist.
I dont want to go through all the effort for nothing.

Thanks
Last edited by retnev on Sat Aug 29, 2020 5:31 am, edited 1 time in total.
tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: CLI midi player with play pause & tempo change

Post by tramp »

Can't help you with a ready CLI tool doing what you ask for, but funnily I just work on a midi player(looper)/recorder.
It's written in C/C++ under the BSD Zero Clause License, means you could take the source and do with it what ever you want. So at least if you didn't found what you look for, you don't need to start from scratch.

The Midi file handling, playing, recording, and the jack interface is clean separated into it's own classes, and so is the GUI. Replacing the GUI Class with a CLI class wouldn't be to hard, as the jack class talk to the GUI by signals only.

It support BPM control and have MidiBeatClock support, also support midi file loading from command-line already.
Beside replacing the GUI, you'll need to implement pause (currently it starts the file from beginning when you stop play) and skip forward backward. That wouldn't be to hard to do.

here you find the source:
https://github.com/brummer10/Mamba
On the road again.
nils
Established Member
Posts: 538
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: CLI midi player with play pause & tempo change

Post by nils »

fluidsynth itself can play a midi from the command line but has no control options

jpmidi has no internal soundfont engine but you get the controls, start, stop, seek (jump). But it does not react to jack transport tempo changes. Possibly because midi files have their own tempo changes builtin so you have a constant "battle" who sets the tempo: .mid file or the player.

Adding jack tempo to jpmidi is still the better than writing your own player.
retnev
Established Member
Posts: 157
Joined: Sat Mar 25, 2017 2:13 am
Has thanked: 4 times
Been thanked: 3 times

Re: CLI midi player with play pause & tempo change

Post by retnev »

Thanks to both tramp and nilshi for the information.

I did not come accross either of the suggestions in my search and the information is very helpful.
I will take a look at the solutions / suggestions presented.
retnev
Established Member
Posts: 157
Joined: Sat Mar 25, 2017 2:13 am
Has thanked: 4 times
Been thanked: 3 times

Re: CLI midi player with play pause & tempo change

Post by retnev »

I tried jpmidi.
To use it
1) I will have to write an "expect" like routine to control it from my program as-is. Clunky but Doable.
2) Unfortunately for this application I must also be able to send the midi directly to a midi hardware device so the jack midi needs to be downgraded to stand-alone "direct-to-device" (non-jack) midi. Also not a showstopper.

It almost was an out-of-the box solution if it was not for (2) .
I will therefore have to change the source.
I did not look yet in the source if the functionalities pause etc are jack specific, otherwise if not it should be an easy change.

If I have to make the jackless version, then I might as well remove the "expect" interface, which will simplify calling it from any program.

It is a great candidate thanks.
VanHammen
Established Member
Posts: 39
Joined: Sat Aug 29, 2015 3:53 pm
Has thanked: 9 times
Been thanked: 6 times

Re: CLI midi player with play pause & tempo change

Post by VanHammen »

I have been trying to find a command line midi player that would pause, do tempo changes and skip forward backward
latest versions of bipscript have all this functionality, sounds like it may just be a few lines of script: www.bipscript.org
Post Reply