Questions tagged [avaudioplayernode]

110 questions
3
votes
0 answers

AVAudioPlayerNode cancel scheduled

The AVAudioPlayerNode stop() function " Clear all of the node's previously scheduled events and stop playback. " Need to clear all the node's previously scheduled without stopping the player. Any idea ?
Fischer
  • 1,513
  • 4
  • 17
  • 38
3
votes
1 answer

AVAudoPlayerNode to play a sound for a defined number of times

Is it possible in AVAudioPlayerNode to loop an audio sound for a number of times only instead of infinite times? The below code scheduled the audio for an infinite number of times instead of saying 5 times. aVAudioPlayerNode.scheduleBuffer(buffer!,…
Simant
  • 3,142
  • 4
  • 32
  • 61
3
votes
2 answers

iOS AVAudioPlayerNode buffer completion handler for each loop

Is there a way to have a completion handler for each loop when scheduling a buffer? self.audioPlayerNode.scheduleBuffer(buffer, at: nil, options: .loops, completionHandler: completionHandler) // call each loop, not only on the buffer end func…
3
votes
0 answers

using AVAudioplayerNode play at particular NSTimeInterval time

How to manage audio based UISlider using AVAudioPlayerNode.I am able to show playing time using NSTimer But I am unable to forward and rewind using UISlider _viewPlayerDuration.duration = duration; _viewPlayerDuration.currentTime = rTimer; …
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
1 answer

AVAudioPlayerNode produces click / popping noise when using stop

I need some help here. I am converting part of my IOS app code from OpenAL to AVAudioEngine since OpenAL does not seem to work well in IOS 9. I am having the following issue. When I call the stop method for a AVAudioPlayerNode, I get a very audible…
MadH
  • 41
  • 4
3
votes
1 answer

AVAudioEngine schedule sample accurate parameter changes

I am trying to create an app using a combination of AVAudioPlayerNode instances and other AUAudioUnits for EQ and compression etc. Everything connects up well and using the V3 version of the API certainly makes configuration easier for connecting…
Dallas Johnson
  • 1,546
  • 10
  • 13
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…
3
votes
1 answer

Passing mono audio data to AVAudioEnvironmentNode

I am attempting to use an AVAudioEnvironmentNode to produce 3D spatialized sound for a game I'm working on. The AVAudioEnvironmentNode documentation states, "It is important to note that only inputs with a mono channel connection format to the…
3
votes
2 answers

Swift: required condition is false: file != nil

The app runs fine but as soon as I tap chipmunkButton the app crashes and provides the following error: ERROR: AVAudioPlayerNode.mm:678: -[AVAudioPlayerNode scheduleFile:atTime:completionHandler:]: required condition is false: file != nil…
Perceptum
  • 43
  • 1
  • 4
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…
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
2 answers

Timing issues: Metronome using AVAudioEngine scheduleBuffer's completion handler

I want to build a simple metronome app using AVAudioEngine with these features: Solid timing (I know, I know, I should be using Audio Units, but I'm still struggling with Core Audio stuff / Obj-C wrappers etc.) Two different sounds on the "1" and…
McNail
  • 100
  • 8
2
votes
1 answer

AVAudioPlayerNode completion callbacks not called for files scheduled consecutively

When scheduling files or buffers with AVAudioPlayerNode, you can submit a completion callback. You can also specify for what event the callback should be called, the options being: dataConsumed dataRendered dataPlayedBack In most cases, this works…
scg
  • 449
  • 1
  • 3
  • 11
2
votes
1 answer

How to have hight priority thread for audio processing

I have iOS app where I am playing audio using AVAudioEngine. I read frames from AudioFile into AVAudioPCMBuffer and then I post buffer to AVAudioPlayerNode.scheduleBuffer. I read frames on DispatchQueue . Problem I have is that when app has a lot of…
Martin Vandzura
  • 3,047
  • 1
  • 31
  • 63