avaudioplayernode

Playing an audio file repeatedly with AVAudioEngine

試著忘記壹切 提交于 2020-07-05 04:15:27
问题 I'm working on an iOS app with Swift and Xcode 6. What I would like to do is play an audio file using an AVAudioEngine, and until this point everything OK. But how can I play it without stopping, I mean, that when it ends playing it starts again? This is my code: /*==================== CONFIGURATES THE AVAUDIOENGINE ===========*/ audioEngine.reset() //Resets any previous configuration on AudioEngine let audioPlayerNode = AVAudioPlayerNode() //The node that will play the actual sound

Playing an audio file repeatedly with AVAudioEngine

故事扮演 提交于 2020-07-05 04:14:11
问题 I'm working on an iOS app with Swift and Xcode 6. What I would like to do is play an audio file using an AVAudioEngine, and until this point everything OK. But how can I play it without stopping, I mean, that when it ends playing it starts again? This is my code: /*==================== CONFIGURATES THE AVAUDIOENGINE ===========*/ audioEngine.reset() //Resets any previous configuration on AudioEngine let audioPlayerNode = AVAudioPlayerNode() //The node that will play the actual sound

Build a simple Equalizer

旧巷老猫 提交于 2020-06-25 00:57:26
问题 I would like to make a 5-band audio equalizer (60Hz, 230Hz, 910Hz, 4kHz, 14kHz) using AVAudioEngine . I would like to have the user input gain per band through a vertical slider and accordingly adjust the audio that is playing. I tried using AVAudioUnitEQ to do this, but I hear no difference when playing the audio. I tried to hardcode in values to specify a gain at each frequency, but it still does not work. Here is the code I have: var audioEngine: AVAudioEngine = AVAudioEngine() var

Using AVAudioEngine to schedule sounds for low-latency metronome

倾然丶 夕夏残阳落幕 提交于 2020-06-09 17:44:58
问题 I am creating a metronome as part of a larger app and I have a few very short wav files to use as the individual sounds. I would like to use AVAudioEngine because NSTimer has significant latency problems and Core Audio seems rather daunting to implement in Swift. I'm attempting the following, but I'm currently unable to implement the first 3 steps and I'm wondering if there is a better way. Code outline: Create an array of file URLs according to the metronome's current settings (number of

AVAudioPlayerNode doesn't play sound

烂漫一生 提交于 2020-01-24 09:20:10
问题 I'm trying to generate sound with code below. Everthing is fine there is no error. But when I executed this code, there is no sound. How can I fix this problem ? By the way, I'm using this example : http://www.tmroyal.com/playing-sounds-in-swift-audioengine.html var ae:AVAudioEngine var player:AVAudioPlayerNode? var mixer:AVAudioMixerNode var buffer:AVAudioPCMBuffer ae = AVAudioEngine() player = AVAudioPlayerNode() mixer = ae.mainMixerNode; buffer = AVAudioPCMBuffer(pcmFormat: player!

How to play multiple sounds from buffer simultaneously using nodes connected to AVAudioEngine's mixer

若如初见. 提交于 2020-01-14 04:28:07
问题 I am making a basic music app for iOS, where pressing notes causes the corresponding sound to play. I am trying to get multiple sounds stored in buffers to play simultaneously with minimal latency. However, I can only get one sound to play at any time. I initially set up my sounds using multiple AVAudioPlayer objects, assigning a sound to each player. While it did play multiple sounds simultaneously, it didn't seem like it was capable of starting two sounds at the same time (it seemed like it

AVAudioPlayerNode does not play sound

旧城冷巷雨未停 提交于 2019-12-23 04:55:11
问题 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 { digitAudioFile = try AVAudioFile(forReading: digitUrl) } catch let error { print("Error loading Digit file: \(error.localizedDescription)") } } } } var digitAudioFile: AVAudioFile? { didSet { if let digitFile = digitAudioFile { digitAudioFormat = digitFile.processingFormat