3

I am on Linux, using a custom program generating MIDI events, which are interpreted and played by a synth connected to my PC via USB cable. Since this program is interactive and does not allow saving MIDI files, is there any tool to intercept MIDI raw data on the USB cable and save it in .MID file format?

I have tried arecordmidi(1) with the correct port, but I get:

Cannot connect to port 24:0 - Resource temporarily unavailable

It looks like there is concurrency problem here: if one program is writing to raw MIDI ports, another one can't read.

2 Answers 2

3

In Linux, sequencer ports can be shared, but raw MIDI ports are exclusive.

As a workaround, load the snd-virmidi module to create a virtual raw MIDI port, tell that program to use it, and connect the corresponding sequencer port to the actual hardware output (with aconnect). That virtual port can then also be used by arecordmidi.

1

It‘s hard to imagine a midi sequencer program that can‘t save midi files ...

As you don‘t tell the name of that program it is not quite easy to help.

Some programs and synthesizers have a midi-through option or channel. Check this out.

If your sinthi has a record function it can probably save your music (to a limited length). When you play back a piece by the keyboard your other program you use should be able to save the midi-in data. But why don‘t you simply download another free sequenzer software and try this out.

Ardour: It is available on Linux and Mac OS X and allows you to record, edit, mix and master audio and MIDI projects. It can be used by musicians, soundtrack editors and composers.

Ardour has some of the following features:

Flexible recording. Unlimited multichannel tracks. Importing and exporting audio files of different formats. Extensible through plug-ins and In-line plug-in control . Automation and many more.

https://www.tecmint.com/free-music-creation-or-audio-editing-softwares-for-linux/

2
  • I wrote the program and prefer to use that because of a peculiar music notation I use. I think I better add support for MIDI file generation using the portsmf library. I am lazy and thought a sort of routing from row MIDI interface to MIDI synth port was possible. It looks like this is a limitation of ALSA, isn't it? My synth only allows to record what you play and in proprietary format. Commented Feb 9, 2019 at 14:52
  • @AntonioBonifati'Farmboy' It would be a good idea to add ALSA sequencer support to your program.
    – CL.
    Commented Feb 9, 2019 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.