Code Monkey home page Code Monkey logo

Comments (11)

bastibe avatar bastibe commented on July 26, 2024

Do you have pulseaudio installed? What version?

from soundcard.

Ninja243 avatar Ninja243 commented on July 26, 2024

Yeah, pulseaudio version 10.0.

from soundcard.

bastibe avatar bastibe commented on July 26, 2024

Can you please state exactly what code you are trying to run?

from soundcard.

Ninja243 avatar Ninja243 commented on July 26, 2024

The second block of code under the tutorial section of the main page.

from soundcard.

bastibe avatar bastibe commented on July 26, 2024

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?

from soundcard.

Ninja243 avatar Ninja243 commented on July 26, 2024

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!

from soundcard.

chakradarraju avatar chakradarraju commented on July 26, 2024

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

from soundcard.

bastibe avatar bastibe commented on July 26, 2024

I'll have a look.

from soundcard.

srikaratstrings avatar srikaratstrings commented on July 26, 2024

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

from soundcard.

srikaratstrings avatar srikaratstrings commented on July 26, 2024

Sorry about that. This has been resolve. This was an error on my part. Thanks!

from soundcard.

bastibe avatar bastibe commented on July 26, 2024

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.

from soundcard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.