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

sounddevice rec stop playing when silence detected #483

Open
Christhian16 opened this issue Aug 20, 2023 · 1 comment
Open

sounddevice rec stop playing when silence detected #483

Christhian16 opened this issue Aug 20, 2023 · 1 comment

Comments

@Christhian16
Copy link

Hello,

I'm currently using sounddevice to record audio from my speaker output using this code.

import sounddevice as REC
from scipy.io import wavfile
SAMPLE_RATE = 44100
SECONDS = 20
MONO    = 1
STEREO  = 2
REC.default.device = 12
REC.default.channels = 2,0
recording = REC.rec( int(SECONDS * SAMPLE_RATE), samplerate = SAMPLE_RATE, channels = 2)
REC.wait()
wavfile.write('recording.wav', SAMPLE_RATE, recording)

Normally, it should record for 20 seconds but instead if stop at silence before the 20 seconds had finished.
So, for the recorded audio, the length is actually 20 seconds but I get 7 seconds of audio because after 7 seconds there was a silence.

Can you please help me with this issue?

Thank you in advance for your reply.

@mgeier
Copy link
Member

mgeier commented Feb 2, 2024

for the recorded audio, the length is actually 20 seconds but I get 7 seconds of audio because after 7 seconds there was a silence.

I don't understand.
Does this still happen?
If yes, can you please provide more information, including the resulting WAV file?

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

2 participants