I have looked into using installTap in AVAudioNode, but how can I get the volume level in real time in installTap in?
player.installTap(onBus: 0, bufferSize: 1024, format: player.outputFormat(forBus: 0)) { (buffer, when) in
print(buffer.floatChannelData![0])
}
floatChannelData is a pointer to data but how to access real value?
Use floatChannelData pointer by dereferencing it and then accessing the individual samples.
The code iterates, does the math to give RMS for small chunk of time. For smoother RMS over time, accumulate and do a moving average.