[pulseaudio-discuss] audio noise using module-loopback

Tanu Kaskinen tanuk at iki.fi
Sat May 30 02:54:05 PDT 2015


On Sat, 2015-05-30 at 10:51 +0800, golden wrote:
> Hi all,
> 
>     Recently I have found a noise problem when using module-loopback.
>     I connected a alsa-source to a alsa-sink with module-loopback
>     the data from alsa-source is actually sine-wave (rate=44100, 
> format=s16le, channels=2)
> 
>     I found that in the adjust_rates function, if I comment 
> "pa_sink_input_set_rate",
>     there is no noise, but if I uncomment "pa_sink_input_set_rate", 
> problem appears.
> 
>     Here is the setup log:
> 
>      D/NMAudio ( 1797): [tid=1816] D: Negotiated format: pcm, 
> format.sample_format = "\"s16le\""  format.rate = "44100" format.channels ="
> D/NMAudio ( 1797): [tid=1816] D: Resampler:
> D/NMAudio ( 1797): [tid=1816] D:   rate 44100 -> 44100 (method trivial)
> D/NMAudio ( 1797): [tid=1816] D: i_ss.format=s16le, o_ss.format=s16le
> D/NMAudio ( 1797): [tid=1816] D:   format s16le -> s16le (intermediate 
> s16le)
> D/NMAudio ( 1797): [tid=1816] D:   channels 2 -> 2 (resampling 2)
> D/NMAudio ( 1797): [tid=1816] D: memblockq requested: 
> maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
> D/NMAudio ( 1797): [tid=1816] D: memblockq sanitized: 
> maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
> I/NMAudio ( 1797): [tid=1816] I: Created input 2 "(null)" on audioio.22 
> with sample spec s16le 2ch 44100Hz and channel map front-leftt
> I/NMAudio ( 1797): [tid=1816] I:     media.role = "abstract"
> D/NMAudio ( 1797): [tid=1816] D: Negotiated format: pcm, 
> format.sample_format = "\"s16le\""  format.rate = "44100" format.channels ="
> D/NMAudio ( 1797): [tid=1816] D: memblockq requested: 
> maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
> D/NMAudio ( 1797): [tid=1816] D: memblockq sanitized: 
> maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
> I/NMAudio ( 1797): [tid=1816] I: Created output 2 "(null)" on audioio.17 
> with sample spec s16le 2ch 44100Hz and channel map front-left
> I/NMAudio ( 1797): [tid=1816] I:     media.role = "abstract"
> D/NMAudio ( 1797): [tid=1816] D: memblockq requested: 
> maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=0 maxrewind=0
> D/NMAudio ( 1797): [tid=1816] D: memblockq sanitized: 
> maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
> I/NMAudio ( 1797): [tid=1816] I: Adding 35280 bytes of silence to queue
> I/NMAudio ( 1797): [tid=1844] I: Max request changed
> D/NMAudio ( 1797): [tid=1844] D: Requesting rewind due to uncorking
> D/NMAudio ( 1797): [tid=1844] D: Requested to rewind 5292 bytes.
> D/NMAudio ( 1797): [tid=1844] D: Processing rewind...
> D/NMAudio ( 1797): [tid=1844] D: Processing rewind...
> D/NMAudio ( 1797): [tid=1844] D: Rewound 4140 bytes.
> I/NMAudio ( 1797): [tid=1816] I: Loaded "module-loopback" (index: #7; 
> argument: "loopbackid=1722 source=audioio.17 sink=audioio.22
> 
> -----------> before this line, the rate of sink-input was not adjusted, 
> everything is fine, no noise appears
> 
> D/NMAudio ( 1797): [tid=1816] D: Loopback overall latency is 19.46 ms + 
> 182.97 ms + 2.67 ms = 205.02 ms (at the base rate: 205.02 ms,)
> D/NMAudio ( 1797): [tid=1816] D: Latency difference: 5.02 �± 1.00 ms, 
> rate difference: 0 Hz
> D/NMAudio ( 1797): [tid=1816] D: [audioio.22] Updated sampling rate to 
> 44200 Hz.
> 
> -----------> after 10 second, the rate of sink-input was adjusted, noise 
> comes out.
> 
>     I have been playing around all the new rate variables, any value 
> that do not equals to 44100 will make audio noise.
> 
>     That looks very strange to me, so I`m asking if anyone have met this 
> problem before ?

What kind of noise is it? Is the signal a bit distorted or totally
messed up?

What version of pulseaudio do you have? And what hardware? There is a
bug report[1] which mentions noise when receiving audio over bluetooth
and playing it to an alsa sink, and using the ffmpeg resampler. The
ffmpeg resampler can't actually be used with module-loopback, so it
probably falls back to the trivial resampler which you are using too.
That's on pulseaudio 5.0 and raspberry pi 2. The src-sinc-medium-quality
resampler reportedly doesn't have such noise, but causes issues with
high cpu load.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=90210

-- 
Tanu



More information about the pulseaudio-discuss mailing list