Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#60 sox output to ALSA pulse device hangs

closed-fixed
nobody
None
5
2007-01-25
2007-01-20
Thomas Zajic
No

[ This bug is connected to PulseAudio (successor to polypaudio), which you may or may not have heard about: http://pulseaudio.org/. The 'padsp' utility mentioned in the report is similar in its purpose to 'esddsp' (Esound), 'aoss' (ALSA) and 'artsdsp' (ARTS) - it captures OSS calls to /dev/dsp and handles it internally. ]

While sox works fine with both OSS/padsp ('padsp sox -t wav some.wav -t ossdsp /dev/dsp') and "real" ALSA devices ('sox -t wav some.wav -t alsa hw:0'), ALSA output to pulse doesn't work at all ('sox -t wav some.wav -t alsa pulse'). In the latter case, sox just hangs, hogs the CPU, and can't be terminated with Ctrl-C. The only way to get rid of it is to 'kill -KILL' it from another terminal.

This affects, for example, audio preview in GNOME's Nautilus. Audio preview is effectively done by piping the audio file to be previewed to 'play'. Do this for a few times, and you'll be left with a bunch of rogue sox processes hogging the CPU, and no audio preview.

I'll also file bug reports with PulseAudio and ALSA, just to be on the safe side. Somehow I actually don't suspect sox itself to be the culprit, though, because it works fine whenever only either one of ALSA or PulseAudio is involved (OSS + padsp, ALSA + any other device than pulse), but breaks when both are (ALSA + pulse device).

PS: I temporarily fixed the problem myself by simply patching 'play', I'll attach the patch here just in case someone else gets bitten by the same bug.

Discussion

  • Thomas Zajic
    Thomas Zajic
    2007-01-20

    patch to force 'play' to use OSS/padsp with pulse

     
    Attachments
  • Reuben Thomas
    Reuben Thomas
    2007-01-25

    Logged In: YES
    user_id=50145
    Originator: NO

    I can't repro this bug.

    First, I spent ages trying to get pulseaudio to work with ALSA. In the end, it seemed to need configuration on the ALSA side; I used the following ~/.asoundrc:

    pcm.!default {
    type pulse
    }

    ctl.!default {
    type pulse
    }

    Then I could get it to work by using the ALSA device "default". After this, the command you gave worked fine. I am using pulseaudio 0.9.4 from Debian etch; I'm aware it's not the latest version.

     
  • Reuben Thomas
    Reuben Thomas
    2007-01-25

    Logged In: YES
    user_id=50145
    Originator: NO

    I should add I'm using sox CVS; it has a lot of changes relative to the latest release.

     
  • Thomas Zajic
    Thomas Zajic
    2007-01-25

    Logged In: YES
    user_id=150806
    Originator: YES

    I went through http://pulseaudio.org/wiki/PerfectSetup, so I have the same entries in /etc/asound.conf. With these entries, using "default" or "pulse" should amount to the same.

    Anyway, I also just tried the CVS version, and indeed the problem is gone. Running 'sox -t wav some.wav -t alsa pulse' doesn't hang anymore, and plays the file just fine. Seems like it was a sox bug, after all. Thanks!

     
  • Reuben Thomas
    Reuben Thomas
    2007-01-25

    • status: open --> closed-fixed
     
  • Reuben Thomas
    Reuben Thomas
    2007-01-25

    Logged In: YES
    user_id=50145
    Originator: NO

    Fixed.