pyaudio

how to start and stop recording with single button

无人久伴 提交于 2020-03-05 06:06:11
问题 I am having an issue with this code, when I try to run this code with two separate buttons it runs fine but when I try to use only a single button to start and stop the recording by changing its text(label) to start and stop recording the code does not work. The text of the button changes but it does not record anything. import tkinter as tk import threading import pyaudio import wave from tkinter import * import tkinter.font as font from tkinter.filedialog import asksaveasfile class App():

PyAudio: how to capture internal audio (not from microphone)?

╄→гoц情女王★ 提交于 2020-03-03 09:13:00
问题 Tried like this: p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, output=True, frames_per_buffer=chunk) all = [] for i in range(0, int(RATE / chunk * RECORD_SECONDS)): data = stream.read(chunk) but it throws paCanNotReadFromAnOutputOnlyStream Using input=True it reads audio from mic, but that is not what I need. Any help, please Edit: I am using linux I can also use other library, not only PyAudio. I just need to get this work 回答1: Try this: https://github

I can't run a simple code using pyaudio - [Errno -9996] Invalid output device (no default output device)

喜你入骨 提交于 2020-02-25 03:56:20
问题 (I'm new at python) I'm trying to run a simple code about pyaudio. I just copied and pasted a code that I found on the pyaudio web site. I get this error: OSError Traceback (most recent call last) <ipython-input-7-3fc52ceecbf3> in <module>() 15 channels=wf.getnchannels(), 16 rate=wf.getframerate(), ---> 17 output=True) 18 19 # read data /home/gustavolg/anaconda3/lib/python3.5/site-packages/pyaudio.py in open(self, *args, **kwargs) 748 """ 749 --> 750 stream = Stream(self, *args, **kwargs) 751

Creating suitable WAV files for Google Speech API

让人想犯罪 __ 提交于 2020-02-23 09:15:11
问题 I'm using pyaudio to record my voice as wav file. I'm using following code: def voice_recorder(): FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 22050 CHUNK = 1024 RECORD_SECONDS = 4 WAVE_OUTPUT_FILENAME = "first.wav" audio = pyaudio.PyAudio() # start Recording stream = audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) print "konusun..." frames = [] for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)): data = stream.read(CHUNK) frames.append(data)

Creating suitable WAV files for Google Speech API

爷,独闯天下 提交于 2020-02-23 09:15:09
问题 I'm using pyaudio to record my voice as wav file. I'm using following code: def voice_recorder(): FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 22050 CHUNK = 1024 RECORD_SECONDS = 4 WAVE_OUTPUT_FILENAME = "first.wav" audio = pyaudio.PyAudio() # start Recording stream = audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) print "konusun..." frames = [] for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)): data = stream.read(CHUNK) frames.append(data)

how to install portaudio on pi properly

谁都会走 提交于 2020-02-02 16:16:09
问题 I am working on a project that involves recording from a mic on a raspberry pi. for now i am getting this error while the program is running. python3: src/hostapi/alsa/pa_linux_alsa.c:3641: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed. Aborted while searching for ways to fix this, i figured out the file pa_linux_alsa.c belongs to port audio. please refer to the following links. modified pa_linux_alsa.c i think how to install port audio download link first link is

Failed installing pyaudio on Google Colab with “ERROR: Failed building wheel for pyaudio”

六月ゝ 毕业季﹏ 提交于 2020-01-25 10:31:35
问题 Trying to install pyaudio on Google Colab but got an error "ERROR: Failed building wheel for pyaudio". !apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools !pip install pyaudio I got this error: Collecting pyaudio Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Building wheels for collected packages: pyaudio Building wheel for pyaudio (setup.py) ... error

Speech Recognition duration setting issue in python

此生再无相见时 提交于 2020-01-23 09:55:39
问题 I have an audio file in Wav format that I want to transcribe: My code is: import speech_recognition as sr harvard = sr.AudioFile('speech_file.wav') with harvard as source: try: audio = r.listen(source) #print("Done") except sr.UnknownValueError: exec() r.recognize_google(audio) I do receive an output: Out[20]: 'thank you for calling my name is Denise who I have a pleasure speaking with hi my name is Mary Jane. Good afternoon Mary Jane I do have your account open with your email' However,

voice recording using pyaudio

六月ゝ 毕业季﹏ 提交于 2020-01-11 04:00:09
问题 i am trying to record voice using python. i tried to use the pyaudio module it saved a wav file on my computer but recorded a static voice. any suggestions? import pyaudio import wave CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = "voice.wav" p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) print("* recording") frames = [] for i in range(0, int(RATE / CHUNK *

Playing .mp3 files with PyAudio

僤鯓⒐⒋嵵緔 提交于 2020-01-10 20:01:22
问题 Can pyaudio play .mp3 files? If yes, may I ask to write an example please. If no, what is the simplest way to convert .mp3 to .wav? I have tried to use PyDub, could get my .wav file, but when I try to play it with PyAudio I get following error: File "C:\Python33\lib\wave.py", line 130, in initfp raise Error('file does not start with RIFF id') wave.Error: file does not start with RIFF id With other .wav samples (which where not converted from mp3) if works well. I am using gTTS library to