This directory contains a bunch of Python scripts for analyzing and visualizing the sound files captured in the iOS app.
- Python 2.7
- Probably only works on OSX; didn't try elsewhere
- The
pip
modules inrequirements.txt
:- Pydub
- aubio
- PyAudio - see notes here for installing in OSX
- numpy
- matplotlib
- readchar
- You should probably be a good person and use a virtualenv
- FFmpeg, easily installed via Homebrew:
brew install ffmpeg
So, assuming you have a bunch of AAC files from the iOS app, this is the workflow for ingesting those files:
-
First, we need to apply an A-weighting filter to the AAC files and convert them to WAV for ease of use. The
a_weight.py
script does this:$ ./a_weight.py *.aac
-
Now, we need to crunch some statistics (peak, mean, and min volume) and find runs of loudness in the WAV files. That's what
stat_and_runs.py
does. Feed it thefiltered_
WAV files, and it will generate JSON files with statistics and runs:$ ./stats_and_runs.py filtered_*.wav
-
We can now optionally listen to and manually tag the runs. At the moment, things tagged "wind" and "gate" are excluded from the supercut. The
tagger.py
script does this by adding tags to the runs JSON files:$ ./tagger.py runs_*.json
-
Making an audio supercut of loud noises is now possible with the
supercutter.py
script. Open it up to tweak options, and run it with theruns_
JSON files. It will generate an MP3 in the current directory:$ ./supercutter.py runs_*.json
-
Finally, we can create graphs with the statistical data. The
graph_maker.py
script will make one graph per day, and one large graph containing all days. These will be exported as PNGs in the current directory.$ ./graph_maker.py stats_*.json
We're mainly using Pydub to process the files due to its ease of use. However, since it lacks an A-weighting filter, we're using aubio for that piece.
Again, not much magic here. The scripts are all pretty messy, but hopefully short enough to follow.