Questions tagged [avaudiofile]
65 questions
4
votes
1 answer
AVAudioFile doesn't play in AVAudioEngine
I'm attempting to play an AVAudioFile using the AVAudioEngine. The code is largely taken and adapted from the Apple Developer on-line videos, but there is no playback. Have spent some time going through the forums, but nothing seems to throw any…

aseago
- 43
- 4
4
votes
0 answers
Using AVAudioEngine to record to compressed file
I'm trying to use AVAudioEngine to record sounds from the microphone together with various sound effect files to a AVAudioFile.
I create an AVAudioFile like this:
let settings = self.engine.mainMixerNode.outputFormatForBus(0).settings
try…

rodskagg
- 3,827
- 4
- 27
- 46
4
votes
1 answer
AVAudioEngine incorrect time management and callback for AVAudioPlayerNode
I have a serious issue with the new audio engine in iOS8. I have an application, which is built with AVAudioPlayer and I am trying to figure out a way to migrate to the new architecture, however I bumped into the following problem (which I'm sure…

Lehel Medves
- 527
- 1
- 5
- 15
3
votes
2 answers
AVAudioFile write not working Swift iOS 14
I have the following function:
private func getPCMBuffer(utterance: AVSpeechUtterance,
completion: @escaping (Result) -> Void
) {
speechSynthesizer.write(utterance) { (buffer: AVAudioBuffer)…

Ali
- 31
- 3
3
votes
1 answer
Converting AVAudioPCMBuffer to another AVAudioPCMBuffer
I am trying to convert a determined AVAudioPCMBuffer (44.1khz, 1ch, float32, not interleaved) to another AVAudioPCMBuffer (16khz, 1ch, int16, not interleaved) using AVAudioConverter and write it using AVAudioFile.
My code uses the library AudioKit…

Pedro Paulo Amorim
- 1,838
- 2
- 27
- 50
3
votes
0 answers
Installing tap on mixer node and convert sample rate
I am attempting to record audio from the input node and sending it to a mixer to convert the audio to a lowered sample rate to be written to disk.
My audio file is created like this:
let sett = [
AVSampleRateKey : NSNumber(double: 22050),
…

hola
- 3,150
- 13
- 21
3
votes
1 answer
Save Audio File after apply Filter(AVAudioUnitEQ) and finally save it as mp3?
I am so Frustrating to save the Audio File After Apply the Filter. The filter only applicable for the AVAudioPlayerNode which mean during Playing in the player the filter is perfect to apply but how can i save this ? I am so struggle last 3 days,…

S. Karthik
- 618
- 5
- 16
3
votes
0 answers
How To Install Tap On AudioEngine OutputNode
I am trying to save processed audio from AudioEngine OutputNode To AVAudioFile.
Well Till Now What I Know Is That It Can Be Done Using Tap But Dont know how.
I Would Like To Know To How Install Tap On AudioEngine OutputNode.

Mihir Gurjar
- 375
- 1
- 7
2
votes
0 answers
How can I resample an audio file programatically in swift?
I would like to know if it's possible to resample an already written AVAudioFile.
All the references that I found don't work on this particular problem, since:
They propose the resampling while the user is recording an AVAudioFile, while installTap…

Miguel de Sousa
- 131
- 16
2
votes
0 answers
AVAudioFile (Mac/iOS) : encode audio to constant bitrate AAC
I would like to encode audio buffers to M4A/AAC file using AVAudioFile. It works except that the output file is always AAC with a variable bitrate, even when I configure the AVAudioFile with specific constant bitrate flag.
Here is the code of…

Nitenq
- 193
- 12
2
votes
0 answers
How to export a sample of a file with AudioKit 5.0.b1?
I am trying to update my app so it can run using Xcode 12.0 beta 3 (12A8169g) and AudioKit 5.0.b1. Previously I had this code to export my AKAudioFile into a desired format and with defined start and end positions:
let sampleRate =…

pckill
- 3,709
- 36
- 48
2
votes
1 answer
Crash on Read AVAudioFile Buffer Create Waves Swift
I have been working in AVAudioPlayer and draw a wave. I am using AudioArmada Github pods to draw waves With the help of AudioArmada Pods. But Some Cases AVAudioFile Crash on reading buffer time.
Code Below:
public func openFile(_ file: URL) {
…

Sham Dhiman
- 1,348
- 1
- 21
- 59
2
votes
0 answers
AVAudioFIle Read iOS swift Normalisation
When i try to read an audio file in swift using AVAudioFile.read() all the amplitude values are between -1 and 1.But when i read the values in python using librosa library i get different amplitude values.I think some kind of normalization is done…
2
votes
1 answer
Filtering frequencies from .m4a data
I'm trying to analyze a sound file (.m4a) to get the amplitudes over time and make a graph. I found some code online that works great (below). However, I would like to additionally filter out all sounds that are not in a targeted frequency range.…

Anters Bear
- 1,816
- 1
- 15
- 41
2
votes
2 answers
AVAudioFile init works on simulator but crashes on device
I want to build an iOS app (using Swift 3 and Xcode 8.2.1) that records from the microphone of an iPhone and saves the record to a .caf file.
First, I've added the following lines to the Info.plist file of my…

Imanou Petit
- 89,880
- 29
- 256
- 218