I try to run a game under dosbox, but it has no sound, and in the terminal dosbox says:

MIXER:Can't open audio: No available audio device , running in nosound mode.
ALSA:Can't subscribe to MIDI port (65:0) nor (17:0)
MIDI:Opened device:none

Update

I changed the ports to 128:0 in the dosbox config file and now it says

ALSA:Client initialised [128:0]
MIDI:Opened device:alsa

but still no sound :(


Solution 1:

Turns out the sounds of the game were muted from the game's own options menu. Changing the MIDI port to 128:0 was still needed though, to enable dosbox's sound.

Solution 2:

I tried to play The Lost Vikings using dosbox and got no sound (NB: Using NixOS, not Ubuntu)

My system listed port 14 as midi

$ pmidi -l
 Port     Client name                       Port name
 14:0     Midi Through                      Midi Through Port-0

But playing a midi using the port did not work :(

$ wget http://www.angelfire.com/fl/herky/images/teddybear.mid
$ pmidi -p 14:0 teddybear.mid
<silence>

Installing timidity and running the server

$ timidity -iA
...

$ pmidi -l
 Port     Client name                       Port name
 14:0     Midi Through                      Midi Through Port-0
129:0     TiMidity                          TiMidity port 0
129:1     TiMidity                          TiMidity port 1
129:2     TiMidity                          TiMidity port 2
129:3     TiMidity                          TiMidity port 3

$ pmidi -p 14:0 teddybear.mid
<sound playing>

Changing midiconfig to 129:0 in dosbox.conf

[midi]
mpu401=intelligent
mididevice=default
midiconfig=129:0

Running the game and we have sound!

Note:to nixos users - I enabled sound.enable=true; but I haven't tested if it was necessary

Solution 3:

The following solution found on the net is somewhat old but since the problem is the same it might still be valid.

Quote:

You need to tell SDL (which is what DOSBox is built on) to use PulseAudio, type export SDL_AUDIODRIVER=pulse in a console window, then start DOSBox from the same window by typing dosbox.

Source: http://www.herikstad.net/2009/04/dosbox-and-ubuntu-904-jaunty.html

Solution 4:

Solution to the sound problem: if you still have problems getting the sound to work on dosbox 0.74 or any other version, first of all do the things the comments above states, and do them from scratch, I mean everything from directory to installation. And last CHANGE THE SOUND IN GAME FROM DOSBOX, usually theres a "setsound,exe" file or similar, access it:

c mount /home/yourname/yourdosfolder
c:
cd yourgame
yourgame
setsound.exe

(ALWAYS START DOSBOX FROM TERMINAL)

Listen folks, I recently installed Ubuntu 11.04, hence first time ever using Linux, after a week of crashes and bugs, and so on, I finally got it working fine, and I'm loving it, it was all worthwhile for the cause - open source. And now It's all exlusive on my laptop, but man I tell you it was difficult installing and running ubuntu as the only OS, I do not recommend such attempts, but if you have several pc's around then by all mean D

Solution 5:

I find that before running some programs on Ubuntu 18.04, I need to open the sound settings and choose the correct output device.

Ubuntu never remembers my selection between reboots (always defaulting to "Digital Output AT2020USB" (the audio monitor on my mic!) and I have to manually choose "Line Out".

However, it's as if it remembers the setting per program, so that next time I run the program, it will actually work correctly without me taking any extra steps as above.

This applied to DosBox too.