Command line (Midi) sequencer?

Support & discussion regarding DAWs and MIDI sequencers.

Moderators: MattKingUSA, khz

User avatar
Linuxmusician01
Established Member
Posts: 1547
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Command line (Midi) sequencer?

Post by Linuxmusician01 »

I'd like to use a Raspbery Pi (Zero) as a sequencer for synths via USB Midi. But a Desktop Environment (DE) is often too much for a Pi. And the screen I'd like to use is too small for that. I really like Seq24 as a sequencer but it has a GUI and requires a DE.

There's MidiSh for the commandline but to me it's incomprehensible. You can also record and play Midi with Alsa (arecordmidi and aplaymidi) but that's not exactly a sequencer. I tried to re-play the stuff I recorded w/ arecordmidi in an endless loop but there's a hickup when the Midi sequence stops and starts again. Unworkable.

So is there a simple Midi sequencer for the command line? Something made with ncurses maybe?
User avatar
oscillator
Established Member
Posts: 1127
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Has thanked: 725 times
Been thanked: 298 times
Contact:

Re: Command line (Midi) sequencer?

Post by oscillator »

Maybe @jeanette_c can help you, she's a CLI wizard! :)

MusE DAW running on Debian 11 Testing/XFCE4.
https://oscillator.se/musik

jeanette_c
Established Member
Posts: 730
Joined: Tue May 12, 2020 5:53 pm
Has thanked: 347 times
Been thanked: 270 times

Re: Command line (Midi) sequencer?

Post by jeanette_c »

Ha, my first thought would have been Midish. Due to its shell script like language, one can write convenience commands and it can loop to a degree. I'd be happy to help, if that alternative might suite you.
Basically, you have shell-like programs like Midish and possibly jpmidi. You have sooperlooper, which has MIDI support and can run without a GUI. That supports MIDI learn for all kinds of features, but you will have to master looper skills, like timing and the like.
Dedicated synthesis tools like Csound, CLM (Common Lisp Music), PureData or SuperCollider can run in the commandline. PD can run without a GUI, but you can create your MIDI environment on the GUI. The same was true about SuperCollider, last time I looked.
Mod-host is a commandline LV2 host. It is used inside the Mod Devices pedals and modules to run LV2 plugins. I have never used it with MIDI sequencer plugins, but it too supports MIDI learn.
Lastly, there are trakcer like programs. Cuse is old, but should still run. It is no longer developed. There was/is ttrk and at least one other tracker like application. ttrk required more characters to the screen, when I tried it, a few years ago.
People who know Python often prefer to write small, dedicated scripts themselves. Python apparently has a few very good MIDI packages. The same is true for Perl and c++, possibly other languages as well.
If you could tell us more about your requirements, workflow and tech level, we might narrow the choices down.
HTH, best wishes, Jeanette
--
distro: ArchLinux, DAW: Nama, MIDI sequencer: Midish
All my latest music on https://www.youtube.com/channel/UCMS4rf ... 7jhC1Jnv7g
Albums, patches and Csound on http://juliencoder.de
User avatar
milkii
Established Member
Posts: 477
Joined: Tue Jan 05, 2016 9:08 am
Location: Edinburgh
Has thanked: 92 times
Been thanked: 91 times
Contact:

Re: Command line (Midi) sequencer?

Post by milkii »

edit: Post removed, I can't read

they/them ta / libreav.org / wiki.thingsandstuff.org/Audio and related pages / gh

Basslint
Established Member
Posts: 1516
Joined: Sun Jan 27, 2019 2:25 pm
Location: Italy
Has thanked: 385 times
Been thanked: 299 times

Re: Command line (Midi) sequencer?

Post by Basslint »

I recommend an alternative approach: use ABC notation to generate MIDI.

https://github.com/sshlien/abcmidi

It's a standardized notation language with a long history so you can be confident about it.

There is also MML (very used in Japan and chiptune circles) but I don't know any reliable FLOSS implementation. Edit: apparently there's mugene-ng
The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]

Please donate time (even bug reports) or money to libre software 🎁

Jam on openSUSE + GeekosDAW!
User avatar
Linuxmusician01
Established Member
Posts: 1547
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Re: Command line (Midi) sequencer?

Post by Linuxmusician01 »

@jeanette_c: Thanks for all the info! I think that good ol' tracker called Cuse is something for me. Recently I learned how to use the SID-Wizard tracker for the Commodore 64.

Cuse is not in the standard repositories anymore so I tried to use the pre-compiled binary with this command:

Code: Select all

cuse
which echoes:

Code: Select all

usage: ./cuse /dev/midi_device
if you have no MIDI device you may use /dev/null
So I ran:

Code: Select all

cuse /dev/midi
which gave me this error:

Code: Select all

Error opening terminal: xterm-256color
I solved that after some googling with:

Code: Select all

export TERM=xterm-basic

But now I get the error:

Code: Select all

Aborted (core dumped)
Is that a Cuse error or does this mean the Cuse pre-compiled version that I downloaded simple doesn't work? Tying to compile it from source doesn't work either:

Code: Select all

CuSE.cxx:1068:35: error: cannot convert ‘char* (*)[98]’ to ‘const char* (*)[98]’
 1068 |  menu = newCDKMenu (p_cdk_screen, menulist, 6, submenusize, menuloc,
      |                                   ^~~~~~~~
      |                                   |
      |                                   char* (*)[98]
I remember having done all this before so I might have asked it before... Hmmmm. :?:
jeanette_c
Established Member
Posts: 730
Joined: Tue May 12, 2020 5:53 pm
Has thanked: 347 times
Been thanked: 270 times

Re: Command line (Midi) sequencer?

Post by jeanette_c »

Hi @Linuxmusician01 , cuse is rather old. The last error you got may have been because /dev/midi is not connected to a proper MIDI device. You may either try /dev/snd/midiSomething_or_other and if that doesn't work, you could try to edit the source code, which may be somewhat trivial but work intensive. Or you may try another - newer - tracker application. ttrk (TekTracker) isn't much newer, but works on proper ALSA IIRC.
I also remembered, that there now is hardour, a commandline version of Ardour that can at least load a prepared session.
Packages I saw in the Arch repos which had both tracker and MIDI in name and description were: jacker-hg a JACK MIDI tracker (possibly written in Haskell) and Tutka and ariamaestrosa. Though I particularly expect the latter to have a GUI. No idea about the others.
If you can run a DOS emulator in the commandline you might find an old DOS tracker/sequencer. There are a few that were occasionallymentioned. Sorry, I don't have names, because that never interested me. Emulators on the Pi might be an outside chance, because of the processor architecture. Again, I don't know mcuh about that.
Beyond that I could only find stepseq.lv2 which comes back to the mod-host solution, but without any 2d layout. There you'd mostly have to use MIDI learn to control the plugin with your connected MIDI controller.
Just as another straw: have you looked into a bare minimum GUI setup for such near embedded solutions with Pis? Many people prefer them as parts of their setups now. Perhaps that with a leightweight graphical sequencer might work.
--
distro: ArchLinux, DAW: Nama, MIDI sequencer: Midish
All my latest music on https://www.youtube.com/channel/UCMS4rf ... 7jhC1Jnv7g
Albums, patches and Csound on http://juliencoder.de
User avatar
Linuxmusician01
Established Member
Posts: 1547
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Re: Command line (Midi) sequencer?

Post by Linuxmusician01 »

jeanette_c wrote: Mon Mar 28, 2022 12:16 pm Hi @Linuxmusician01 , cuse is rather old. The last error you got may have been because /dev/midi is not connected to a proper MIDI device. You may either try /dev/snd/midiSomething_or_other and if that doesn't work, you could try to edit the source code, which may be somewhat trivial but work intensive. Or you may try another - newer - tracker application. ttrk (TekTracker) isn't much newer, but works on proper ALSA IIRC.
I also remembered, that there now is hardour, a commandline version of Ardour that can at least load a prepared session.
Packages I saw in the Arch repos which had both tracker and MIDI in name and description were: jacker-hg a JACK MIDI tracker (possibly written in Haskell) and Tutka and ariamaestrosa. Though I particularly expect the latter to have a GUI. No idea about the others.
If you can run a DOS emulator in the commandline you might find an old DOS tracker/sequencer. There are a few that were occasionallymentioned. Sorry, I don't have names, because that never interested me. Emulators on the Pi might be an outside chance, because of the processor architecture. Again, I don't know mcuh about that.
Beyond that I could only find stepseq.lv2 which comes back to the mod-host solution, but without any 2d layout. There you'd mostly have to use MIDI learn to control the plugin with your connected MIDI controller.
Just as another straw: have you looked into a bare minimum GUI setup for such near embedded solutions with Pis? Many people prefer them as parts of their setups now. Perhaps that with a leightweight graphical sequencer might work.
Thanks again for the help. On a Pi Zero (and the other Pi that I own) any GUI is such a heavy weight that it's not gonna work with music making.

Tutka looks nice, but it has a GUI, the others you recommended I can't find in the standard repo's of Ubuntu 20.04 Focal. Unfortunately ttrk wouldn't compile from source (it's from 2004).

Cuse won't work with /dev/snd/midiC0D0 or /dev/snd/midiC2D0. Are the /dev/snd/midisometing devices from ALSA?

I guess there's no CLI Midi sequencer to operate your synthesizers and/or drumcomputers. That's a pity because a small battery operated Pi Zero would be an excellent solution. Most laptops that will happily operate your synths are clumsy and big. Hate 'm.
jeanette_c
Established Member
Posts: 730
Joined: Tue May 12, 2020 5:53 pm
Has thanked: 347 times
Been thanked: 270 times

Re: Command line (Midi) sequencer?

Post by jeanette_c »

I'm sorry, the CLI is not everyone's darling these days.
Could sooperlooper help or is it too restrictive/requiring too much effort to master?
Beyond that, I'm back at make Midish work, create or find something written in Csound, PD, CLM, SC3 or the likes. Also look for Python projects. Python seems to be a big thing on Pis.
There are/were some audio specific operating systems, not sure whether they run on ARMs or another single board computer.
With a little budget: get a bigger Pi to run a slim GUI solution or look for a small sequencer or multi-function device with sequencer capabilities.
There are projects in the maker scene. These will often require at least some Arduino board, perhaps a few more bits and limited soldering. There are also breadboard solutions, where you don't solder but plugin connectors, like Eurorack modular for electronic jam sessions. :) @oscillator has some experience with that, as may others.
A last word on Midish: I use it for all my projects. It's focused on linear workflows, but there is a looping feature. I have written many comfort or convenience commands, but it remains a shell prompt application, unless you can write a simple ncurses UI for it. It's made to work as a backend. Still, once there you might just as well work with any of the other programming/scripting/modular environments.
--
distro: ArchLinux, DAW: Nama, MIDI sequencer: Midish
All my latest music on https://www.youtube.com/channel/UCMS4rf ... 7jhC1Jnv7g
Albums, patches and Csound on http://juliencoder.de
ahlstromcj
Established Member
Posts: 9
Joined: Wed Jun 01, 2022 2:11 pm
Been thanked: 4 times

Re: Command line (Midi) sequencer?

Post by ahlstromcj »

Seq66 can be built as both a GUI and a CLI. You can use the GUI to set up and test MIDI control (i.e. via a LaunchPad), and then use the same setup from the command line (or as a daemon).

https://github.com/ahlstromcj/seq66

Recommend perusing the manual.

User avatar
Linuxmusician01
Established Member
Posts: 1547
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Re: Command line (Midi) sequencer?

Post by Linuxmusician01 »

ahlstromcj wrote: Fri Sep 08, 2023 12:03 pm

Seq66 can be built as both a GUI and a CLI. You can use the GUI to set up and test MIDI control (i.e. via a LaunchPad), and then use the same setup from the command line (or as a daemon).

https://github.com/ahlstromcj/seq66

Recommend perusing the manual.

Can I read the manual somewhere on how to create a Midi file w/ Seq66 via the command line? Any Midi file can be played pack to a Midi device via the command line with:

Code: Select all

aplaymidi
alex stone
Established Member
Posts: 351
Joined: Fri Jun 06, 2008 7:39 am
Has thanked: 67 times
Been thanked: 53 times

Re: Command line (Midi) sequencer?

Post by alex stone »

Are Ecasound and Nama potential options?

jeanette_c
Established Member
Posts: 730
Joined: Tue May 12, 2020 5:53 pm
Has thanked: 347 times
Been thanked: 270 times

Re: Command line (Midi) sequencer?

Post by jeanette_c »

alex stone wrote: Sat Sep 09, 2023 12:49 pm

Are Ecasound and Nama potential options?

Alas no. Ecasound can handle MIDI to control certain effects parameters, but no more. Midish is what I use to record and process MIDI. There were a few other MIDI sequencers on the commandline, but most are so far out-of-date that they don't support ALSA sequencer or JACK MIDI, which is very handy. cuse was an ncurses based sequencer.
I believe there is a Perl package and program midiedit which gives some access to editing notes. And there was another tracker like MIDI sequencer written in Python, which caused some issues due to terminal size. there is ttrk which uses /dev/midi and I think I haven't used.
Csound and other big synthesis environments can handle quite a bit of MIDI, but they require some kind of programming or scripting in their own languages. Very interesting for algorithmic composition or complex generation of modulation or parameter automation.
That's all I can think of in the way of sequencers. There are enough players, one or two filtering and monitoring apps and of course software synthesizers that can run in the terminal.
If you are willing to program to some extent, there are good libraries with a lot of features and "easy" interfaces. There are a few packages in Python, one or two in c++ and possibly other languages, like Perl or Java. RtMidi (and its forks) give you really good access to a lot of MIDI devices (cross platform). On Linux this means ALSA sequencer, JACK MIDI and possibly PortMidi. Just looking at ArchLinux's package repositories I see plenty of Python libraries, anything from reading/writing MIDI files, general tools, Python bindings to RtMidi and more. Names like pysmf, python-midi, python-rtmidi or miditk-smf...
If anyone knows of more ready-made soltuions to actually sequence and edit MIDI on the commandline, I would be very much interested as well.
Best wishes,
Jeanette

--
distro: ArchLinux, DAW: Nama, MIDI sequencer: Midish
All my latest music on https://www.youtube.com/channel/UCMS4rf ... 7jhC1Jnv7g
Albums, patches and Csound on http://juliencoder.de
User avatar
Linuxmusician01
Established Member
Posts: 1547
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 784 times
Been thanked: 144 times

Re: Command line (Midi) sequencer?

Post by Linuxmusician01 »

jeanette_c wrote: Sat Sep 09, 2023 1:26 pm
alex stone wrote: Sat Sep 09, 2023 12:49 pm

Are Ecasound and Nama potential options?

Alas no. Ecasound can handle MIDI to control certain effects parameters, but no more. Midish is what I use to record and process MIDI. There were a few other MIDI sequencers on the commandline, but most are so far out-of-date that they don't support ALSA sequencer or JACK MIDI, which is very handy. cuse was an ncurses based sequencer.
I believe there is a Perl package and program midiedit which gives some access to editing notes. And there was another tracker like MIDI sequencer written in Python, which caused some issues due to terminal size. there is ttrk which uses /dev/midi and I think I haven't used.
Csound and other big synthesis environments can handle quite a bit of MIDI, but they require some kind of programming or scripting in their own languages. Very interesting for algorithmic composition or complex generation of modulation or parameter automation.
That's all I can think of in the way of sequencers. There are enough players, one or two filtering and monitoring apps and of course software synthesizers that can run in the terminal.
If you are willing to program to some extent, there are good libraries with a lot of features and "easy" interfaces. There are a few packages in Python, one or two in c++ and possibly other languages, like Perl or Java. RtMidi (and its forks) give you really good access to a lot of MIDI devices (cross platform). On Linux this means ALSA sequencer, JACK MIDI and possibly PortMidi. Just looking at ArchLinux's package repositories I see plenty of Python libraries, anything from reading/writing MIDI files, general tools, Python bindings to RtMidi and more. Names like pysmf, python-midi, python-rtmidi or miditk-smf...
If anyone knows of more ready-made soltuions to actually sequence and edit MIDI on the commandline, I would be very much interested as well.
Best wishes,
Jeanette

Hmmmmm. Midish might be interesting. :) Are there any quick start guides/tutorials? The manual is quite comprehensive.

jeanette_c
Established Member
Posts: 730
Joined: Tue May 12, 2020 5:53 pm
Has thanked: 347 times
Been thanked: 270 times

Re: Command line (Midi) sequencer?

Post by jeanette_c »

Hi @Linuxmusician01 , I don't know of much in the way of tutorials. If you are interested, you migith be interested in my extra commands:
http://juliencoder.de/test/sound/jbs_mi ... .8.tar.bz2
At the end of your ~/.midishrc add:
exec "/path/to/your/user_dir/.midish_extra";
At the top of that file you need to make your device setup, which is outlined in the manual. My setup has lines like these, using ALSA sequencer:
dnew 0 "20:0" rw # use sequencer port 20:0 in read/write or i/o mode
dnew 1 "Prophet 12 Keyboard" rw # use the ALSA sequencer port of that name for read/write input/output
To add more USB MIDI gear that you sometimes want and sometimes not, you could have a procedure like that in your .midishrc:
proc add_burte {
dnew 4 "Arturia MiniBrute 2S" rw;
inew brute {4 0}; # named input channel
onew brute {4 0}; # named output channel
dclktx [dlist]; # make sure clock is sent to all devices
}
These inew and onew commands are good ones to put in your .midishrc, so you can create named channels. That way you can address your synths' MIDI channels by name and not by numbers like {4 0} or {0 12}. Much more usable.
If you have further questions, please feel free to ask, either right here or via PM.
Best wishes, Jeanette

--
distro: ArchLinux, DAW: Nama, MIDI sequencer: Midish
All my latest music on https://www.youtube.com/channel/UCMS4rf ... 7jhC1Jnv7g
Albums, patches and Csound on http://juliencoder.de
Post Reply