Questions tagged [avaudiofile]
The avaudiofile tag has no usage guidance.
61
questions
0
votes
0
answers
50
views
How to export AVAudioPCMBuffer to wav file?
let fileURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("test.wav")
synthesizer.write(utterance) { buffer in
guard let pcmBuffer = buffer as? ...
0
votes
1
answer
52
views
My writing the installTap buffer to an AVAudioFile seems to fail data-wise
I am trying to save the buffer from my installTap to a file. I do it in chunks of 10 so I'll get a bigger file. When I try to play the written file (from the simulator's directory) QuickTime says that ...
1
vote
1
answer
33
views
How to use AVFAudio's SDK to Record, Play and save audio
Ive been trying to implement the AVFoundation's framework AVFAudio in order to record audio, play audio, as well as change the audio data per the user's selected presets. Ive also been trying to find ...
0
votes
0
answers
168
views
How to do seek logic AVAudioEngine with AVAudioPCMBuffer
I have a raw audio byte stream that I got from the native lib, in order to make it work I convert it to AVAudioPCMBuffer that I can use with AVAudioEngine like this
...
player.scheduleBuffer(...
1
vote
0
answers
293
views
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,...
2
votes
2
answers
374
views
AVAudioFile write not working Swift iOS 14
I have the following function:
private func getPCMBuffer(utterance: AVSpeechUtterance,
completion: @escaping (Result<AVAudioPCMBuffer, Failures>) -> Void
) {
...
0
votes
1
answer
103
views
Get samples of audio clip in AVAudioPlayer?
Is there a property on the AVAudioPlayer class that I can use to get the samples? If not is there another class I can use to get this information?
Here's what I have:
var openDialog = NSOpenPanel....
2
votes
0
answers
255
views
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 ...
0
votes
1
answer
277
views
AVAudio and Offline Manual Rendering Mode - can't write buffers of higher frequencies into output file
I'm reading an input file and with the offline manual rendering mode, I want to perform amplitude modulation and to write the result to an output file.
For the sake of testing, I produce pure sine ...
1
vote
1
answer
244
views
Setting AVAudioFile `framePosition` causes crash
Whenever I set the framePosition of an AVAudioFile to something other than the current framePosition I get a crash:
error - 6658
which I looked up in the Apple Docs and is:
...
-1
votes
1
answer
118
views
Combining 2 audio files is Swift
I am trying to combine 2 audio files.
The main problem is that audio files are lossless .flac files.
I tried creating AVMutableComposition, then creating 2 AVURLAsset for each audio and use ...
2
votes
0
answers
91
views
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 ...
2
votes
0
answers
149
views
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 ...
0
votes
0
answers
152
views
How to write to an AMR-WB file in multichannel mode with Python under linux from RTP PAYLOAD
I've successfully written the RTP-payload into an amr-file and it works fine, according to the answer written in this question.
https://stackoverflow.com/questions/61961965/convert-rtp-payload-payload-...
1
vote
1
answer
262
views
How can I store and retrieve audio files to and from CloudKit?
I am attempting to record voice messages and store them as CKAssets on CloudKit. I convert them into an AVAudioFile and save them to CloudKit as one of several properties on a Post record.
var ...
0
votes
1
answer
324
views
Audio from a file generated from an AVAudioEngine bus tap has different speed than the one played on device output
I am generating audio with an AVAudioEngine. I am then installing a tap on the mainMixerNode output of the engine which provides a AVAudioPCMBuffer which is then written into an MPEG4ACC AVAudioFile. ...
0
votes
1
answer
528
views
How to add observer to play and pause actions for audio file in WKWebview?
I want to add notifications for play and pause actions of audio file in wkwebview,
Image shows how audio files are in WKWebview
1
vote
3
answers
2k
views
How can I use audio file as audio source in SpeechRecognition in Python?
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
...
2
votes
1
answer
964
views
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 ...
1
vote
0
answers
48
views
Is it possible to use stream urls instead of downloading media to disk when instantiating an AVAudioPlayerNode?
We are using Amazon Cloudfront to stream audio to the iOS application. We need specific functionality that is only available on the AVAudioEngine which is why we are trying to instantiate ...
4
votes
0
answers
115
views
Change encoder format version
I have, for the past week, been trying to take audio from the microphone (on iOS), down sample it and write that to a '.aac' file.
I've finally gotten to point where it's almost working
let ...
3
votes
2
answers
1k
views
Error when installing a tap on audio engine input node
whenever the code reaches
inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) {[weak self] (buffer:AVAudioPCMBuffer, when:AVAudioTime), app is crashing with following error
...
0
votes
1
answer
1k
views
Play an audio file using Swift for MacOS
I'm trying to simply play a file (in the main bundle or on the disk) using AVAudioFile, AVAudioEngine and AVAudioPlayerNode.
Here is what I'm doing:
import Foundation
import AppKit
import ...
3
votes
1
answer
4k
views
Writing AVAudioPCMBuffer into an AVAudioFile compressed
We're working on an application which records and persists microphone input. The use of AVAudioRecorder was not an option, because real-time audio processing is needed.
AVAudioEngine is used because ...
1
vote
0
answers
78
views
Is it possible to merge two different AVAudioPlayer tracks
I have two instances of AVAudioPlayer playing two different tracks with different volume and rate (One is instrumental track and other is recording of song). I want to merge those two tracks to a ...
1
vote
2
answers
934
views
How do I write AVAudioCompressedBuffer to an AAC file in iOS?
I've successfully converted the AVAudioPCMBuffers from AVAudioEngine into AVAudioCompressedBuffers with an AAC format. Now I'm trying to write those buffers to a file but don't know how to do it. ...
0
votes
1
answer
418
views
Play audio from float arrays iOS Swift
I have 2 float arrays one representing the left channel values and the other representing the right channel values. How can I create and play music from these two arrays?(Sample Rate = 44100) TIA
1
vote
0
answers
607
views
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 ...
3
votes
1
answer
2k
views
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 ...
-1
votes
2
answers
136
views
Can't play sound in java using clip
I want to play some sound in java using this code bellow. That sound is in WAV format so I think that this code should work fine, but instead of playing sound it simply does nothing. There is no even ...
2
votes
1
answer
434
views
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 ...
3
votes
1
answer
603
views
Read an AVAudioFile into a buffer starting at a certain time
Let's say I have an AVAudioFile with a duration of 10 seconds. I want to load that file into an AVAudioPCMBuffer but I only want to load the audio frames that come after a certain number of seconds/...
0
votes
0
answers
735
views
How to read an AVAudioFile into the same AVAudioPCMBuffer multiple times?
EDIT:
I was able to prevent readIntoBuffer from returning false by adding audioFileB.framePosition = 0; at the end of my for loop. However, now it looks like bufferB only contains audio from the final ...
0
votes
1
answer
584
views
How can I play multiple different audio files from same AVAudioEngine? (Error: !nodeimpl->HasEngineImpl())
In my app I want to play a different audio file every time a different cell in the table view is pressed. Below is my implementation but I keep receiving the error:
Terminating app due to uncaught ...
4
votes
1
answer
1k
views
How can I play a sound from the asset catalog using AVAudioPlayerNode?
I'm trying to use an AVAudioPlayerNode to play sounds from the Assets.xcassets asset catalog, but I can't figure out how to do it.
I've been using AVAudioPlayer, which can be initialized with an ...
5
votes
3
answers
4k
views
How to search the error code of 'com.apple.coreaudio.avfaudio'?
Where could I get the information of com.apple.coreaudio.avfaudio error codes, such as:
Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error -50'
I always get ...
4
votes
0
answers
603
views
IOS copying a part of AVAudioPCMBuffer to another
I have AVAudioPCMBuffer which I want to copy a portion of to other buffer (cutting some part of the voice from the end of it )
let samples = Array(UnsafeBufferPointer(start: buffer....
1
vote
1
answer
471
views
Reversing an audio file
I'm using AVAssetReader and AVAssetWriter to reverse an audio file. However, the resulting reversed audio is very jerky.
What's the best practice for reversing an audio file?
Any help is much ...
2
votes
1
answer
1k
views
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 ...
0
votes
1
answer
978
views
swift FFT chunk audio file to get Amplitude
i need your help. in want to use the FFT on my audio file. i want to cut my audio file in more little buffer array and use my FFT with all sub buffer.
why ?? because i need to know and see (with ...
4
votes
2
answers
587
views
iOS Swift malloc error
I want to record audio on iOS in real time, analyze the raw audio data and save parts of the recorded data. I'm recording the data with this code: https://gist.github.com/hotpaw2/...
2
votes
3
answers
2k
views
Convert audio into raw PCM data of type [Double]
I'm trying to convert a recorded audio file into raw PCM data of type [Double]. I found a way to load and convert audio to PCM data of the type [Float32] like this:
// load audio from path
...
2
votes
2
answers
1k
views
How to save AVAudioFile to document directory?
I want to save AVAudioFile to document directory with NSDictionary. Can anyone help me?
AVAudioFile *audiofile=[[AVAudioFile alloc] initForWriting:destinationURL settings:settings error:&error];
...
1
vote
1
answer
439
views
how to change the pitch of recorded audio getting me following error
Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: node != nil'
AVAudioFile *file=[[AVAudioFile alloc] initForReading:_recordedvoice ...
4
votes
1
answer
1k
views
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 ...
5
votes
0
answers
145
views
During cascading 2 audio files tracksWithMediaType always returns empty array
I have 2 audio files audioFile1.m4a and audioFile2.m4a. I want to create a cascaded audio combined.m4a which contains audioFile1.m4a and audioFile2.m4a, one after another. I used below code and my ...
0
votes
2
answers
1k
views
can't find audio file after recording
i created a voice recorder in android studio, but i cant find the recorded file on my phone. normally am meant to attach it to an email that will be sent, but i cant find it on my phone for me to add ...
1
vote
1
answer
2k
views
Tapping microphone on AVAudioEngine input not working
I am setting up an AVAudioEngine implementation to take audio from the microphone and stream it to a websocket connection. First things first, I have tapped the microphone input and an intermediate ...
0
votes
2
answers
474
views
AVAudioFile can not read file from document directory
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString ...
3
votes
0
answers
606
views
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 = [
...