Note
Go to the end to download the full example code
Circadian soundscape
When dealing with large amounts of audio recordings, visualization plays a key role to evidence the main patterns in the data. In this example we show how to easily combine 96 audio files to build a visual representation of a 24 hour natural soundscape.
Load packages and set variables.
import glob
import matplotlib.pyplot as plt
from maad import sound, util
fpath = '../../data/indices/' # location of audio files
sample_len = 3 # length in seconds of each audio slice
Build a long list of audio slices of length sample_len.
Combine all audio recordings applying a crossfade and compute the spectrogram of the resulting mixed audio.
Display the spectrogram. We can see clearly the bird chorus at dawn (5-10 h) and dusk (20-21 h), as well as the wind and airplanes sounds at low frequencies.
fig, ax = plt.subplots(1,1, figsize=(10,3))
util.plot_spectrogram(Sxx, extent=[0, 24, 0, 11],
ax=ax, db_range=80, gain=25, colorbar=False)
ax.set_xlabel('Time [Hours]')
ax.set_xticks(range(0,25,4))
Total running time of the script: (0 minutes 1.109 seconds)