Questions tagged [python-sounddevice]

167 questions
0
votes
0 answers

How to record audio with python sounddevice on WSL?

I am on WSL, and when trying to record audio using sounddevice, I get an error saying no device was found: sounddevice.PortAudioError: Error querying device -1. I followed sounddevice's instructions and installed libportaudio2, CFFI, and numpy. I…
0
votes
1 answer

Is there any way to respond when a specific frequency (combination) is heard from the system sound in python?

I am currently attempting to create a modem-like script in python that uses sound to respond to other instances of itself with sounddevice, kind of like a real modem used in the older days. I have already developed some transmit and reply functions…
River
  • 47
  • 7
0
votes
0 answers

End gets cut off with sd.playrec in python-sounddevice

I am using sd.playrec() to determine transfer functions. So I want to play a file with my setup and record the output. import sounddevice as sd from scipy import signal from scipy.io import wavfile import numpy as np def record_audio(st_data,…
0
votes
0 answers

How do I get the live sound level of output speaker in Python on windows 10?

For a project i need to detect if system is playing some audio through its output speakers (internal or external speaker). Basically i need to get volume level of speaker at that moment so that i can proceed my script if volume level is below from a…
Pavan Yogi
  • 180
  • 2
  • 7
0
votes
0 answers

deepspeech cannot recognize the words accurately

I am writing a real-time speech to text program. I am using Deepspeech for STT and Sounddevice for microphone capturing. However, I find the words form the audio seems to be "extended" and cannot be recognized accurately. For example, When I said…
0
votes
0 answers

Sections of audio repeat when recording (sort of like a loop when DJing) with python sounddevice

I am using sounddevice to continuously record audio with a Raspberry Pi 3 connected to an external USB Audio Interface (Zoom-U22). But I see some sections of audio are repeating or struck like in a loop. The recording continues without any problem…
Sashi
  • 79
  • 11
0
votes
0 answers

Python webrtcvad sounddevice cannot start InputStream froma thread

I'm using webrtcvad to detect whether speech is present in audio from a microphone. I want to start the input stream after a specific event which happens in a thread. When I try to start the stream from a thread I get this error. File…
0
votes
0 answers

Alternatives to sounddevice.playrec()

I have been using sd.playrec() to play and record a sine-sweep in a room at the same time. This happens as part of a python script. However, there is a delay between when the recording starts, and when the sine-sweep starts playing. This delay is…
0
votes
1 answer

No mic get detected as sound.query_devices() returns empty list?

Im trying to get the feed of the mic using "sounddevice" library in Python. import sounddevice as sd print(sd.query_devices()) But it returns empty list. I tried arecord -f cd -d 6 test.wav to record a voice note and it works fine. Also i checked…
0
votes
1 answer

sounddevice.PortAudioError: Error querying host API -9979

I am trying to do python audio with python-sounddevice on a macOS 13.2.1 with M1 chip but I can't get it to work. I installed portaudio and libsndfile with brew, then created a conda environment with sounddevice and soundfile packages then ran: ❯…
0
votes
1 answer

How to record system audio in python

I tried to record audio with this code: import sounddevice from scipy.io.wavfile import write fs = 44100 second = 3 file = sounddevice.rec(int(second * fs), samplerate=fs, channels=2) sounddevice.wait() write('output.wav', fs, file) but it only…
meysam
  • 1
0
votes
0 answers

Python sound device pitch outdate

I found simple code for audio callback in python with sounddevice import sounddevice as sd import numpy as np import time duration = 5.5 # seconds def callback(indata, outdata, frames, time, status): if status: print(status) …
0
votes
0 answers

Pyhon how to get Desktop Audio

Do you know an way to get the real time desktop audio using Python on Linux, or only the Audio from an specific Application or Game? I have only found methods that work on Windows or where saving the output in an file, Not streaming them in real…
0
votes
1 answer

Python- voice detection using Tensorflow

I am making voice detection by using Tensorflow. The computer will be recording my voice and when I say:" Hey Jarvis" it will print "voice has been detected". However, the program is not working properly, when I say "Hey Jarvis" it always prints:…
Tom
  • 21
  • 5
0
votes
0 answers

How can I get the time at which the audio from the microphone is received by the computer using sounddevice callback?

SO I want to get the following times:- t_0 = the time at which the microphone is triggered by the python code t_1 = the time at which the microphone starts recording t_2 = the time at which the system/computer recieves the audio from the…