Questions tagged [python-sounddevice]

167 questions
30
votes
2 answers

PortAudio library not found by sounddevice

I have been working with a python program which uses sounddevice module to play audio. The program works fine in my office pc (running Ubuntu 17.10), but not in my home pc (running Linux Mint 18.3). It generates the following error: Traceback (most…
Arif Ahmad
  • 403
  • 1
  • 6
  • 6
10
votes
1 answer

python : how to change audio volume?

I used winsound.Beep(frequency, duration) because I wanted to play sounds with a specified frequency. Now, I need to change the volume of these sounds. How can I do this? I tried to get help from pyaudio but...
maral
  • 103
  • 1
  • 1
  • 7
7
votes
0 answers

Getting the internal audio output of the speaker on macOS with python

I want to get the internal audio output of the speaker on macOS with python. I got it working on Windows but I can't get it running on macOS. At the beginning we used PyAudio, but I figured that SoundDevice is the better option. This is the working…
5
votes
1 answer

Recording or Playing Audio with Python not working on Mac: No Errors & No Sound

I'm trying to work with Audio on Python 3.7 on Mac(Catalina) only with the built-in Microphone and Speakers. My Problem is that with any code I tried, when recording I receive nothing and when playing sound nothing comes out. I tried the answers…
vincirist
  • 103
  • 1
  • 6
5
votes
1 answer

How to record audio in python for undetermined duration AND allow for pause and resume features?

I'm writing a Python app to record audio as a WAV file until a user presses pause or stop. After pausing the audio, the user should also be able to resume recording. Additionally: The app can't know how long the recording will be beforehand The…
Tyler Dane
  • 951
  • 1
  • 14
  • 25
4
votes
3 answers

How to write speaker output to a file sounddevice

Is there a way that I can use the python library sounddevice to write the output through my speakers to a file? For example if I were to play any sounds through my computer they would be written to a mp4/wav file.
4
votes
1 answer

Playing audio on different devices?

I have a USB headphones connected to system. So now my system has two different audio output devices (one internal speakers and other is USB headphone). Though it is possible t choose the default the output device. What i am interested is play…
Faiz Ali
  • 141
  • 1
  • 11
3
votes
1 answer

How to get 24-bit samples from USB audio device using Python?

I am trying to get a stream of 24-bit audio samples from some USB audio device using Python. I already searched for some solutions and found this thread that is using PyAudio stream with a format of pyaudio.paInt24, unfortunately I still got 16-bit…
3
votes
1 answer

Can not import sounddevice in Google Colab

I am trying to import the sounddevice library in Google Colab using the following code: pip install sounddevice import sounddevice as sd but i get the following error. --------------------------------------------------------------------------- …
Andrew Zacharakis
  • 351
  • 1
  • 6
  • 19
3
votes
1 answer

Getting BadRequestException in AWS Transcribe realtime

I am getting this response from amazon streaming api. Can anybody please help me on it what thing I am doing wrong over…
3
votes
0 answers

Python-Sounddevice PortAudio not showing any devices when logged in as root

I am running a Python code to record audio playing on a browser in a Google Compute Engine VM (Ubuntu 18.04). Here's the basic code I am running: import sounddevice as sd samplerate = 44100 # Hertz duration = 30 # seconds mydata = sd.rec(0,…
3
votes
0 answers

Recorded sound gets noisy/distorted when datatype is 32 bit float

I recorded sound from microphone on my computer by python with pyaudio. It works fine when sound is recorded in 16 bit integer as its data type. However, it does not work when it is recorded in 32 bit float as its datatype. Please take a look at…
Wave
  • 111
  • 1
  • 3
  • 12
3
votes
1 answer

Continuous Audio Playback with Sounddevice

I am writing a program to stream audio over a network, so I have a thread to record data and one to send it. When testing the audio has noticeable gaps. I beleive this is due to the sounddevice.play() function, the example below has the same…
MikeS159
  • 1,884
  • 3
  • 29
  • 54
3
votes
2 answers

Unable to record sound with sounddevice

I am unable to record audio using sounddevice in python. This code worked before on an older version of Mac OS. The python3 code is as follows: import sounddevice as sd import numpy as np fs = 48000 duration=5 rec = sd.rec(int(duration * fs),…
Gerhard
  • 1,925
  • 3
  • 15
  • 24
3
votes
1 answer

python-sounddevice - Playing back audio from microphone

I can get the audio to play back from my microphone but it's extremely muffled and it honestly sounds like the program is going to crash. I tried using an InputStream but the sound is just horrible when I play it back, any idea what I'm doing…
Aran Bins
  • 449
  • 10
  • 20
1
2 3
11 12