5

I am following this tutorial :https://miguelsaldana.me/2017/03/13/how-to-create-a-soundcloud-like-waveform-in-swift-3/

My code given below .There is an exception :

Error Domain=com.apple.coreaudio.avfaudio Code=2003334207 “(null)” UserInfo={failed call=ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)}

   let file = try! AVAudioFile(forReading: AudioLink)  //Got Exception Here

    let format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: file.fileFormat.sampleRate, channels: file.fileFormat.channelCount, interleaved: false)
    print(file.fileFormat.channelCount)
    let buf = AVAudioPCMBuffer(pcmFormat: format!, frameCapacity: UInt32(file.length))
    try! file.read(into: buf!)



    //     print("floatArray \(readFile.arrayFloatValues)\n")
    //self.waveFormView.setNeedsDisplay()
atiqkhaled
  • 386
  • 4
  • 19
Nahid Raihan
  • 957
  • 1
  • 10
  • 20
  • what is "AudioLink" are you using NSTemporary Directory. Pls also add your audio link/ – MAhipal Singh Feb 14 '18 at 11:15
  • @MAhipalSingh Thanks for asking . Take this link as Example - let url : URL = URL(string: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 ") SetAudioVisulizer(AudioLink: url) – Nahid Raihan Feb 14 '18 at 11:24

0 Answers0