简体   繁体   中英

How to modify current playing audio stream in Swift

I'm trying to build app that allows to edit audio's BPM and apply sound effect to current playing audio stream. Is it possible to modify system's current playing audio beat and it's rate?

correct me if i get it wrong, but have you tried to implement it this way?

you know that BPM is 60 and now you want to play it at 90, so if you multiply it with 1.5, it will become 90.

let audioPlayer = try! AVAudioPlayer(contentsOf: URL(fileURLWithPath: selectedPath), fileTypeHint: "filetypeHintHere...")
audioPlayer.enableRate = true
audioPlayer.prepareToPlay()
audioPlayer.rate = 1.5// you can change rate like this here
audioPlayer.play()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM