I am trying to build an application that plays Spotify songs. I am really confused about how to change BPM(Beats Per Minute,) value of Spotify songs.
First Step: Login through Spotify.
Second Step: Get Current user all album.
Third Step: get album track.
Last Step: play track.
I have done All step with Spotify Delegates. but I want to change the BPM value of the track.
Can someone please explain to me how to change the BPM value?
Hi @dasssham, you can try changing the speed of the track using AVAudioPlayer and the instance property rate. For example,
let song = try! AVAudioPlayer(contentsOf: URL(fileURLWithPath: selectedPath), fileTypeHint: "mp3")
song.enableRate = true
song.prepareToPlay()
song.rate = 2
song.play()
However according to Apple’s documentation “the available range is from 0.5
for half-speed playback through 2.0
for double-speed playback.”
Best,
Gina
Thank you for your reply, but i want to change BPM of Spotify song.
Hi @dasssham,
Are you aware of the Spotify public API for developers? It can be found here [iOS SDK | Spotify for Developers]
and there is a sample project that can be found here [GitHub - spotify/ios-sdk: Spotify SDK for iOS]
From a cursory glance, I cannot see an API for changing the playback speed.
cheers,