Questions tagged [avaudiopcmbuffer]
41 questions
17
votes
2 answers
Convert AVAudioPCMBuffer to NSData and back
How to convert AVAudioPCMBuffer to NSData? If it should be done as
let data = NSData(bytes: buffer.floatChannelData, length: bufferLength)
then how to calculate bufferLength?
And how to convert NSData to AVAudioPCMBuffer?
![](../../users/profiles/592035.webp)
Shmidt
- 15,652
- 16
- 79
- 129
14
votes
1 answer
Decode AAC to PCM format using AVAudioConverter Swift
How convert AAC to PCM using AVAudioConverter, AVAudioCompressedBuffer and AVAudioPCMBuffer on Swift?
On WWDC 2015, 507 Session was said, that AVAudioConverter can encode and decode PCM buffer, was showed encode example, but wasn't showed examples…
![](../../users/profiles/4906561.webp)
Vladimir Prigarin
- 406
- 4
- 20
9
votes
5 answers
how to play sound with AVAudioPCMBuffer
I Cannot play sound with AVAudioPCMBuffer (though I could play with AVAudioFile).
I got this error.
ERROR:
AVAudioBuffer.mm:169: -[AVAudioPCMBuffer initWithPCMFormat:frameCapacity:]: required condition is false: isCommonFormat
here is my code below,…
![](../../users/profiles/4021376.webp)
Bick
- 713
- 1
- 8
- 17
8
votes
2 answers
On extracting the sound pressure level from AVAudioPCMBuffer
I have almost no knowledge in signal-processing and currently I'm trying to implement a function in Swift that triggers an event when there is an increase in the sound pressure level (e.g. when a human screams).
I am tapping into an input node of…
![](../../users/profiles/2041954.webp)
Archy Will He 何魏奇
- 9,103
- 4
- 29
- 47
4
votes
0 answers
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.floatChannelData![0], count:Int(buffer.frameLength)))
let…
![](../../users/profiles/3703910.webp)
user3703910
- 604
- 1
- 5
- 22
4
votes
1 answer
Accessing Float samples of AVAudioPCMBuffer for processing
I am trying to do some computation on the raw PCM samples of a mp3 files I'm playing with an AVAudioEngine graph. I have a closure every 44100 samples that provides an AVAudioPCMBuffer. It has a property channelData of type…
![](../../users/profiles/5797668.webp)
Alex Bollbach
- 3,730
- 2
- 25
- 61
4
votes
0 answers
How to save the audio recorded with pitch changed?
I'm working on recording the voice then change the pitch of the audio and save.
I call this method after recording the voice and click on the button to change the pitch then the new file is also created but the not not able to listen the audio the…
![](../../users/profiles/6555978.webp)
Mitesh Varu
- 254
- 1
- 12
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…
![](../../users/profiles/6580287.webp)
aseago
- 43
- 4
4
votes
0 answers
Writing mono AVAudioPCMBuffer to stereo AVAudioFile
I'm using AVAudioEngine to record audio, and saving it as a sound file.
The user can choose to import an audio file, and they can then continue to record at the end of this file if they wish to. I'm getting the audio data from the imported file by…
![](../../users/profiles/543224.webp)
andlin
- 3,534
- 3
- 25
- 43
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…
![](../../users/profiles/6931415.webp)
MysteryPancake
- 1,125
- 1
- 13
- 36
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…
![](../../users/profiles/4468607.webp)
JGHof
- 85
- 8
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…
![](../../users/profiles/5755657.webp)
bonggil.jeon
- 31
- 2
3
votes
0 answers
How to modify a AVAudioPCMBuffer in swift
does anybody know how to modify the buffer contents of
an AVAudioPCMBuffer object? I want to do the following:
load an audio file into an AVAudioPCMBuffer - this works.
modify the samples data of the AVAudioPCMBuffer. - here i stuck
write the…
![](../../users/profiles/4946861.webp)
nik
- 151
- 1
- 6
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…
![](../../users/profiles/4508508.webp)
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…
![](../../users/profiles/4651933.webp)
nastynate13
- 116
- 6