Visualizing audio#

import os
from splaat.audio.load import load_audio
from splaat.plot.spectrogram import plot_spectrogram
audio_directory = os.path.join(os.path.dirname(os.path.abspath("")), "_static", "audio")
audio, sr = load_audio(os.path.join(audio_directory, "mfa.wav"))
ret = plot_spectrogram(audio, sr, channel=0)
../_images/71d536da9697b044cf5cef42051719c252ab2203b5025a49416ba1a001b77018.png
ret = plot_spectrogram(audio, sr, channel=1)
../_images/bafdc94bbf547aca8753507d9b358266d441e9223d05370ac1eda824a6bf5f31.png
ret = plot_spectrogram(audio, sr, channel=0, start=0.4, end=0.6, figure_width=20)
ret = plot_spectrogram(audio, sr, channel=1, start=0.4, end=0.6, figure_width=20)
../_images/89553d795c0a514d067e68ea2d9e138922be5027cfc8970ec2bba29d9207f9d0.png ../_images/f5a612ba90b7705b22f0fab30c369a45f56eb881f5280ab15b12240c0eb97e44.png
import os
from splaat.plot.combined import plot_file
audio_path = os.path.join(os.path.dirname(os.path.abspath("")), "_static", "audio", "mfa.wav")
tg_path = os.path.join(os.path.dirname(os.path.abspath("")), "_static", "textgrids", "mfa.TextGrid")
fig = plot_file(audio_path, tg_path, start=0, end=0.4)
../_images/2e36995b13a46575248f78bd30561db6f9e764394d56ca6eeb851ca57f592012.png