Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when recording in small chunks (only on Linux). #29

Closed
janleskovec opened this issue Oct 6, 2018 · 6 comments
Closed

Crash when recording in small chunks (only on Linux). #29

janleskovec opened this issue Oct 6, 2018 · 6 comments

Comments

@janleskovec
Copy link
Contributor

When recording with small numframes (below 2400 or so) I get the following error: Assertion 's' failed at pulse/stream.c:1411, function pa_stream_connect_record(). Aborting. Aborted (core dumped)

@bastibe
Copy link
Owner

bastibe commented Oct 9, 2018

Can you send me some example code so I can reproduce the issue?

@janleskovec
Copy link
Contributor Author

Here it is:

import soundcard

input = soundcard.all_microphones(include_loopback=True)[0]

samplerate = 48000
chunk = 2400

while True:
	data = input.record(chunk, samplerate)
	print("recorded data")

@janleskovec
Copy link
Contributor Author

OK, i guess that isn't the intended use-case and it works when using:

import soundcard

input = soundcard.all_microphones(include_loopback=True)[0]

samplerate = 48000
chunk = 2400

with input.recorder(samplerate) as mic:
    while True:
        data = mic.record(chunk)
        print("recorded data")

It would probably still be a good idea to find what is the problem.

@bastibe
Copy link
Owner

bastibe commented Oct 11, 2018

Yes, that would explain it. Depending on your native block size, the record method will return instantly, and flood pulseaudio with new instances.

I will close this issue, and investigate this further in #28.

@bastibe bastibe closed this as completed Oct 11, 2018
@drscotthawley
Copy link

drscotthawley commented Jan 14, 2021

I just tried my oscilloscope app (which works fine on Mac) on Linux, and got exactly this error. But increasing numframes from 1024 to as large as 4096 doesn't fix the error, the assertion still fails.
Used a brand-new install of soundcard via pip. Should I open up a new issue or do you want to reopen this one?

@bastibe
Copy link
Owner

bastibe commented Jan 15, 2021

Please open a new issue with a piece of example code and the exact error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants