0

I am working on a SwiftUI iOS app that plays a live radio stream using AVPlayer. I would like to visualize the soundwave of the live radio stream and have it pulsate to the rhythm of music played in the stream. I have already implemented the audio stream using AVPlayer as shown below:

let radioPlayer = AVPlayer()
let livestream = AVPlayerItem(url: URL(string: "https://22653.live.streamtheworld.com/RADIO1_128.mp3")!)
radioPlayer.replaceCurrentItem(with: livestream)
radioPlayer.play()

However, I am unsure how to implement the pulsating soundwave visualization. I'm looking at Swift Charts for the implementation, but I'm open to other suggestions, like TimelineView and Core Graphics...

I came across this repo (SwiftChartsAudioVisualizer's AudioProcessing.swift) that almost provides what I need, but it only works with local file using AVAudioEngine and AVAudioFile, not with a live stream. Am I on the right track here?

TD540
  • 1,728
  • 3
  • 14
  • 26
  • You may want to look at `AudioKit`, which is open source and has some ideas about handling things like this – jnpdx Mar 14 '23 at 15:18

0 Answers0