Converting AVAudioPCMBuffer to NSData
问题 I'm currently trying to convert the audio samples from AVAudioPCMBuffer to NSData - I had taken a look at the accepted answer on this SO Post and this code from GitHub but it appears some of the AVFAudio API's have changed...below is the extension I have for AVAudioPCMBuffer : private extension AVAudioPCMBuffer { func toNSData() -> NSData { let channels = UnsafeBufferPointer(start: int16ChannelData, count: 1) let ch0Data = NSData(bytes: channels[0], length:Int(frameCapacity * format