User avatar
scruss
Posts: 2419
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Which sound system for reliable Python audio?

Sun Feb 10, 2013 11:43 pm

I'm trying to run Boodler on the Raspberry Pi. It's an open source “soundscape” tool that generates ambient effects.

It needs to be able to talk to a sound system, but in Linux (Raspbian), there are so many to choose from, including OSS, Alsa, Esound, and Pulse. Is there one "this'll just work" sound system that works well with Python? I tried Alsa, and got the Boodler test to work, but shortly after the system hard-locked.

It's a fairly easy build and install, just needing python-dev and your choice of sound system, should anyone wish to try it.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

cae2100
Posts: 143
Joined: Tue Jan 08, 2013 10:35 am
Contact: Website

Re: Which sound system for reliable Python audio?

Mon Feb 11, 2013 5:43 am

for pygame, alsa seems to work best imo and it comes as the default one.
If it isnt smoking and blown into pieces, it's not pushed far enough yet. :P
http://cae2100.wordpress.com

User avatar
scruss
Posts: 2419
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Which sound system for reliable Python audio?

Sat Feb 16, 2013 4:53 pm

Thanks, but I'm still getting lockups. I appear to be having the same problems as Bill in his thread Sound problem - aplay lock up.

I'm running from the console. X is not running. Sound is going to HDMI, and the Boodler test option is audible.

Every two minutes, I get these kernel log messages:

Code: Select all

[ 1801.056456] INFO: task boodler:5113 blocked for more than 120 seconds.
[ 1801.056479] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1801.056491] boodler         D c03983d0     0  5113      1 0x00000001
[ 1801.056577] [<c03983d0>] (__schedule+0x2c4/0x5b0) from [<c0398db4>] (schedule_preempt_disabled+0x24/0x34)
[ 1801.056612] [<c0398db4>] (schedule_preempt_disabled+0x24/0x34) from [<c0397974>] (__mutex_lock_slowpath+0xac/0x13c)
[ 1801.056754] [<c0397974>] (__mutex_lock_slowpath+0xac/0x13c) from [<bf057c0c>] (snd_pcm_open+0x84/0x1c8 [snd_pcm])
[ 1801.056883] [<bf057c0c>] (snd_pcm_open+0x84/0x1c8 [snd_pcm]) from [<bf057dec>] (snd_pcm_playback_open+0x40/0x5c [snd_pcm])
[ 1801.057040] [<bf057dec>] (snd_pcm_playback_open+0x40/0x5c [snd_pcm]) from [<bf00f598>] (snd_open+0x8c/0x190 [snd])
[ 1801.057114] [<bf00f598>] (snd_open+0x8c/0x190 [snd]) from [<c00c55e4>] (chrdev_open+0xbc/0x1a4)
[ 1801.057155] [<c00c55e4>] (chrdev_open+0xbc/0x1a4) from [<c00bfc68>] (do_dentry_open.isra.16+0x1d4/0x254)
[ 1801.057185] [<c00bfc68>] (do_dentry_open.isra.16+0x1d4/0x254) from [<c00bfdb8>] (finish_open+0x20/0x38)
[ 1801.057220] [<c00bfdb8>] (finish_open+0x20/0x38) from [<c00cf064>] (do_last.isra.35+0x4e8/0xba8)
[ 1801.057247] [<c00cf064>] (do_last.isra.35+0x4e8/0xba8) from [<c00cf7cc>] (path_openat+0xa8/0x480)
[ 1801.057273] [<c00cf7cc>] (path_openat+0xa8/0x480) from [<c00cfe54>] (do_filp_open+0x2c/0x80)
[ 1801.057302] [<c00cfe54>] (do_filp_open+0x2c/0x80) from [<c00c09d4>] (do_sys_open+0xe8/0x184)
[ 1801.057334] [<c00c09d4>] (do_sys_open+0xe8/0x184) from [<c000da60>] (ret_fast_syscall+0x0/0x30)
After restarting, I tried running the program again with full diagnostics:

Code: Select all

$ boodler --hardware  --output alsa com.eblong.zarf.crows/ParliamentOfCrows
Boodler: ALSA sound driver.
ALSA header version 1.0.25, library version 1.0.25
PCM device "bcm2835 ALSA", name "bcm2835 ALSA"
Sample rate 44100
Sample format S16_LE (16-bit signed little-endian)
Boodler buffer 4096 frames
Hardware buffer 8192 frames (period 256 frames)
11:39:23 (root) Running "Treeful of crows"
Incomplete sound write: 220 frames short
Incomplete sound write: 124 frames short
Error writing sound: Input/output error
Error draining device: Input/output error
After quitting the program, this was in the kernel log:

Code: Select all

[  636.602656] bcm2835_audio_close:707 bcm2835_audio_close: failed on waiting for event (status=0)
[  636.602903] vc_vchi_audio_deinit:294 vc_vchi_audio_deinit: failed to close VCHI service connection (status=1)
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
scruss
Posts: 2419
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Which sound system for reliable Python audio?

Sat Feb 16, 2013 8:33 pm

Update: I switched to pulseaudio, and it works fine. Details: A Murder of Crows on your Raspberry Pi with Boodler.

I miss the days of just piping stuff to /dev/audio and It Just Worked Fine :geek:
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Python”