2

Any idea why the playback tempo of audio files via an AVQueuePlayer is not an accurate product of the original audio file's tempo and the AVPlayers rate property? e.g. the original tempo is 100 b.p.m. and I set the rate to 0.7, expecting an output of audio playing at 70 b.p.m. But what I in fact get is a tempo around 65... (please excuse the inelegant code)

let assetQueue = [aVItem1, aVItem2, aVItem3, aVItem4, aVItem5, aVItem6, aVItem7, aVItem8, aVItem9, aVItem0]

    var itemQueue: [AVPlayerItem] = []

    for index in 0...9{

        let nextItem: AVPlayerItem = AVPlayerItem(asset: assetQueue[index])

        itemQueue.append(nextItem)
    }

    player = AVQueuePlayer(items: itemQueue)

    player.play()

    player.rate = 0.7

It plays perfectly at 100 b.p.m. when player.rate = 1.0

I need this to play accurately at all integer tempo values from 70 to 140 b.p.m. as it needs to synchronise with a tempo controlled UI element (the tempo of which is triggered using an NSTimer). Or is there maybe a simpler way to achieve this (perhaps with the setRate() method)?

Any assistance would be much appreciated :)

AcmeCat
  • 212
  • 2
  • 12

0 Answers0