Command-line midi radio

Hello,
I’m trying to port my midi radio (random midi file player) to zynthian.
It is a bash script that can play mid files via fluidsynth or timidity or pmidi (to hear your synths play classical for example).

On zynthian, It can play via pmidi perfectly, but via zynth audio output is more difficult.
I see that timidity isn’t installed, so I try with fluidsynth, but it fails to load a default soundfont in /usr/local/share/soundfonts/default.sf2
I tried making there a link to an existing GM soundfont on zynthian but it still fails.

Any clue, someone ?

zyn_radio.sh (1.2 KB)

Hi @reg - is there any reason not to use the built-in midi player?

I suppose the built-in player is not scriptable and can’t play randomly files in a given folder, via different audio settings and midi. But maybe I’m wrong.

Only ever a feature request (and some luck and hard work) away. :wink:

Ok,
I may do it, thanks.

But in the meanwhile, anybody managed to play a mid file via terminal on zynth ?

I’ll try to install timidity, just for me :slight_smile:

Thanks for fast answer

You could use the Zynthian midi player. It is a python wrapper for a jack client library so you should be able to run it by launching a python interpreter instance. It should be well documented. If you want to use it and get stuck give me a shout. (I’m off to see Elvis Costello now so may not be responsive for rest of the day.)

Thanks,
Well I’m having hard time tring to find unfo on that midi player, found nothing in the wiki, found this on the github but it is C and not python :

Any pointer appreciated :wink:

A feature request would be great. The audio plater that’s in testing involved discussion of playlsts and this seems similar.

:partying_face:

1 Like

The source is in to the Zynthian GitHub repository. Most of the calls are actually directly to the lib rather than Python wrapper functions. Not as well documented as normal though the c header should be good.

Okay - I just took a look at the zynthian smf player and it may prove a bit challenging to use it standalone without some effort due to it interfacing with zynthian’s master clock mechanism.

You can use your script with simple modification.

First you need to provide a soundfont as a parameter to fluidsynth because Zynthian does not store default soundfonts where fluidsynth expects to find them. You also need to route fluidsynth audio outputs, e.g.

sf=/zynthian/zynthian-data/soundfonts/sf2/FluidR3_GM.sf2
fluidsynth -C no -R no -a jack -j $sf $file

‘-j’ option connects fluidsynth audio outputs to system output ports.
Passing the soundfont as an option tells fluidsynth to use that soundfont.