The basic idea is the following:
- Split the audio file in non-overlapping segments, you can use
AudioPartition
for that
- Extract the power spectrum of the audio segment, you can use
Periodogram
, PeriodogramArray
, Fourier
, etc to do that. For simplicity I use Periodogram
below with ScalingFunctions->"Absolute"
- Style the resulting power spectrum values to taste
- Repeat for each audio segment and animate
Here's a simple implementation of that:
stylePeriodogram[periodogram_] := Block[{values, cf},
cf = ResourceFunction["ColorBrewerData"]["Purples", "ColorFunction"];
values = Cases[periodogram, Line[a__] :> a, Infinity][[1, All, 2]];
PairedBarChart[values, values, AspectRatio -> 1/4,
BarOrigin -> "XAxis", BarSpacing -> {0, 0, 0}, Axes -> False,
ColorFunction -> cf, ChartStyle -> EdgeForm[None]]
]
waveForm[audioPartition_, window_ : 100] :=
stylePeriodogram[
Periodogram[audioPartition, window, window, HammingWindow, window,
ScalingFunctions -> "Absolute", PlotRange -> All]]
waveFormAnimationFrames[audio_, partition_ : 50/1000(*50 ms*), window_ : 100] :=
With[{audioPartitions = AudioPartition[audio, partition]},
waveForm[#, window] & /@ audioPartitions]
Let's see how this looks for the Apollo11 clip in ExampleData
:
apolloAudio = ExampleData[{"Audio", "Apollo11SmallStep"}];
frames = waveFormAnimationFrames[apolloAudio];
Export["apollo11-small_step.gif", frames]

Notes:
- For single track audio files you should really only need to change the
stylePeriodogram
function, e.g. something like this could work for the circular waveform you showed
- To achieve the last effect you showed, you'd need an audio file with multiple tracks, and then simply superimpose graphics with some transparency for each track
ExampleData[{"Audio", "Water"}] // ToBoxes
. It doesn't seem that configurable - so you might end up needing to build your own dynamic player with Graphics $\endgroup$