[pulseaudio-discuss] Question about Capturing Stereo Sound
miguel angel rodriguez
duckfrost at gmail.com
Fri Oct 2 03:37:00 PDT 2015
Hi,
I'm useing "pulseaudio.lib_pulseaudio" to record sound from a the internal
source "alsa_output.pci-0000_00_1b.0.analog-stereo". But form some reason
I'm only getting the sound from the right channel. I'm sure ?im
missconfiguring something but I really don't know what could it be. I would
appreciate any insight you might give me because I can't find any exmaples
or tutorials about this theme.
samplespec = pa_sample_spec()
samplespec.channels = 2
samplespec.format = PA_SAMPLE_U8
samplespec.rate = self.rate
pa_stream = pa_stream_new(context, "peak detect demo", samplespec, None)
pa_stream_set_read_callback(pa_stream,
self._stream_read_cb,
sink_info.index)
pa_stream_connect_record(pa_stream,
sink_info.monitor_source_name,
None,)
PA_STREAM_NOFLAGS)
And here I access
def stream_read_cb(self, stream, length, index_incr):
data = c_void_p()
pa_stream_peek(stream, data, c_ulong(length))
data = cast(data, POINTER(c_ubyte))
for i in xrange(length):
# When PA_SAMPLE_U8 is used, samples values range from 128
# to 255 because the underlying audio data is signed but
# it doesn't make sense to return signed peaks.
#self._samples.put(data[i] - 128)
self._samples.put(data[i])
pa_stream_drop(stream)
And here I get the audio everytime a need another sample:
def getAudio(self):
"""get a single buffer size worth of audio."""
return self.__iter__().next()
Thank you and hope to hear from you soon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20151002/af04a9d7/attachment.html>
More information about the pulseaudio-discuss
mailing list