Questions tagged [python-sounddevice]

167 questions
3
votes
1 answer

sounddevice.PortAudioError: Error opening OutputStream: Invalid number of channels

My code is: import scipy.io as sio import sounddevice as sd xx= sio.loadmat('C:\\Users\\dell\\Desktop\\Rabia Ahmad spring 2016\\FYP\\1. Matlab Work\\record work\\aa.mat')['aa'] sd.play(xx,64000) I got the error sounddevice.PortAudioError: Error…
Rabia Ahmad
  • 89
  • 1
  • 2
  • 5
3
votes
2 answers

Mac os El Capitan recording sound with python

I'm trying to record sound from mic. Firstly as used PyAudio then sounddevice but both failed. Here is code for PyAudio: import pyaudio def _recording_loop(samples_queue, running, stream, chunk_size): stream.start_stream() while…
Long Smith
  • 1,339
  • 3
  • 21
  • 40
2
votes
0 answers

How to play 2 pieces of audio in parallel through different speakers? - python

I have two pieces of audio: (1) 15 heartbeat clips and (2) 15 frequency noises. The frequency noises are only 1 second and shorter in duration than the heartbeat clips (generated on-the-fly, variable length). I'm able to successfully play both…
2
votes
0 answers

Capture Sound from Mirophone and speakers

We are using amazon transcribe to make speach to text but we need to capture sound from both microphone and speakers. Do you think that this can be done with sounddevice or should we use something else? amazon-transcribe-streaming-sdk Mic…
2
votes
0 answers

Detecting when input is not being used for Python SoundDevice/PortAudio on Linux

I am using Python's sounddevice library (which runs PortAudio underneath) to record audio on Linux (Raspbian Buster desktop on RPi 4), but it appears that more than one instance of my script will cause an error PaErrorcode -9985 which I believe is…
rfii
  • 562
  • 3
  • 14
2
votes
1 answer

Playing recorded audio in a python file not working

I'm using sounddevice to record and play audio with python. I'm using a very simple code which is running well from the python interpreter: import sounddevice as sd from time import sleep fs = 44100 myrec = sd.rec(int(fs*3), samplerate=fs,…
2
votes
1 answer

how to record audio for specific of time until some action(like keyboard press) in Python sounddevice?

I'm very new to Python,so I have small projet to get use to know more about Python, my project is simple, just recording audio use sounddevice but problem is , in documentary, it only record if have static seconds like code sample code below,and i…
khánh lê
  • 21
  • 3
2
votes
0 answers

How can my users be able to record audio as long as they want and also be able to pause it using sounddevice in python?

I am using sounddevice, scipy and playsound in my project. I have a file named record.py whose source is given below : import sounddevice as sd from scipy.io.wavfile import write from playsound import playsound fs = 44100 # this is the frequency…
MOD ER HACKS
  • 197
  • 1
  • 9
2
votes
0 answers

Using Python how can I sample all audio being sent to the speakers via audio loopback

Using python - I want to be able to sample in 2 second chunks, the audio that is being played through the output audio device on the computer. My goal is to be able to detect a specific noise that comes through the speakers of a PC using Python, and…
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130
2
votes
0 answers

Recording 3 Microphones at the Same Time Using Python Without Getting a Input Overflow

I have to record 3 microphones simultaneously with as little delay between them as possible. This will then allow me to calculate the TDOA of sound between the microphones, so that I can pinpoint the source location. However, I keep on getting a…
2
votes
2 answers

Why do I get a "Invalid device" error when recording a device using WASAPI and the sounddevice library?

I am trying to write a script to record USB audio from a 4-channel audio device. I am using Python 3.7 and the "sounddevice" library. Upon being compiled the the code gives me an error. Using the following code, I found the device number of the…
PetSven
  • 366
  • 3
  • 13
2
votes
1 answer

How to record 2 audio feeds simultaneously?

I want to record a audio track and save it 2 diffrent .wav files. The audio tracks should be saved with a delay of ca. 6 seconds and each .wav should be 12 seconds long. I tried to do it with multiprocessing and pyaudio, but i cant manage to get it…
2
votes
0 answers

How to change microphone data in python sounddevice in realtime

I play sound from my microphone with sounddevice (Python 3.6.3, Win 7) in real time. I did my X global. global x for n in range(10): х = n + 1 def cаllbасk(indаtа, outdаtа, frаmes, time): оutdаta[:] = indаta * х …
bluesky
  • 243
  • 2
  • 12
2
votes
1 answer

How do I save a winsound.Beep() to an audio .wav file in python?

I've been trying to do something that I thought would be fairly simple, and that si to save winsound.Beep(8000,1000) to a .wav file called LongBeep.wav . Can someone pls reply with a solution. I have searched and searched for an answer but have…
Magnolia
  • 21
  • 1
2
votes
1 answer

Python: convert hex bytestream to “int16"

So I'm working with incoming audio from Watson Text to Speech. I want to play the sound immediately when data arrives to Python with a websocket from nodeJS. This is a example of data I'm sending with the websocket:
Aagje
  • 21
  • 1
1
2
3
11 12