You are not logged in.

#1 2026-04-21 17:40:20

emk2203
Member
Registered: 2024-10-17
Posts: 18

How to set up midi play with mpd?

I have a working mpd setup which plays normal files (mp3, ogx, flac etc) just fine.

I have installed timidity and a soundfont, timidity plays midi files without issues on this system.

My mpd.conf contains

input {
        plugin          "wildmidi"
#       sample_rate     "44100"
#       soundfont       "/usr/share/soundfonts/FluidR3_GM.sf2"
        config_file     "/etc/timidity/timidity.cfg"
}                                   


audio_output {
        type          "alsa"
        name          "HDA Intel PCH"
        # Optional
        # device        "iec958:CARD=0,DEV=0"
        #mixer_control "PCM"
}

When I try to play midi files from mpd, they seem to play, but there is always silence. I tried fluidsynth, but it's the same.

What do I need to change here to make the midi files audible also from mpd? The setup works when I play midi files manually via timidiity, so by exclusion, my ALSA setup and the timidiity setup should be fine.

Offline

#2 2026-04-21 19:20:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Offline

#3 2026-04-23 06:50:32

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

Correct, but this didn't resolve the issue. I keep this open until I resolve it or stop working on it.

Offline

#4 2026-04-23 07:32:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: How to set up midi play with mpd?

timidity plays midi files without issues on this system

And does /usr/bin/wildmidi?
Fix the config, run "mpd -k; mpd --verbose --no-daemon" and try to play some midi file - maybe that tells us what's wrong.

Offline

#5 2026-04-23 17:04:07

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

seth wrote:

timidity plays midi files without issues on this system

And does /usr/bin/wildmidi?
Fix the config, run "mpd -k; mpd --verbose --no-daemon" and try to play some midi file - maybe that tells us what's wrong.

Neither wildmidi nor fluidsynth, the other decoder option for mpd, play audible files via the CLI. Only timidity does.

For me, this looks less like a mpd issue and more like some config issue with my ALSA setup.

I admit I am currently at a loss how to debug this further. Is there a way to review and test my alsa setup in regards to playing midi?

I also tested playing a mp3 vs a midi file while logging with mpd, but for mpd, it looks like everything plays normally. I could post this log as well if needed.

I posted them and some more of my configs at the discussion forum of mpd. So far, no answer, but since this has nothing to do with mpd but with the midi setup, I won't expect a solution there.

Last edited by emk2203 (2026-04-23 17:15:29)

Offline

#6 2026-04-23 20:07:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: How to set up midi play with mpd?

Neither wildmidi nor fluidsynth, the other decoder option for mpd, play audible files via the CLI

Ok, focus on that.
https://man.archlinux.org/man/wildmidi.1
I assume you're using some sound daemon (pipewire)?
Do you have https://archlinux.org/packages/extra/x8 … wire-alsa/ ?

In doubt stop resp. mask the sound daemon (or uninstall it if you will/can) and see whether that makes wildmidi produce any sound.

Offline

#7 2026-04-25 17:58:29

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

I tried to get wildmidi to produce sound from the CLI, but it stayed silent. Activities reported on the mpd forum linked above. Regarding pipewire, when I do systemctl --user list-unit-files | grep pipewire, I get

pipewire-pulse.service                 disabled enabled
pipewire-session-manager.service       alias    -
pipewire.service                       disabled enabled
pipewire-pulse.socket                  enabled  enabled
pipewire.socket                  enabled  enabled

Is this sufficient? pipewire, pipewire-pulse are disabled, but the sockets are enabled.

Offline

#8 2026-04-25 19:05:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: How to set up midi play with mpd?

pipewire is socket activated

systemctl --user status pipewire wireplumber

Offline

#9 2026-04-27 09:29:01

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

systemctl --user status pipewire wireplumber

○ pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; preset: enabled)
     Active: inactive (dead)
TriggeredBy: ● pipewire.socket

○ wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; preset: enabled)
     Active: inactive (dead)

I have now masked both units:

systemctl --user status pipewire wireplumber
○ pipewire.service
     Loaded: masked (Reason: Unit pipewire.service is masked.)
     Active: inactive (dead)
TriggeredBy: ○ pipewire.socket

○ wireplumber.service
     Loaded: masked (Reason: Unit wireplumber.service is masked.)
     Active: inactive (dead)

Unfortunately, that didn't help. mpd and mpg123 (and timidity) play audible files, wildmidi and fluidsynth don't.

Could somebody please post a working wildmidi.cfg and/or /etc/conf.d/fluidsynth? I took what I could get from the net, wildmidis source and all other places I could find, but I simply can't get one of these two to play.

Last edited by emk2203 (2026-04-27 16:49:02)

Offline

#10 2026-04-27 17:16:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: How to set up midi play with mpd?

https://wiki.archlinux.org/title/Systemd#Using_units but you need to mask the pipewire.socket

Offline

#11 2026-04-27 18:30:43

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,191

Re: How to set up midi play with mpd?

I have a working fluidsynth config but I'm not sure whether mpd actually uses that and doesn't just convert it internally using the respective libs. But I do actively use pipewire and what works here is

# Mandatory parameters (uncomment and edit)
SOUND_FONT=/usr/share/soundfonts/FluidR3_GM.sf2

# Additional optional parameters (may be useful, see 'man fluidsynth' for further info)
OTHER_OPTS='-a pulseaudio -m alsa_seq -r 48000'

you can afaik as of newer fluidsynth version also use pipewire directly for -a but it doesn't really matter in practice. But this will only work if you use

systemctl --user start fluidsynth

and then you can e.g. aplaymidi to play back a midi file to the fluidsynth server. Afaik for MPD all that would be required is configuring the decoder plugin with the soundfont path. Haven't used mpd in a while, let me check.

Edit: went and checked

decoder {
        plugin "fluidsynth"
        soundfont "/usr/share/soundfonts/FluidR3_GM.sf2"
}

audio_output {
	type		"pulse"
	name		"My Pulse Output"
}

works just fine here.

How exactly are you invoking the corresponding standalone tools and while "no audio" what do you get from

sudo fuser -v /dev/snd/*
aplay -l
aplaymidi -l

FWIW does /usr/share/soundfonts/FluidR3_GM.sf2 even exist? did you install soundfont-fluid?

Last edited by V1del (2026-04-28 08:04:17)

Offline

#12 2026-04-28 09:24:06

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

To get the last questions out of the way, yes and yes.

My /etc/conf.d/fluidsynth looks like this:

# Mandatory parameters (uncomment and edit)
SOUND_FONT=/usr/share/soundfonts/FluidR3_GM.sf2

# Additional optional parameters (may be useful, see 'man fluidsynth' for further info)
OTHER_OPTS='-a alsa -m alsa_seq -r 44100'

and after I start the demon with systemctl --user start fluidsynth, I can use aplaymidi to play songs and hear them over the speakers. But: aplaymidi needs  a port.. A standalone aplaymidi song.mid throws an error: "Please specify at least one port with --port."

aplaymidi -l shows

 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0

and I can play the files with aplaymidi -p 14:0 song.mid.

Could this be the issue? The 'silent' programs need a port defined as default somewhere?

My relevant part of the mpd.conf is

decoder {
        plugin          "fluidsynth"
#       sample_rate     "44100"
        soundfont       "/usr/share/soundfonts/FluidR3_GM.sf2"
#       config_file     "/etc/timidity/timidity.cfg"
}                                   

audio_output {
        type          "alsa"
        name          "PCH"
        # Optional
        device        "iec958"
        mixer_control "PCM"
}

and these are the outputs of the command you mentioned:

mpc add _Transit/soihdut.mid; mpc play

# this is now playing a 'silent' midi file

_Transit/soihdut.mid
[playing] #1/1   0:00/1:30 (0%)
volume:100%   repeat: off   random: off   single: off   consume: off

# check with `mpc`

_Transit/soihdut.mid
[playing] #1/1   0:03/1:30 (3%)
volume:100%   repeat: off   random: off   single: off   consume: off

# first command with output
sudo fuser -v /dev/snd/*

                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  emk2203        711 F.... mpd
/dev/snd/pcmC0D1p:   emk2203        711 F...m mpd

# second command with output
aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC283 Digital [ALC283 Digital]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# third command with output
aplaymidi -l

 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0

These outputs stay the same, regardless if midi (silent) or other (audible) plays.

systemctl --user status mpd doesn't show anything noteworthy:

Apr 28 11:11:22 NUC6CAYH mpd[711]: player: played "_Transit/soihdut.mid"
Apr 28 11:13:09 NUC6CAYH mpd[711]: player: played "_Transit/soihdut.mid"

Last edited by emk2203 (2026-04-28 09:25:53)

Offline

#13 2026-05-04 11:59:56

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,191

Re: How to set up midi play with mpd?

The port distinction "should" only be relevant for applications that expect to play to a port like aplaymidi (if you run fluidsynth in daemon mode with e.g.

systemctl --user start fluidsynth

aplaymidi -l should list fluidsynth on the "default" port 128 at which point aplaymidi should be able to send midi files there), mpd should not care since it will do the midi to PCM transformation internally...

Could it be the midi files themselves, can you reproduce with some known "good" midi files? Ultimately midi files are a collection of "notes" for certain "instruments" played at a specific time, they don't contain any actual audio. if the instruments defined in your midi file are not part of the fluid soundfonts they can well remain silent, despite everything  loading correctly. And then it can make sense that only timidity works because that is the only thing that will default to freepats. Does fluidsynth work if you configure the soundfont property to /usr/share/soundfonts/freepats-general-midi.sf2

Last edited by V1del (2026-05-04 12:00:47)

Offline

#14 2026-05-05 05:23:22

emk2203
Member
Registered: 2024-10-17
Posts: 18

Re: How to set up midi play with mpd?

V1del wrote:

The port distinction "should" only be relevant for applications that expect to play to a port like aplaymidi (if you run fluidsynth in daemon mode with e.g.

systemctl --user start fluidsynth

aplaymidi -l should list fluidsynth on the "default" port 128 at which point aplaymidi should be able to send midi files there), mpd should not care since it will do the midi to PCM transformation internally...

Yes, this was just a shoot in the dark in the attempt to get to the bottom of it. fluidsynth in demon mode runs as you described.

Could it be the midi files themselves, can you reproduce with some known "good" midi files? Ultimately midi files are a collection of "notes" for certain "instruments" played at a specific time, they don't contain any actual audio. if the instruments defined in your midi file are not part of the fluid soundfonts they can well remain silent, despite everything  loading correctly. And then it can make sense that only timidity works because that is the only thing that will default to freepats. Does fluidsynth work if you configure the soundfont property to /usr/share/soundfonts/freepats-general-midi.sf2

No, this cannot be the issue. I can get fluidsynth to run in demon mode and then play them, audibly:

emk2203 wrote:

and after I start the demon with systemctl --user start fluidsynth, I can use aplaymidi to play songs and hear them over the speakers.

. But with aplaymidi, I always need to define the port with -p 128. Is this different with your setup?

I can also listen to them with

fluidsynth -a pipewire -m alsa_seq -l -i /usr/share/soundfonts/FluidR3_GM.sf2 /srv/media/Music/_Transit/soihdut.mid

As you can see, I unmasked pipewire and wireplumber and tried to copy your setup:

My /etc/conf.d/fluidsynth

# Mandatory parameters (uncomment and edit)
SOUND_FONT=/usr/share/soundfonts/FluidR3_GM.sf2

# Additional optional parameters (may be useful, see 'man fluidsynth' for further info)
OTHER_OPTS='-a pipewire -m alsa_seq -g 1 -r 44100'

Relevant parts of mpd.conf:

decoder {
        plugin          "fluidsynth"
#       sample_rate     "44100"
        soundfont       "/usr/share/soundfonts/FluidR3_GM.sf2"
#       config_file     "/etc/timidity/timidity.cfg"
}                                   

audio_output {
        type            "pipewire"
        name            "Pipewire output"
        # Optional
        #sink            "alsa_output.pci-0000_c1_00.6.analog-stereo"
        target          "alsa_output.pci-0000_00_0e.0.iec958-stereo"
}

Behavior is unchanged, except that I introduced an annoying click at the beginning of each song with pipewire. Midi songs are still muted. Without  the '-g 1' option in the fluidsynth config file, they play at a different volume level than other songs (comparing fluidsynth direct play with mpd play). Maybe that plays a role, mpd just plays them at a volume too low to hear, or muted?

But I am prepared to stop investigating the issue now, and accept that my setup won't play midi files. I can play them directly, that should be good enough for the handful of midi files I have.

Offline

Board footer

Powered by FluxBB