python-sounddevice

Using Python to playback mic input to PC in real-time

泄露秘密 提交于 2021-01-07 02:48:02
问题 I'm trying to use Python to 'mic-monitor', i.e., to playback the mic signal through the headphones in real-time, in addition to any other output signal from the PC. I can accomplish this by amending my PC's playback settings, but I want to do it with Python, so that I can program a Raspberry Pi to mic-monitor my cheap headset for the PS4. I can almost accomplish this with PyAudio or sounddevice, but there is a small but significant delay. So: Is there a way to eradicate that latency with

Using Python to playback mic input to PC in real-time

邮差的信 提交于 2021-01-07 02:46:28
问题 I'm trying to use Python to 'mic-monitor', i.e., to playback the mic signal through the headphones in real-time, in addition to any other output signal from the PC. I can accomplish this by amending my PC's playback settings, but I want to do it with Python, so that I can program a Raspberry Pi to mic-monitor my cheap headset for the PS4. I can almost accomplish this with PyAudio or sounddevice, but there is a small but significant delay. So: Is there a way to eradicate that latency with

How to create a surround effect using python by controlling the volume of speakers channels?

自作多情 提交于 2020-07-23 06:48:21
问题 I have bought a soundcard: Focusrite Scarlett 4i4 3rd Gen , with 4 outputs channels. I also have 4 speakers and I will link each speaker with the soundcard. I would like to be able to set separately the volume of each speaker, with maybe a tkinter interface (ultimately, but that is not the point). I have seen that we could have plenty of different librairies (I'm using windows 10 for this project): the ones that seems to be interesting are sounddevice and soundcard. I would though like to

How to create a surround effect using python by controlling the volume of speakers channels?

☆樱花仙子☆ 提交于 2020-07-23 06:46:16
问题 I have bought a soundcard: Focusrite Scarlett 4i4 3rd Gen , with 4 outputs channels. I also have 4 speakers and I will link each speaker with the soundcard. I would like to be able to set separately the volume of each speaker, with maybe a tkinter interface (ultimately, but that is not the point). I have seen that we could have plenty of different librairies (I'm using windows 10 for this project): the ones that seems to be interesting are sounddevice and soundcard. I would though like to

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

被刻印的时光 ゝ 提交于 2020-01-06 08:10:57
问题 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 this is the first step in doing so. I have taken a look at the sounddevice docs but can't seem to determine the correct way to achieve this behaviour, the documentation doesn't appear to cover this. Please can somebody help out? It appears I am

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

三世轮回 提交于 2020-01-06 06:54:39
问题 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 from this question: first I tried with PyAudio like this: import pyaudio import wave CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = "output.wav" p = pyaudio.PyAudio() stream = p.open(format

Multichannel sound syncronization issues in Python (Sounddevice)

爷,独闯天下 提交于 2019-12-25 08:13:58
问题 I am currently working on a script that should be able to output 8 channels of audio (.wav files) to 8 different channels on a soundcard. My script is sort of working, but I have syncronization issues. I am able to hear that the timing between the channels changes during playback, which is very critical. Currently I am using threads to start each channel of sound. My question is, if you guys have any suggestions to how I can achieve a better synchronization between channels/threads? I would

Multichannel sound syncronization issues in Python (Sounddevice)

本秂侑毒 提交于 2019-12-25 08:10:13
问题 I am currently working on a script that should be able to output 8 channels of audio (.wav files) to 8 different channels on a soundcard. My script is sort of working, but I have syncronization issues. I am able to hear that the timing between the channels changes during playback, which is very critical. Currently I am using threads to start each channel of sound. My question is, if you guys have any suggestions to how I can achieve a better synchronization between channels/threads? I would

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

吃可爱长大的小学妹 提交于 2019-12-24 09:59:49
问题 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 app should avoid running out of memory (since the recording could be very long). For example, it could write to the WAV file in real-time to prevent storing the growing recording in memory. What's a good approach for this problem? Can you please

Continuous Audio Playback with Sounddevice

佐手、 提交于 2019-12-11 03:35:23
问题 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 problem. import sounddevice as sd len = 5 fs = 44100 sd.default.device = [2,1] myrec=sd.rec(int(fs*len), samplerate=fs, channels=2, blocking=True) #fill an array with some sound while True: sd.play(myrec, blocking=True) #loop plays 5 second audio clip