avaudiofile

How can I use audio file as audio source in SpeechRecognition in Python?

有些话、适合烂在心里 提交于 2021-02-04 16:36:12
问题 I used speech_recognition.AudioFile in Python 3.6 , but this error was indicated: AttributeError: module 'speech_recognition' has no attribute 'AudioFile' This is my code: #!/usr/bin/env python3 import speech_recognition as sr # obtain path to "english.wav" in the same folder as this script from os import path AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav") # AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "french.aiff") # AUDIO_FILE = path.join(path

Error when installing a tap on audio engine input node

这一生的挚爱 提交于 2020-05-13 19:20:40
问题 whenever the code reaches inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) {[weak self] (buffer:AVAudioPCMBuffer, when:AVAudioTime) , app is crashing with following error Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate' I tired removing taps before adding another and I'm making sure I'm not adding more than one tap. what is weird is that the app is working fine

Error when installing a tap on audio engine input node

走远了吗. 提交于 2020-05-13 19:18:05
问题 whenever the code reaches inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) {[weak self] (buffer:AVAudioPCMBuffer, when:AVAudioTime) , app is crashing with following error Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate' I tired removing taps before adding another and I'm making sure I'm not adding more than one tap. what is weird is that the app is working fine

how to change the pitch of recorded audio getting me following error

拜拜、爱过 提交于 2020-01-06 03:45:11
问题 Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: node != nil' AVAudioFile *file=[[AVAudioFile alloc] initForReading:_recordedvoice error:nil]; AVAudioFormat *format=file.processingFormat; AVAudioFrameCount capacity= (AVAudioFrameCount)file.length; AVAudioPCMBuffer *buffer=[[AVAudioPCMBuffer alloc] initWithPCMFormat:format frameCapacity:capacity]; [file readIntoBuffer:buffer error:nil]; [playerNode scheduleBuffer:buffer

how to play sound with AVAudioPCMBuffer

你。 提交于 2019-12-21 04:49:08
问题 I Cannot play sound with AVAudioPCMBuffer (though I could play with AVAudioFile). I got this error. ERROR: AVAudioBuffer.mm:169: -[AVAudioPCMBuffer initWithPCMFormat:frameCapacity:]: required condition is false: isCommonFormat here is my code below, and I'd really appreciate for your help. import UIKit import AVFoundation class ViewController: UIViewController { let audioEngine: AVAudioEngine = AVAudioEngine() let audioFilePlayer: AVAudioPlayerNode = AVAudioPlayerNode() override func

how to play sound with AVAudioPCMBuffer

那年仲夏 提交于 2019-12-03 14:01:31
I Cannot play sound with AVAudioPCMBuffer (though I could play with AVAudioFile). I got this error. ERROR: AVAudioBuffer.mm:169: -[AVAudioPCMBuffer initWithPCMFormat:frameCapacity:]: required condition is false: isCommonFormat here is my code below, and I'd really appreciate for your help. import UIKit import AVFoundation class ViewController: UIViewController { let audioEngine: AVAudioEngine = AVAudioEngine() let audioFilePlayer: AVAudioPlayerNode = AVAudioPlayerNode() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib.

SWIFT - Is it possible to save audio from AVAudioEngine, or from AudioPlayerNode? If yes, how?

可紊 提交于 2019-12-03 07:50:41
问题 I've been looking around Swift documentation to save an audio output from AVAudioEngine but I couldn't find any useful tip. Any suggestion? Solution I found a way around thanks to matt's answer. Here a sample code of how to save an audio after passing it through an AVAudioEngine (i think that technically it's before) newAudio = AVAudioFile(forWriting: newAudio.url, settings: nil, error: NSErrorPointer()) //Your new file on which you want to save some changed audio, and prepared to be bufferd