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
7
votes
0 answers

Audio recording using AVAudioEngine with setting output audio port

In order to make avaliable playback and recording at the same time we use these methods for setting AVAudioSession category: AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession…
7
votes
2 answers

How do I connect AVAudioEngine to a Lightning Port audio input?

I'd like to connect my electric guitar to my app. I have hardware (the Line6 Sonic Port) that passes the audio from my guitar into my iPhone. I've figured out how to get audio playing out to my headphones, but it's audio coming from my headphone…
bryanjclark
  • 6,247
  • 2
  • 35
  • 68
6
votes
0 answers

Status bar shows mic icon for a moment when pausing/stopping AVAudioEngine in iOS 13

Each time I stop/pause the audio engine (using AVAudioEngines stop() or pause()), a red mic icon appears on the status bar for a second. This starts to be annoying after a while, something red appearing at the top each time I pause/stop the…
ernewston
  • 923
  • 6
  • 22
6
votes
1 answer

AVAudioSession's PlayAndRecord category and AVAudioSessionModeMeasurement are incompatible with defaultToSpeaker option?

Attempting to put AVAudioSession into the .playAndRecord category with the AVAudioSessionModeMeasurement mode causes the .defaultToSpeaker option to be ignored, resulting in output being played quietly out the earpiece (also known as the receiver).
Warpling
  • 2,024
  • 2
  • 22
  • 38
6
votes
0 answers

AVAudioEngine warning: "deprecated Carbon Component Manager for hosting Audio Units"

I'm writing my first audio app for Mac, which loads an external audio unit and uses it to play sound through an instance of AVAudioEngine, and I've been seeing this warning: WARNING: 140: This application, or a library it uses, is using the …
flatpickles
  • 2,198
  • 2
  • 15
  • 21
6
votes
3 answers

AVAudioEngine downsample issue

I'm having an issue with downsampling audio taken from the microphone. I'm using AVAudioEngine to take samples from the microphone with the following code: assert(self.engine.inputNode != nil) let input = self.engine.inputNode! let audioFormat =…
nullforlife
  • 1,354
  • 2
  • 18
  • 30
6
votes
1 answer

Test flight app crashes with libAVFAudio.dylib: AVAE_RaiseException(NSString*, ...) + 60

I uploaded an archive on app store and am getting crash when I 'm trying to play an intro sound. I'm using AVAudioEngine to play the sound. When I compile and run code through Xcode everything works fine. When I upload on TestFlight and try to run…
Thomas
  • 177
  • 2
  • 9
6
votes
3 answers

Fade out volume of AVAudioPlayerNode programmatically

I've got an AVAudioEngine setup with a AVAudioPlayerNode that is playing some background music. I'm trying to find a best approach to create a volume fadeout on the node over a 2 second timeframe. I'm considering using CADisplayLink in order to do…
Danny Bravo
  • 4,534
  • 1
  • 25
  • 43
6
votes
2 answers

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

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…
mlk
  • 388
  • 2
  • 10
5
votes
1 answer

Synchronize AVAudioPlayerNode and start of recording AVAudioEngine

I am using AVAudioEngine to both play and record audio. For my use case, I need to play a sound exactly when I start recording audio. Currently, my recording seems to start before the sound is played. How would I make the sound and the recording…
coder
  • 381
  • 2
  • 22
5
votes
1 answer

How to set AVAudioEngine input and output devices (swift/macos)

I've hunted high and low and cannot find a solution to this problem. I am looking for a method to change the input/output devices which an AVAudioEngine will use on macOS. When simply playing back an audio file the following works as expected: var…
5
votes
0 answers

Take audio from microphone, down sample it, encode it (using AAC) and transmit it via socket

For the past few weeks, I've ben trying to hobble together a solution from a number of different examples which will allow me to: Capture the audio from the microphone Down-sample it to 8khz Encode each buffer using AAC Send the result out via a…
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
5
votes
1 answer

How to play multiple sounds from buffer simultaneously using nodes connected to AVAudioEngine's mixer

I am making a basic music app for iOS, where pressing notes causes the corresponding sound to play. I am trying to get multiple sounds stored in buffers to play simultaneously with minimal latency. However, I can only get one sound to play at any…
5
votes
2 answers

Connecting AVAudioMixerNode to AVAudioEngine

I use AVAudioMixerNode to change audio format. this entry helped me a lot. Below code gives me data i want. But i hear my own voice on phone's speaker. How can i prevent it? func startAudioEngine() { engine = AVAudioEngine() guard let…
Daedelus
  • 266
  • 5
  • 14
5
votes
2 answers

AVAudioEngine synchronization for MIDI playback and recording

Question 1 My first question concerns playback synchronization when using an AVAudioPlayerNode and an AVAudioSequencer for MIDI. Basically I'm trying to play something over MIDI, but they need to be perfectly synchronized. I'm aware there are sync…
funct7
  • 3,407
  • 2
  • 27
  • 33