ALSA write errors: broken pipe (underrun) problems
Brought to you by:
ncopeland
The ALSA interface appears to have broken with Ubuntu 8.10 and 9.04, the device constantly restarts. Does not happen with Jack so the ALSA backend is obviously not the issue. Snippet of the excessively verbose output:
opened audio device with a fragment size of 1024, buffer 85e0320, fd 7/8
setAudioStart2(0)
Start playback
Start capture
Write Error: Broken pipe -32
Write Failed: -32
Audio device write issue: restart pl 4
audioClose(b7edd0a0, 0, plughw:0,0)
closing alsa capture channel
closing alsa playback channel
bristolAudioOpen(plughw:0,0, 44100, 256, 208004)
These are looped through at a rate of knots.
This is probably another case of a bug not getting reported, I can't understand how it has not been seen elsewhere with ALSA being the default interface - admittedly many users will have Jack. Upgraded the development boot partition to 9.04 and still had it here implying it was not an issue with 8.10 where the problem first occcured but which was known to have issues with realtime/audio apps.
Resolution for libbristolaudio/audioEngineALSA.c
Submitted code that actually applies a stop threshold, this was just left to default previously and that may have changed in the recent ALSA releases. The problem no longer occurs here but as yet this has not been tested elsewhere.
File is attached to this case.
Ok, I can hear the sound, but there is a problem with crackling on my speakers... Maybe this is to do with my settings?
startBristol -b3 -audiodev hw:1,0
checking availability of TCP port 5028
using port 5028
generate bandwidth limited waveforms(31, 12)
spawning midi thread
Fixing samplerate at 44100
rescheduled thread: 50
parent going into idle loop
Init waiting for midi thread OK status
midi sequencer
Opened listening control socket: 5028
midiOpen: bristol(100)
bristolMidiSeqOpen(bristol)
Client ID = 129
Queue ID = 0
Registered 129 0
Device name "bristol" did not parse, defaults 128.0
Got midi thread OK status
bristol version 0.40.3
connected to :0.0
display is 1680 by 1050 pixels
Window is w 1680, h 1050, d 24, 0 0 0
Using DirectColor display
Initialise the hammondB3 link to bristol: 816a3d0
hostname is localhost, bristol
TCP port: 5028
Accepted connection from 0 (3) onto 2 (5)
Connected to the bristol control socket: 4
bristolengine already active
created 32 voices: allocated 32 to synth
spawning audio thread
bristolAudioOpen(hw:1,0, 44100, 256, 1200008)
audioOpen(a7dad1a0, 0, 1024): hw:1,0
opening device hw:1,0, flags 0000000d
open playback on hw:1,0, pre 8
rescheduled thread: 75
Jack init waiting for audio thread OK status
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 2048
period_size : 1024
period_time : 23219
tstamp_mode : NONE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 2147483647
stop_threshold : 8192
silence_threshold: 0
silence_size : 0
boundary : 1073741824
open capture on hw:1,0: pre 8
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 2048
period_size : 1024
period_time : 23219
tstamp_mode : NONE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 2147483647
stop_threshold : 8192
silence_threshold: 0
silence_size : 0
boundary : 1073741824
opened audio device with a fragment size of 1024, buffer 81d5050, fd 7/8
setAudioStart2(0)
Start playback
Start capture
initialising one hammond sound
No private microtonal mapping for hammond
veloc first 0.00 last 1.00
hostname is localhost, bristol
TCP port: 5028
Accepted connection from 0 (3) onto 3 (9)
Connected to the bristol control socket: 5
bristolengine already active
created 32 voices: allocated 32 to synth
initialising one hammond second manual
No private microtonal mapping for hammondB3
veloc first 1.00 last 1.00
user r 1000/1000, e 1000/1000
bristolMidiSeqOpen(brighton)
Client ID = 130
Queue ID = 1
Registered 130 0
Device name "brighton" did not parse, defaults 128.0
opened GUI midi handle: 2, fd 6
Read Configuration: hammondB3
brightonWorldChanged(765 400 10 10)
going operational: 8160008, 816a3d0
brightonWorldChanged(922 1033 765 400)
brightonWorldChanged(922 1033 1670 873)
brightonWorldChanged(922 1033 1670 873)
I then quit here, not a crash/bug!
cleanupBrighton(0)
exit algo: 1, 831c248, 2
audioClose(a7dad1a0, 0, hw:1,0)
closing alsa capture channel
closing alsa playback channel
Terminate MIDI signalling
audio thread returned: exiting.
parent exiting
return - no data in buffer
socket closed
request acked: -1
Andrew.
Hi Andrew,
From the debug output the original issue with broken pipe is gone. Now I don't get crackling here but is this the same noise you get from the Pro-10? Perhaps not, but since I can hear that one now it would be helpful if they were related.
Another bug to be opened perhaps.
Regards, Nick.
Damn, I can hear it now - how did that get out. As far as I can tell its not the same issue: turn off your percussive on 4' and 2 2/3' - it should go away. This is something with the legato percussive logic, will fix it, if you only press a single key then the percussive seems to restart on every buffer of sound, does not happen with multiple keys. It is also damaging the key grooming circuit since there is now apparent keyclick on note_off which the grooming circuit it supposed to remove.
Regards, Nick.
This bug now has two issues resolved against it. The first was watermarks being incorrectly set, the second resolved the other clicks and pops by reorganising the counts and buffer sizes that were actually wrong.
Code has been uploaded in 0.40.4.
Code distributed.