I’m trying to use the write
method on AVSpeechSynthesizer
to capture both audio data and the markers data from synthesized speech. However I never see the markers callback invoked.
Minimal example code:
var synthesizer = AVSpeechSynthesizer()
synthesizer.mixToTelephonyUplink = false
synthesizer.usesApplicationAudioSession = false
synthesizer.write(AVSpeechUtterance(string: "Hello world"), toBufferCallback: { buffer in
if let buffer = buffer as? AVAudioPCMBuffer {
print("write (buffer.frameCapacity > 1)")
} else {
print("could not create buffer or buffer empty")
}
}, toMarkerCallback: { makers in
print("markers")
})
Tested on device and simulator. Buffers are provided until the end of the audio data is reached but toMarkerCallback
is never called
Is there something else I need to do to get the markers as well?