Questions tagged [avaudiopcmbuffer]
54 questions
3
votes
1 answer
Problem reading audio file recorded with AudioKit into an AVPlayer intsance
I'm in a situation where I need to export an audio file recorded with AudioKit, and then reimport it later for use some processing via AVAudioPCMBuffer.
Below is the code I'm using for exporting from AudioKit:
tape = recorder.audioFile!
…

narner
- 2,908
- 3
- 26
- 63
3
votes
1 answer
Swift: How to stop scheduleBuffer completion handler being called when interrupted?
I have a AVAudioPlayerNode that I'm scheduling a lot of buffers on using the following:
node.scheduleBuffer(buffer, at: nil, options: .interrupts, completionHandler: completeFunc)
But I'm having a bit of a problem. If I play another buffer…

MysteryPancake
- 1,365
- 1
- 18
- 47
3
votes
2 answers
AVAudioPCMBuffer built programmatically, not playing back in stereo
I'm trying to fill an AVAudioPCMBuffer programmatically in Swift to build a metronome. This is the first real app I'm trying to build, so it's also my first audio app. Right now I'm experimenting with different frameworks and methods of getting the…

JGHof
- 95
- 2
- 9
3
votes
0 answers
how to create AVAudioPCMBuffer from NSData
I receive mp3 from stream and convert pcm data. I try to use AVAudioEngine but can not create AVAudioPCMBuffer without file.
- (void)playAudio:(NSNotification *)notification {
self.runAudioThread = YES;
dispatch_queue_t…

bonggil.jeon
- 31
- 3
3
votes
0 answers
How to remove silence from an audioFile
I have recorded an audio file using AVAudioEngine:
[mainMixer installTapOnBus:0 bufferSize:4096 format:[mainMixer outputFormatForBus:0] block:^(AVAudioPCMBuffer *buffer, AVAudioTime *when) {
NSError *error;
// as AVAudioPCMBuffer's are…

Thomas
- 177
- 2
- 9
3
votes
1 answer
Audible glitches on buffer playback via AVAudioPlayerNode in iOS (Swift) *working in simulator, but not on device
When using an AVAudioPlayerNode to schedule a short buffer to play immediately on a touch event ("Touch Up Inside"), I've noticed audible glitches / artifacts on playback while testing. The audio does not glitch at all in iOS simulator, however…

nastynate13
- 116
- 7
2
votes
1 answer
What value to put for frameCapacity in AVAudioPCMBuffer initializer?
I'm making a metronome using AVAudioEngine, AVAudioPlayerNode, and AVAudioPCMBuffer. The buffer is created like so:
/// URL of the sound file
let soundURL = Bundle.main.url(forResource: , withExtension: "wav")!
/// Create audio file
let…

Miles
- 487
- 3
- 12
2
votes
1 answer
AVAudioPCMBuffer as Base64
How can the data from an AVAudioPCMBuffer be obtained as a Base64 encoded string, with Swift?
I'm asking as I'd like to send data from the microphone input on an iOS device to a WebSocket.

Bjorn Thor Jonsson
- 827
- 1
- 10
- 21
2
votes
1 answer
Converting AvAudioInputNode to S16LE PCM
I'm trying to convert input node format to S16LE format. I've tried it with AVAudioMixerNode
First I create audio session
do {
try audioSession.setCategory(.record)
try audioSession.setActive(true)
} catch {
...
}
//Define formats
let…

Tadej Slemenšek
- 94
- 5
2
votes
0 answers
Writing audio from AVAsset to AVAudioPCMBuffer
I am a bit lost, trying to write the audio track of a video file that I loaded into an AVAsset into a AVAudioPCMBuffer.
I found some tutorials in C but I only know swift.
Does anybody know how to do it?
Would be great!

Hoerbarium
- 31
- 3
2
votes
0 answers
Extract CMSampleBuffer from an mp3 file swift
I am trying to extract CMSampleBuffer from an mp3 file to use it for my recording video. Here is the code:
First get PCM buffer from mp3
guard let audioPCMBuffer = AVAudioPCMBuffer(pcmFormat: audioFile.processingFormat,
…

sahara108
- 2,829
- 1
- 22
- 41
2
votes
1 answer
AVAudioCompressedBuffer to UInt8 array and vice versa
I would like to know how to get the bytes of an AVAudioCompressedBuffer and then
reconstruct an AVAudioCompressedBuffer from the bytes.
The code below takes an AVAudioPCMBuffer, compresses it with AVAudioConverter to AVAudioCompressedBuffer (iLBC)…

Ruan Sunkel
- 201
- 1
- 8
2
votes
1 answer
Swift: AVAudioPCMBuffer vs AVAudioBuffer vs AVAudioCompressedBuffer
I'm currently using an AVAudioPCMBuffer to play a .wav file in a simple game. However, when checking the documentation for it, I came across two other types of buffers I never saw anywhere else, the ones in the title: AVAudioBuffer and…

MysteryPancake
- 1,365
- 1
- 18
- 47
2
votes
1 answer
Listening AVAudioPCMBuffer
I've implemented installTap method, which provides me audio buffer float samples. I've filtered them by my C++ DSP library. I want to "send" this buffer to headphones/speaker. I've did AVAudioPCMBuffer again from samples. Anyone know how to do that?…

Szymon Mrozek
- 117
- 1
- 6
2
votes
2 answers
Swift 3: Get length of AVAudioPCMBuffer as TimeInterval?
I'm trying to get the time length of an AVAudioPCMBuffer, but I can't seem to do it. I tried doing the following:
func getLength(buffer: AVAudioPCMBuffer) -> TimeInterval {
let framecount = buffer.frameCapacity
let bytesperframe =…

MysteryPancake
- 1,365
- 1
- 18
- 47