You are not logged in.

#1 2010-01-01 02:17:26

drandre
Member
Registered: 2009-04-16
Posts: 35

[SOLVED] midi and audio playback interfere with each other?

Hi, thanks for reading...

I've recently installed tux guitar and have been trying to use it together with an audio player (vlc player).  However I am only able to get one of these applications generating sound at any one time.

If I load up a tab file and play it (using midi) from tuxguitar I find I am no longer able to play audio files in vlc player or rhythmbox. 

After quiting tux guitar I can play audio again.  But I can never get them both to work at the same time.  (Really I just want to switch between applications without having to quit one to use the other.)

Any advice on how to start debugging this would be greately appreciated.  hmm

Last edited by drandre (2010-01-04 21:32:48)

Offline

#2 2010-01-02 04:07:39

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Nobody got any clues? 

I had thought that ALSA/Dmix would have let this happen.

Offline

#3 2010-01-02 04:53:33

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] midi and audio playback interfere with each other?

You're probably playing audio through ALSA's emulation of OSS, which means that dmix won't work. You need to output to *ALSA*.

Offline

#4 2010-01-02 05:11:26

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] midi and audio playback interfere with each other?

brebs wrote:

You're probably playing audio through ALSA's emulation of OSS, which means that dmix won't work. You need to output to *ALSA*.

I just tested it out myself. First, I experienced the same problem that you did. Mplayer wasn't able to play any audio because is said the sound device was locked or in use or something silly. In Tux Guitar, I disabled the JACK and OSS plugins (and a lot of other plugins) tongue and changed the sound settings to "TuxGuitar Sequencer" and MIDI Port "TiMidity port 0 [128:0]. (I have timidity setup as my MIDI "hardware", like it is described in the Arch wiki) After that (and rebooting), I was able to play a TAB file and an MP3 in mplayer at the same time. big_smile

Let me know if you have any questions about what I did.

DISCLAIMER: This was a simple test. I don't use (or know how to use) Tux Guitar. tongue

Offline

#5 2010-01-03 11:12:55

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Thanks drcouzelis, I was trying to get timidity going when I made this post.  It doesn't work for me and I'm not sure why:

sudo /etc/rc.d/timidity++ start
:: Starting Timidity++ ALSA Daemon                                       [BUSY] Couldn't open output device
                                                                         [FAIL]

timidity /home/andrew/arch/Downloads/teddybear.mid
Couldn't open output device

I don't believe this is a permissions issue.  It's good to know it works for you at least.  I have fairly basic audio hardware though (laptop integrated intel).  I hope that isn't a stopper.

Offline

#6 2010-01-03 21:10:38

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] midi and audio playback interfere with each other?

Well, just focus on getting Timidity to play, using the "timidity song.mid" command. If you can get that to work, then the daemon should work just fine.

I'm surprised the error message doesn't say which output device it can't open. These kinds of problem are usually fixed for me simply by rebooting. I wish I could figure out how to "unlock" a "locked" audio device by using the command line. Maybe someone else can enlighten me. big_smile

If a reboot doesn't work, you try to narrow down your problem by selecting a Timidity output device.

timidity -Os # ALSA output
timidity -Od # DSP output, probably emulated by ALSA

Offline

#7 2010-01-04 03:07:51

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] midi and audio playback interfere with each other?

drcouzelis wrote:

I wish I could figure out how to "unlock" a "locked" audio device by using the command line.

Can't. Because ALSA's emulation of OSS bypasses dmix.

The obvious solution here, that's been the same for many years, is to *stop* using OSS. Output to ALSA, rather than /dev/dsp.

Offline

#8 2010-01-04 11:26:30

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Yeah... although I'd not suggest that this solution is "obvious".  So many programs contain different backends which in turn use different low level interfaces.  It is anything but obvious :-(

timidity outputs via the audio device by default, this doesn work for me (/dev/dsp: Device or resource busy). 
Nor does ALSA (ALSA lib pcm_dmix.c:1010:(snd_pcm_dmix_open) unable to open slave).  But now it gets truly evil: specifying output to ARTS produces no error message and no sound  - just like tux guitar (right at this moment).

FWIW I'm running KDE 4.3.4 from the chakra project.  In my KDE settings I'm using the Xine backend.  No idea what Xine is using however... I expect alsa but I'm not sure how to find out.  I notice some entries in the system logs from pulseaudio... but its disabled in my rc.conf :-!  Deleting reference to pulseaudio; Rebooting...

Hey - timidity is now working with alsa and now I can use vlc player and tux guitar together.  But I have no sound from rhythmbox :-(

Last edited by drandre (2010-01-04 11:40:05)

Offline

#9 2010-01-04 11:45:23

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] midi and audio playback interfere with each other?

Take a look:

fuser -v /dev/snd/* /dev/dsp*

Distros are pretty stupid in not patching programs like timidity to use ALSA by *default*. Taking a look at Fedora, its timidity contains TiMidity++-2.13.2-libao-first.patch, which defaults to pulseaudio. Ho hum, they get half a point for trying, although pulseaudio should have been thrown out of the distro sad

Offline

#10 2010-01-04 13:32:59

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

fuser -v /dev/snd/* /dev/dsp*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  andrew     2238 F.... pulseaudio
                     andrew    12344 F.... kmix
/dev/snd/pcmC0D0p:   andrew    12295 F...m knotify4
/dev/snd/timer:      andrew    12295 f.... knotify4

I just have no idea where pulseaudio is coming from; if I try and restart it, the restart fails.

Offline

#11 2010-01-04 21:32:23

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Solution... for whatever reason, the gnome music players were using "autoaudiosink" for their sound output.  For whatever reason, auto is not working for me (possibly because I installed pulseaudio but didn't bother to follow any wiki configuration instructions because it seemed to be working automagically). 

To add to the confution, the gnome music players do not use the gnome "audiosink" property so even setting the default audiosink to alsa using gstramer-properties does nothing to help.  To force the gnome music players to use alsa you need to use:

gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink alsasink

as documented indirectly in the related wiki page http://wiki.archlinux.org/index.php/Pul … PulseAudio

No need for restarts, everything plays nicely together now.  The only question that remains in my mind is why pulseaudio exists.  Any

Offline

#12 2010-01-05 05:25:12

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [SOLVED] midi and audio playback interfere with each other?

It exists because you've installed it. Automagically is not a nice word in Arch smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#13 2010-01-05 11:43:15

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Hah... yes arch can be hard work :-)

BTW I meant exists as in "the big why"... It was "installed" because I installed it ;-)

I did find this page today (http://0pointer.de/blog/projects/guide- … -apis.html) which goes some of the way

Offline

#14 2010-01-05 22:37:52

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [SOLVED] midi and audio playback interfere with each other?

Well, the answer is simple, like any other open-source project, it exists because:-
a) Someone was willing to write it and maintain it
b) Many someones saw the need and used it

There's also a (c) - Someone was willing to pay for it.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#15 2010-01-06 12:45:22

drandre
Member
Registered: 2009-04-16
Posts: 35

Re: [SOLVED] midi and audio playback interfere with each other?

Sigh... maybe I can put it this way: I don't understand the need; I uninstalled it; everything still works (or works better).

Please don't give me OSS 101s I've been using linux for over 20 years now.

Thanks everyone for the help solving this one.  Now I can get on with some tabbing.

Offline

#16 2010-01-07 02:42:03

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [SOLVED] midi and audio playback interfere with each other?

Fair enough, it's your system. I'm surprised someone who's been using linux for 20 years is still surprised that things change all the time thuogh smile. Have fun tabbing!


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB