pyaudio

Linux - Without hardware soundcard, capture audio playback, and record it to file

二次信任 提交于 2021-02-18 22:10:32
问题 Is such a thing even possible? Is there a possibility to create a virtual sound card and then use for example PyAudio to listen to its output and save it to a file? NOTE that there is no hardware soundcard present on the machine. I have tried a lot of things, especially snd-dummy ALSA module, but I am starting to doubt if I am looking for the right tools. I would be grateful if someone could point me towards at least high-level solution. Preferably something that would work on Ubuntu server.

python 调用麦克风;摄像头;截屏;

点点圈 提交于 2021-02-12 22:37:16
# -*- coding: utf-8 -*- """ Created on Mon Jun 24 14:47:35 2019 @author: erio """ from PIL import Image,ImageGrab import cv2 import pyaudio import wave ''' #录音 input_filename = "record.wav" # 麦克风采集的语音输入 input_filepath = "E:" # 输入文件的path in_pathrec = input_filepath + input_filename #通俗解释就是wav文件路径 def get_audio(filepath): CHUNK = 256 #定义数据流块 FORMAT = pyaudio.paInt16 #量化位数(音量级划分) CHANNELS = 1 # 声道数;声道数:可以是单声道或者是双声道 RATE = 8000 # 采样率;采样率:一秒内对声音信号的采集次数,常用的有8kHz, 16kHz, 32kHz, 48kHz, 11.025kHz, 22.05kHz, 44.1kHz RECORD_SECONDS = 10 #录音秒数 WAVE_OUTPUT_FILENAME = filepath #wav文件路径 p = pyaudio.PyAudio()

Translate audio from speaker output in python with azureSDK

妖精的绣舞 提交于 2021-02-11 16:51:02
问题 I'm looking to make an application, who woul'd let me translate any audio going out of the speaker in live stream. This way, i will be able to translate any videoconference from any live stream app(youtube,teams,zoom,etc.). I'm not far from a solution, but not there yet. Src language would be: fr-CA or en-US Dst language would be : fr-Ca or en-US I was able to get audio stream back from speaker with a custom version of pyaudio allowing loopback with the WASAPI of windows.(https://github.com

PyAudio installation always fails on Mac

匆匆过客 提交于 2021-02-10 14:48:41
问题 Firstly, I tried pip install pyaudio But that didn't work... I found that I need PortAudio, so installed it with brew : brew install portaudio That worked and then I restarted my Mac. But pip install pyaudio still doesn't work and I get the below error message: ERROR: Command errored out with exit status 1: command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/12/44t6pktj77xbqmyp7x368tdr0000gn/T/pip

PyAudio installation always fails on Mac

折月煮酒 提交于 2021-02-10 14:45:33
问题 Firstly, I tried pip install pyaudio But that didn't work... I found that I need PortAudio, so installed it with brew : brew install portaudio That worked and then I restarted my Mac. But pip install pyaudio still doesn't work and I get the below error message: ERROR: Command errored out with exit status 1: command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/12/44t6pktj77xbqmyp7x368tdr0000gn/T/pip

ERROR: Command errored out with exit status 1 while installing pyaudio

限于喜欢 提交于 2021-02-08 04:40:16
问题 After doing pip install pyaudio , It started collecting the package but suddenly it displayed this error. Hope the following explains what's going on: Collecting pyaudio Using cached PyAudio-0.2.11.tar.gz (37 kB) Installing collected packages: pyaudio Running setup.py install for pyaudio ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\

pip3 install pyaudio on Google Colab

旧时模样 提交于 2021-02-07 08:35:29
问题 I install pyaudio by "pip3 install pyaudio" on Google Colab successfully by the answer from angelokh's. Then, I got the error, OSError: No Default Input Device Available on Google Colab. The code is below. import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: r.adjust_for_ambient_noise(source) audio = r.listen(source) 回答1: You can't use the mic from Google Colab directly as you do with your own machine. You have to use JavaScript to let the browser enable the mic

pip3 install pyaudio on Google Colab

断了今生、忘了曾经 提交于 2021-02-07 08:35:28
问题 I install pyaudio by "pip3 install pyaudio" on Google Colab successfully by the answer from angelokh's. Then, I got the error, OSError: No Default Input Device Available on Google Colab. The code is below. import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: r.adjust_for_ambient_noise(source) audio = r.listen(source) 回答1: You can't use the mic from Google Colab directly as you do with your own machine. You have to use JavaScript to let the browser enable the mic

howto stream numpy array into pyaudio stream?

喜你入骨 提交于 2021-02-04 16:06:24
问题 I'm writing a code that supposed to give some audio output to the user based on his action, and I want to generate the sound rather than having a fixed number of wav files to play. Now, what I'm doing is to generate the signal in numpy format, store the data in a wav file and then read the same file into pyaudio . I think this is redundant, however, I couldn't find a way to do that. My question is, can I stream a numpy array (or a regular list) directly into my the pyaudio to play? 回答1: If

PyAudio cannot find any output devices

北战南征 提交于 2021-02-04 12:36:05
问题 When I run: import pyaudio pa = pyaudio.PyAudio() pa.get_default_output_device_info() I get: IOError: No Default Output Device Available When I say: pa.get_device_count() It returns 0L . And of course if I list devices for i in range(0, device_count): print("Name: " + pa.get_device_info_by_index(i)["name"]) print("Index: " + pa.get_device_info_by_index(i)["index"]) print("\n") It will not print anything. I'm running Ubuntu 16.04 and have set my default sink by going: pacmd list-sinks pacmd