Questions tagged [avaudioplayernode]

110 questions
1
vote
1 answer

Why can't I create an AVAudioFile on Mac Catalyst? (error -54)

My app lets users select an audio recording from their iTunes media library, then saves the media ID for later playback. From the media ID, I can use MPMediaQuery to get an MPMediaItem, then get the recording URL: let recordingURL =…
1
vote
1 answer

Swift: Play gapless audio with AVAudioEngine (AVAudioPlayerNode)?

Basically, I am trying to play AAC(with ADTS header) streams with AudioEngine through websockets (I am using StarScream). I play these audio in real time and there are glitches between the audio packets while playing. These are the steps I…
sudayn
  • 1,169
  • 11
  • 14
1
vote
0 answers

AVAudioPlayerNode - State of playback and start/finish notifications

I have an AVAudioPlayerNode object that is linked with an AVAudioEngine. I used the schedule method to load them in the queue. How can I know the state of the playback and when a single file start and finish to play? This is the code I use for…
Andrea Mario Lufino
  • 7,921
  • 12
  • 47
  • 78
1
vote
2 answers

Playing a stereo audio buffer from memory with AVAudioEngine

I am trying to play a stereo audio buffer from memory (not from a file) in my iOS app but my application crashes when I attempt to attach the AVAudioPlayerNode 'playerNode' to the AVAudioEngine 'audioEngine'. The error code that I get is as…
Maxadax
  • 11
  • 4
1
vote
0 answers

AVAudioPlayer.play() works but AVAudioPlayerNode.play() fails

I have the following Swift playground code that plays an audio file using AVAudioPlayerNode. import AVFoundation import Foundation NSSetUncaughtExceptionHandler { exception in print("Exception thrown: \(exception)") } var filePath =…
fractor
  • 1,534
  • 2
  • 15
  • 30
1
vote
1 answer

Objective-C: Getting 0s from the floatChannelData in AVAudioEngine

I am listing from the mic using AVAudioEngine by this code: NSError *err2 = nil; engine = [[AVAudioEngine alloc] init]; mainMixer = [engine mainMixerNode]; [mainMixer installTapOnBus:0 bufferSize:1024 format:[mainMixer outputFormatForBus:0]…
1
vote
1 answer

How to stop an avaudioplayernode set to loop indefinitely at the end of current loop

Im using an AVAudioPlayerNode to loop playback of an audio file in buffer and need to be able to switch to the next track when the user clicks next but switch at the end of the loop instead of as soon as the user clicks next Here's the code I use to…
Deji Toki
  • 11
  • 3
1
vote
1 answer

Swift: Trying to control time in AVAudioPlayerNode using UISlider

I'm using an AVAudioPlayerNode attached to an AVAudioEngine to play a sound. to get the current time of the player I'm doing this: extension AVAudioPlayerNode { var currentTime: TimeInterval { get { if let nodeTime: AVAudioTime =…
mahdi
  • 149
  • 12
1
vote
1 answer

AVFoundation positional audio not working on iOS device

I'm trying to play positional audio in a Swift iOS app using AVAudioEngine and AVAudioEnvironmentNode. I can successfully play the audio fine and hear it spatialized, shifting between both outputs in stereo, but only in the simulator. When I run the…
1
vote
1 answer

AVAudioPlayerNode does not play sound

The AudioPlayerNode is an instance variable code is a follows: class HXAudioEngine { private var audioEngine: AVAudioEngine = AVAudioEngine() var digitFileUrl: URL? { didSet { if let digitUrl = digitFileUrl { do…
Alexander
  • 1,424
  • 18
  • 23
1
vote
2 answers

Repeating Audio in WatchKit (AVAudioPlayer?)?

I am wanting to loop a local audio file in my Apple Watch App. Currently I am using AVAudioPlayerNode and AVAudioEngine which works well but I cannot figure out how to loop the sound. I noticed that I can use AVAudioPlayer, which has the handy…
1
vote
1 answer

Change audio volume of some channels using AVAudioEngine

I'm working on a mac application that mix audio from a VideoCard and an external audio card. How can I change volume on each channel (not each source) independently using AVAudioEngine. Let's say I have an AVAudioPCMBuffer with 16 channels…
1
vote
1 answer

AVAudioEngine Realtime Audio Playing Issue

I am working on a push to talk functionality where sender can send an audio in form of bytes array to server and receiver can listen it at realtime through socket connection. when i try to play video at receiver end using AVAudioEngine, it's not…
1
vote
1 answer

AVAudioPlayerNode using AVAudioPCMBuffer - no audio playing

I am trying to play audio from a PCMBuffer. When I run the below code, for some reason, no audio plays. I do not get any errors. let engine = AVAudioEngine() let player = AVAudioPlayerNode() let inputFormat = AVAudioFormat( commonFormat:…
1
vote
0 answers

In AVAudioEngine The AVAudioPlayerNode output doesn't seem to be the AVAudioUnitNode input

I attached an AVAudioPlayerNode to an AVAudioEngine, defined a File linked to the playerNode. I attached an AVAudioUnitNode linked to my own AUAudioUnit. First time. I connected the playerNode directly to the mainMixerNode and when i start playing…