avaudioplayernode

SWIFT - Is it possible to save audio from AVAudioEngine, or from AudioPlayerNode? If yes, how?

可紊 提交于 2019-12-03 07:50:41
问题 I've been looking around Swift documentation to save an audio output from AVAudioEngine but I couldn't find any useful tip. Any suggestion? Solution I found a way around thanks to matt's answer. Here a sample code of how to save an audio after passing it through an AVAudioEngine (i think that technically it's before) newAudio = AVAudioFile(forWriting: newAudio.url, settings: nil, error: NSErrorPointer()) //Your new file on which you want to save some changed audio, and prepared to be bufferd

Swift: Trying to control time in AVAudioPlayerNode using UISlider

点点圈 提交于 2019-12-02 09:04:46
问题 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 = self.lastRenderTime, let playerTime: AVAudioTime = self.playerTime(forNodeTime: nodeTime) { return Double(playerTime.sampleTime) / playerTime.sampleRate } return 0 } } } I have a slider that indicates the current time of the audio. When the user changes the slider

Using sound effects with AudioEngine

99封情书 提交于 2019-11-28 16:24:52
Background - I saw a video titled "AVAudioEngine in Practice" from the following list of videos published at Apple's recent WWDC to apply sound effects to an audio. https://developer.apple.com/videos/wwdc/2014/ After that, I was successfully able to change the pitch of an audio with the following code: //Audio Engine is initialized in viewDidLoad() audioEngine = AVAudioEngine() //The following Action is called on clicking a button @IBAction func chipmunkPlayback(sender: UIButton) { var pitchPlayer = AVAudioPlayerNode() var timePitch = AVAudioUnitTimePitch() timePitch.pitch = 1000 audioEngine