Closed Ninja243 closed 5 years ago
Do you have pulseaudio installed? What version?
Yeah, pulseaudio version 10.0.
Can you please state exactly what code you are trying to run?
The second block of code under the tutorial section of the main page.
The second block alone is not executable. This can not be true.
Please state exactly what code you are trying to run, as a complete Python script, so I can reproduce your error on my end. Help me help you.
What does soundcard report as your default_mic
and default_speaker
?
This is the script I tried to run. I cannot reproduce the error anymore so I think this issue can be marked as solved. The default mic is <Microphone Built-in Audio Analog Mono (2 channels)>
and the default speaker is <Speaker FFT based equalizer on Built-in Audio Analog Stereo (2 channels)>
.
Thanks for the help!
I'm seeing same error
Traceback (most recent call last):
File "record.py", line 12, in <module>
f.writeframes(rcdr.record(44100))
File "/home/chakradarraju/.virtualenvs/py3/lib/python3.6/site-packages/soundcard/pulseaudio.py", line 588, in record
chunk = self._record_chunk()
File "/home/chakradarraju/.virtualenvs/py3/lib/python3.6/site-packages/soundcard/pulseaudio.py", line 528, in _record_chunk
readable_bytes = self._pulse._pa_stream_readable_size(self.stream)
AttributeError: '_Recorder' object has no attribute '_pulse'
code:
import soundcard as sc
import wave
lb = sc.all_microphones(include_loopback=True)[0]
rcdr = lb.recorder(44100)
with wave.open('recorded.wav', 'wb') as f:
f.writeframes(rcdr.record(44100))
I'm on ubuntu 18.04 with pulseaudio 11.1
I'll have a look.
Hello,
I'm facing the exact same issue with this code import soundcard as sc import wave
lb = sc.all_microphones(include_loopback=True)[0] rcdr = lb.recorder(44100)
with wave.open('recorded.wav', 'wb') as f: f.writeframes(rcdr.record(44100))
pulseaudio 11.1 Python 3.6.7 Ubuntu 18.04
Sorry about that. This has been resolve. This was an error on my part. Thanks!
I'm seeing same error
Traceback (most recent call last): File "record.py", line 12, in <module> f.writeframes(rcdr.record(44100)) File "/home/chakradarraju/.virtualenvs/py3/lib/python3.6/site-packages/soundcard/pulseaudio.py", line 588, in record chunk = self._record_chunk() File "/home/chakradarraju/.virtualenvs/py3/lib/python3.6/site-packages/soundcard/pulseaudio.py", line 528, in _record_chunk readable_bytes = self._pulse._pa_stream_readable_size(self.stream) AttributeError: '_Recorder' object has no attribute '_pulse'
code:
import soundcard as sc import wave lb = sc.all_microphones(include_loopback=True)[0] rcdr = lb.recorder(44100) with wave.open('recorded.wav', 'wb') as f: f.writeframes(rcdr.record(44100))
I'm on ubuntu 18.04 with pulseaudio 11.1
The recorder is a context manager. You'll have to use it with with
.
I'd like to get the loopback example on the front page working, but I am getting the error below when trying to run it. I am attempting to run this using Python 3.6 on Linux. Not sure if this is related to this issue or not.
File "/usr/local/lib/python3.6/dist-packages/soundcard/pulseaudio.py", line 417, in record chunk = self._record_chunk() File "/usr/local/lib/python3.6/dist-packages/soundcard/pulseaudio.py", line 371, in _record_chunk readable_bytes = self._pulse._pa_stream_readable_size(self.stream) AttributeError: '_Recorder' object has no attribute '_pulse'