问题
I'm making audio editing app, and I want trim my audio. For audio editing I use AudioKit framework. But I can't find in tutorials, and examples, how I can trim audio using this framework?
回答1:
Export asynchronously allows for setting the start and end samples:
https://github.com/AudioKit/AudioKit/blob/master/AudioKit/Common/Internals/Audio%20File/AKAudioFile%2BProcessingAsynchronously.swift#L267
/// Exports Asynchronously to a new AKAudiofile with trimming options.
///
...
/// - fromSample: start range in samples
/// - toSample: end range time in samples
...
public func exportAsynchronously(name: String,
baseDir: BaseDirectory,
exportFormat: ExportFormat,
fromSample: Int64 = 0,
toSample: Int64 = 0,
callback: @escaping AsyncProcessCallback) {
let fromFileExt = fileExt.lowercased()
来源:https://stackoverflow.com/questions/52060593/audiokit-trim-audio