I know there are some similar questions here, but most of them are concerning generating waveform images, which is not what I want.
My goal is to generate a waveform visualization for an audio file, similar to SoundCloud, but not an image. I'd like to have the max amplitude data for each second (or half second) of an audio clip in an array. I could then use this data to create a CSS-based visualization.
Ideally I'd like to get an array that has all the amplitude values for each second as a percentage of the maximum amplitude of the entire audio file. Here's an example:
[
0.0, # Relative max amplitude of first second of audio clip (0%)
0.04, # Relative max amplitude of second second of audio clip (4%)
0.15, # Relative max amplitude of third second of audio clip (15%)
# Some more
1.0, # The highest amplitude of the whole audio clip will be 1.0 (100%)
]
I assume I'll have to use at least numpy
and Python's wave
module, but I'm not sure how to get the data I want. I'd like to use Python but I'm not completely against using some kind of command-line tool.