Audacity does not mesh with PulseAudio

Bug #178895 reported by Maia Everett on 2007-12-27
112
This bug affects 6 people
Affects Status Importance Assigned to Milestone
ltsp-cluster
High
Unassigned
audacity (Ubuntu)
Low
Unassigned
Nominated for Jaunty by David Henningsson

Bug Description

Binary package hint: audacity

Currently, Audacity is unable to play or record sound with PulseAudio running. This is important because Hardy has PulseAudio by default.

A workaround is to launch Audacity with padsp and set it up to use /dev/dsp. Does it make sense to use it in the desktop file, or is it too workaround-ish?

Maia Everett (lucidfox) on 2008-01-05
Changed in audacity:
importance: Undecided → Low
Michael Chang (thenewme91) wrote :

At the following page, it's recommended to stop pulseaudio entirely when running audacity...
http://www.pulseaudio.org/wiki/PerfectSetup#Audacity

As far as I can tell, in Gutsy, Audacity uses PortAudio as its audio subsystem, and right now PortAudio doesn't appear to support PulseAudio as a backend. Apparently, somebody started work on such a backend (https://tango.0pointer.de/pipermail/pulseaudio-discuss/2007-November/000890.html) but it's not in active development.

Personally, I've also found that recording from audacity launched via padsp causes crashes on my system when I record audio (although not when I play audio). While I think configuration might be a factor, the fact that few people have been recommending the use of padsp and audacity makes me think that it's not a supported configuration for one reason or another.

Changed in audacity:
status: New → Confirmed

using padsp is better than nothing, it at least allows playing back music (on hardy alpha 6)
with default settings no audio output whatsoever

(cant test recording sadly)

Then we have to solve this until Hardy will be released. As of current state Audacity won't work.

Nick Moffitt (nick-moffitt) wrote :

Wow, this was a very nasty surprise. Audacity is one of those apps like OpenOffice that you tend to hand to Windows people and then show that it works just the same on Linux. It's very disappointing to suddenly lose a program I had relied on.

I have been unable to get padsp to work, as audacity becomes unresponsive the moment I press the play button. This really doesn't appear to be an acceptable workaround.

Nick Moffitt (nick-moffitt) wrote :

When I run "padsp -d audacity somefile" and try to play a selection, I get the following spammed onto my screen thousands of times:

utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=8192, fragstotal=4, bytes=512, fragments=0
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: fragsize=81Expression 'ioctl( stream->playback->fd, SNDCTL_DSP_POST, 0 )' failed in 'src/hostapi/oss/pa_unix_oss.c', line: 1488

The ioctl line happens once I am finally able to hit stop. Is this a bug in padsp or in audacity or both? I'm happy to file this separately elsewhere, but right now I'm unsure where the problem is.

Michael Chang (thenewme91) wrote :

Well, here's a pulseaudio bug from a year ago: http://www.pulseaudio.org/ticket/50 But I don't think the recording problem got solved.

Technically speaking, in terms of an ideal solution, the "bug" should probably be in PortAudio which fails to have a PortAudio backend, as far as I can tell.

However, those error messages, Nick, are probably a result of padsp not performing as expected. (But that may be by design -- it's impossible to emulate mmaped audio through padsp.) Audacity worked just fine with plain ALSA and plain OSS, last I checked on Gutsy.

(Can anybody reconfirm this bug with Hardy?)

Michael Chang (thenewme91) wrote :

correction: ... in PortAudio which fails to have a *PulseAudio* backend ...

Dan McCombs (overridex) wrote :

I can confirm this is still happening in hardy unfortunately :(

P. Mohseni (mohseni) wrote :

I can also confirm the same on hardy.

+1 Hardy

GregorS (gregor-skrt-email) wrote :

Same problem here with Audacity and Second Life beta (voice).

kripken (kripkenstein) wrote :

I have had problems with Audacity and PulseAudio, mainly getting it to play simultaneously with other apps like Firefox. It seems however that changing the device in Audacity from ALSA to PulseAudio makes it work.

It seems my experience differs from other bugreporters here.

GregorS (gregor-skrt-email) wrote :

I don't even have option to change device to Pulseaudio. I wonder which version of Audacity do you use kripkenstein .

kripken (kripkenstein) wrote :

GregorS: I'm using Audacious from the Hardy repos. It says it is version 1.5.

Michael Chang (thenewme91) wrote :

kripkenstein: By "works", do you mean:
1) Plays audio.
2) Records audio.
3) Both 1) and 2)

Also, what pulseaudio packages do you have installed? Is there anything regarding libao that is not stock Ubuntu (perhaps a development version)? How are ALSA and Pulseaudio installed/configured? Are you using the Pulseaudio ALSA device?

Also, what kind of "sound card" do you use? (I have "integrated" sound here, using the snd_intel8x0 module.)

I'm also perplexed -- I don't know of the "Pulseaudio" option of which you speak.

kripken (kripkenstein) wrote :

Oops, it seems I made a big, embarrassing mistake... I was confused between audacity and audacious. I thought this bug was about audacious :(

A thousand apologies...

Jeece (caronjc) wrote :

Hello,

I can confirm that for me Audacity is able to to plays audio, record audio and both at the same time, and also while playing audio in a Pulsaudio aware application like Totem.

On my hardware Audacity looks like he does not care about Pulseaudio. I mean that while playing audio with Audacity the stream does not appear in Pulsaudio volume control.

Pulsaudio stay able to increase or decrease the volume on output/input devices while playing and/or recording audio with Audacity.

One more information I can still play audio from flash application while playing audio in a Pulsaudio aware application like Totem. But like audacity the stream does not appear in Pulsaudio volume control.

So my thinking is that my hardware permit both Alsa direct access and Pulsaudio access.

My sound card is a Sound Blaster Audigy 4 Pro.

Anyway all audio libraries will support Pulseaudio somedays. But IMHO it is not really the Ubuntu dev team job.

lshw output :
*-multimedia
   description: Multimedia audio controller
   product: SB Audigy
   vendor: Creative Labs
   physical id: 8
   bus info: pci@0000:02:08.0
   version: 04
   width: 32 bits
   clock: 33MHz
   capabilities: bus_master cap_list
   configuration: driver=EMU10K1_Audigy latency=64 maxlatency=20 mingnt=2 module=snd_emu10k1

lspci -v output :
02:08.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)
 Subsystem: Creative Labs Unknown device 2007
 Flags: bus master, medium devsel, latency 64, IRQ 22
 I/O ports at 9c00 [size=64]
 Capabilities: <access denied>

Confirming it is still happening, audacity is unable to play audio with pulseaudio.

wvarner (winshipvarner) wrote :

I've unfortunately had to work around this bug by installing the windows version through wine! Not ideal!

Jamin W. Collins (jcollins) wrote :

@Jeece: The SB Audigy supports HWMIX which should allow you to bypass the problems most others will experience with only a single application being able to access the sound device at a time.

I too can confirm that this bug is still present in Hardy, and extremely annoying.

Jamin W. Collins (jcollins) wrote :

Until PortAudio fully supports PulseAudio, perhaps the default Gnome application launcher should be updated to suspend PulseAudio on Audacity startup:

pasuspender -- audacity

As documented here: http://www.pulseaudio.org/wiki/PerfectSetup#Audacity

Stephen Irons (stephen-irons) wrote :

Using pasuspender works for me -- if a PulseAudio application is already playing (eg Totem or Rhythmbox), then it stops while Audacity is running and automatically starts again when Audacity ends. Great.

However, it does not solve the problem of bug 202791 or 231651, in which Audacity cannot open the sound device. I think the problem there is related to JACK.

Audacity supports lots of different sound drivers: OSS, ALSA and in the new version, also JACK. When Audacity starts up, it automatically starts jackd, the JACK daemon with a bunch of standard settings: 48000 samples per second using the default ALSA sound device.

So JACK has grabbed the sound device, meaning that neither ALSA nor OSS can use it, and you get 'cannot open device' error.

The further problem is that JACK can ONLY work at its configured sample rate, so if your Audacity project is anything other than 48000, it will not play, but gives the 'cannot open device' error.

So you have a few options:

1. Change the Audacity project sample rate to the JACK sample rate (default 48000)
2. Change the JACK sample rate to match your Audacity project rate
3. Disable JACK and use ALSA or OSS for audio input and output.

1. is easy to do. However, you have to have JACK configured correctly, especially if you have an older PC, otherwise you will get clicks and noises, caused by JACK 'xruns'.

To change the JACK configuration, you need to have a file /etc/jackdrc (a system wide setting that overrides the jackd built in settings) or ~/.jackdrc (a per-user setting that overrides the built-in defaults and /etc/jackdrc).

To change the JACK sample rate, create a file called /etc/jackdrc or ~/.jackdrc containing the one line:

/usr/bin/jackd -R -T -d alsa -d hw:0 -r 48000 -p 128 -n 3

The number following the -r sets the sample rate. man jackd will get more details about the other options.

There are two ways to disable jackd: you can either prevent jackd from starting at all, or you can make jackd use a dummy sound card.

To prevent jackd from starting, ensure that /etc/jackdrc or ~/.jackdrc contains an illegal command: my jackdrc contains the line:
#/usr/bin/jackd -R -T -d alsa -d hw:0 -r 48000 -p 128 -n 3

Then, in Audacity you will have access to all your ALSA and OSS sound devices, and there will be no JACK device.

To make jackd use a dummy sound card, /etc/jackdrc or ~/.jackdrc should contain the line:
/usr/bin/jackd -T -d dummy -C 2 -P 2 -r 48000 -p 128

This makes JACK pretend to have a sound card with two inputs (-C 2) and two outputs (-P 2) running at 48000 samples per second.

Then in Audacity you will have access to all your ALSA and OSS sound devices, and there will be a JACK device. It will be set to 48000 samples per second and, if your Audacity project sample rate matches this, then you can play and record from this device. Of course, you will not actually hear anything...

rizitis (elahistos) wrote :

sorry but my English are not so good, so if you cant understand what I will write ,please see the video http://www.divshare.com/download/5232167-863

I have ubuntu studio 2.6.24-19-rt
I cant work audacity , I only can when I delete the secrets files, but if I close audacity and open it I have to delete again the secret file or it not work.

rizitis (elahistos) wrote :

I am sorry, this video is better and you will see exactly the problem
http://www.divshare.com/download/5264984-a04

Changed in ltsp-cluster:
importance: Undecided → High
status: New → Triaged
David Rahrer (david-rahrer) wrote :

+1 for the original issue on Hardy.

Stefan Nagy (stefan-nagy) wrote :

I can confirm that bug on Hardy.

In my opinion it's very confusing that there is no seperate bug-report about the problem with JACK (at least I coudn't find it). Maybe someone could write one (or post the link here).

mikekchar (mikekchar) wrote :

I agree with Stefan, but I don't know enough about the process here to make the decision to make a new bug.

Stephen Irons's description is exactly right (at least for my problem). I don't know if it is related to the original bug or not. Probably it should be its own bug since it happens with or without PulseAudio (I don't have PulseAudio installed on my box). Incidently, the problem seems to be known upstream:

http://audacityteam.org/forum/viewtopic.php?f=18&t=128

but I don't think anything has been done about it.

From my perspective, jackd should *not* be run by audacity if jack has not been selected as a device. If the user changes from jackd to another device, then jackd should be killed if it was started from audactiy. If it was not started from audacity, it should tell the user to stop the demon before it tries (and fails) to open the device. If audacity starts jackd there should be a way of setting the sample rate in audacity. It also should not let the user pick sample rates that aren't available.

So lots of small bugs working together to create the situation where anyone with jackd installed almost certainly won't be able to use audacity (which is ironic given that jackd is the preferred method).

Michael Chang (thenewme91) wrote :

As far as I can see, the issue with jackd should be a separate bug with a separate title and description.

David Henningsson (diwic) wrote :

This is about the original bug; related to PulseAudio. Kevin Kofler has developed a patch that allows Audacity to use non-mmap devices, such as Pulseaudio, as its backend. I've tested this patch, adjusted it slightly, and packaged it for Ubuntu 8.10.

If you like to try it, the simplest way is to install the patched version from my ppa:
https://launchpad.net/~diwic/+archive
If you'll prefer building it yourself, use the patch attached to this message (the file should be put in debian/patches subdirectory).

Notes about this patch:
- If the device "Alsa: pulse" was not there before (under Edit->preferences), it should be there now (for both playback and recording).
- If playback stutters, try to increase the latency and see if that helps.
- Disclaimer: This is not an official Ubuntu patch (yet!), and it has not been widely tested. If it does not work; blame me, not Ubuntu. ;-)

David Henningsson, your PPA works very well for me. The "alsa: pulse" option is there, and selecting it means input and output successfully goes through pulseaudio, ie appear as streams in the pulseaudio tools.

I didnt experience any stuttering, with buffer at 100 milliseconds, and latency correction at 0. And of course, better to at least have the option to go through pulse than not.

Thanks

Pablo Estigarribia (pablodav) wrote :

David, It works!!!!!!!!!
It's amazing, I though that I have to wait lot of time to get some solution for this!

Now I can install pulseaudio to my brothers and also Interpid!!!!!

Do you know if it's possible to install this version of audacity on Ubuntu 64bit?

David Henningsson (diwic) wrote :

Glad that some of you took the time to try it out!

Pablo, I haven't tried the amd64 (or lpia) version myself, but my guess is that if Audacity works without the patch, it will work with the patch as well - there is nothing 32 bit specific about the patch (unless I missed something). So you are encouraged try it out and report back if it worked or if there were any problems.

Pablo Estigarribia (pablodav) wrote :

In AMD64 works for playing with pulse device, but for some reason i can't record with pulse device selected. I just can record with oss or alsa.

Pablo, can you record using the pulse device in gnome-sound-recorder?

You set this in system>preferences>sound>sound capture>PulseAudio Sound Server. The gnome-sound-recorder should then show the "Record from input" listed as "Master" rather than "capture".

btw, i am using AMD64 and all is good.

Pablo Estigarribia (pablodav) wrote :

Josh you are correct, It didn't work on ubuntu AMD64 Livecd, but after install and update Ubuntu Interpid amd64 on my computer this version of Audacity worked perfectly!!!

Thanks!

David Henningsson (diwic) wrote :

Got a mail from Free Ekanyaka today (Debian audacity packager), reporting that the patch is accepted and will be included in his (her?) next upload. So probably this patch will make it into Jaunty automatically.

Changed in audacity:
status: Confirmed → In Progress
Stéphane Graber (stgraber) wrote :

Although it's affecting LTSP's users (as we're relying on pulseaudio for the sound to arrive on the thin client) it's not a LTSP's bug. So I'm removing the ltsp-cluster bugtask.

Btw, thanks for that fix, it works just perfectly.

Changed in ltsp-cluster:
status: Triaged → Invalid
David Henningsson (diwic) wrote :

Okay, now we have 1.3.6-2 in Debian, with the patch applied. Now we should downstream it to Ubuntu, at the very least to Jaunty, but I wouldn't mind having it in Intrepid-backports as well (perhaps after some testing of the new version). I'll keep my fingers crossed that someone who is MOTU is reading this and is willing to assist.

Changed in audacity:
status: In Progress → Fix Committed
Michael Chang (thenewme91) wrote :

Since we're part DebianImportFreeze, a request must be filed for it to be synced into Jaunty. It appears Stéphane Graber has already done this (bug 317254). Users who are watching this bug may also wish to subscribe to bug 317254 so that they can keep track of its status.

David Henningsson (diwic) wrote :

This is now fixed in Jaunty.

Changed in audacity:
status: Fix Committed → Fix Released
David Henningsson (diwic) wrote :

An update for Hardy users: there is now 1.3.5-2 with the patch applied for both Hardy and Intrepid in my PPA now. I haven't tested the Hardy one, but got a report that it was working well.

https://launchpad.net/~diwic/+archive/ppa

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.