Questions tagged [avaudioengine]

Use this tag when your question is about the AVAudioEngine class, which is part of the AVFoundation framework.

AVAudioEngine is part of the AVFoundation framework for Apple platforms. The class provides some of the more complex audio processing functionalities within the framework, by grouping together connected audio node objects that provide functionality for creating and processing audio signals and IO.

The AVAudioEngine API can be found here.

Related tags:

535 questions
5
votes
1 answer

AVAudioFile.length is 0 even if file exists

I'm creating an AVAudioFile for writing sound to a sound file. If the file already exists I want to move the framePosition to the end of the file, to continue writing at the end, instead of replacing the existing file. I did some tests, trying to…
rodskagg
  • 3,827
  • 4
  • 27
  • 46
5
votes
1 answer

Removing AVAudioPlayerNode after use causes crash

I'm using AVAudioEngineto play sound files and record the output to a file. I have lots of sound effect files, each played by tapping a button. To play the file I create an AVAudioPlayerNode and connects it to the engine. After the file has played I…
rodskagg
  • 3,827
  • 4
  • 27
  • 46
5
votes
4 answers

Crash when repeating a sound with AudioEngine in Swift

I'm trying to play sounds with different effects. In a previous viewController I record a sound, then in the next screen, it can be played with the effects. First time it works ok but the second time it crashes with error as follows: 2015-08-07…
Juan Presa
  • 99
  • 1
  • 6
5
votes
2 answers

Playing an audio file repeatedly with AVAudioEngine

I'm working on an iOS app with Swift and Xcode 6. What I would like to do is play an audio file using an AVAudioEngine, and until this point everything OK. But how can I play it without stopping, I mean, that when it ends playing it starts…
Guillermo Barreiro
  • 1,365
  • 1
  • 11
  • 13
4
votes
1 answer

how to process input with AVAudioEngine manual rendering mode?

I'm having trouble getting AVAudioEngine manual rendering working when processing input. It's easy to get it working when there's no input node and audio comes from a player node. Here's the code I've got, which can be pasted into a test: -…
Taylor
  • 5,871
  • 2
  • 30
  • 64
4
votes
0 answers

AVAudioEngine crash when connecting inputNode to mainMixerNode

I have the following code to connect inputNode to mainMixerNode of AVAudioEngine: public func setupAudioEngine() { self.engine = AVAudioEngine() let format = engine.inputNode.inputFormat(forBus: 0) //main mixer node is…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
4
votes
0 answers

Write incoming audio raw data to AVAudioPCMBuffer of AVAudioFile and play AVAudioFile

I'm receiving packets of audio raw data within a callback function with the following properties: 640 samples per packet 32 kHz sampling rate Signed 16-Bit PCM encoding Single channel In other words, each packet of incoming audio data is an array…
4
votes
2 answers

AVAudioEngine: Playing a stream of Int16 PCM samples

I'm receiving a stream of 16 bit / 48 kHz stereo PCM samples as Int16s and I'm trying to play them using AVAudioEngine, however I am not hearing anything at all. I'm thinking it either has something to do with the way I set up the player or maybe…
Tobias Timpe
  • 720
  • 2
  • 13
  • 27
4
votes
0 answers

Enhancing voice recording with AVAudioEngine like in Voice Memos

I'm trying to implement a similar functionality like was added to Voice Memos in iOS 14. As far as I know it reduces background noise and removes echo. The overall goal is to make voice recording sound better by presumably cutting noise, removing…
bitemybyte
  • 971
  • 1
  • 10
  • 24
4
votes
0 answers

AVAudioEngine stops running when changing input to AirPods

I have trouble understanding AVAudioEngine's behaviour when switching audio input sources. Expected Behaviour When switching input sources, AVAudioEngine's inputNode should adopt the new input source seamlessly. Actual Behaviour When switching from…
Thomas Walther
  • 526
  • 1
  • 6
  • 15
4
votes
1 answer

Real time pitch shifting in swift iOS

I want to implement an iOS app (in swift) that changes the pitch of phones mic input and play the modified voice through speakers as the user speaks with minimum delay (a few mili seconds at most). So far I have the following code: import…
4
votes
1 answer

AVAudioSinkNode with non-default, but still device-native sample rates

I've configured AVAudioSinkNode attached to AVAudioEngine's inputNode like so: let sinkNode = AVAudioSinkNode() { (timestamp, frames, audioBufferList) -> OSStatus in print("SINK: \(timestamp.pointee.mHostTime) - \(frames) -…
akuz
  • 607
  • 7
  • 14
4
votes
0 answers

How to select audio input device (mic) in AVAudioEngine on macOS / swift?

Is it possible to select the input device in AVAudioEngine using Swift on macOS? Use case: I am using SFSpeechRecognizer on macOS. To feed microphone data into it I am using private let audioEngine = AVAudioEngine() : let inputNode =…
P i
  • 29,020
  • 36
  • 159
  • 267
4
votes
2 answers

Playback streaming audio with AVAudioengine (iOS)

I want to stream audio on iOS using AVAudioEngine. Currently I'm not sure how to do this. I get RTP data from the network and want to playback this audio data with AVAudioEngine. I am using the iOS Network.Framework to receive the network data. I…
Tim
  • 91
  • 4
4
votes
2 answers

CoreAudio error and crash on AVAudioEngine.connect

I'm attempting to connect an AVAudioUnitEffect to an instance of AVAudioEngine like so: required init(inputFormat: AVAudioFormat, outputFormat: AVAudioFormat, andAVAudioEngine avAudioEngine:AVAudioEngine) { self.inputFormat = inputFormat …
hgwhittle
  • 9,316
  • 6
  • 48
  • 60