Loading scripts/pyaudio3dtools/audiofile.py +0 −32 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import shutil import struct import subprocess as sp import warnings from importlib import import_module from tempfile import TemporaryDirectory from typing import Optional, Tuple Loading Loading @@ -662,37 +661,6 @@ def loudnessinfo( return measured_loudness, scale_factor def print_plot_play(x: np.ndarray, fs: int, text: Optional[str] = "") -> None: """1. Prints information about an audio signal, 2. plots the waveform, and 3. Creates player Parameters ---------- x: np array Input signal fs: int Input sampling rate text: Optional[str] = '' text to print Returns ------- None """ plt = import_module("matplotlib.pyplot") ipd = import_module("IPython.display") print("%s fs = %d, x.shape = %s, x.dtype = %s" % (text, fs, x.shape, x.dtype)) plt.figure(figsize=(8, 2)) plt.plot(x, color="gray") plt.xlim([0, x.shape[0]]) plt.xlabel("Time (samples)") plt.ylabel("Amplitude") plt.tight_layout() plt.show() ipd.display(ipd.Audio(data=x, rate=fs)) def get_wav_file_info(filename: str) -> dict: """ Get the format information from a WAV file. Loading Loading
scripts/pyaudio3dtools/audiofile.py +0 −32 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import shutil import struct import subprocess as sp import warnings from importlib import import_module from tempfile import TemporaryDirectory from typing import Optional, Tuple Loading Loading @@ -662,37 +661,6 @@ def loudnessinfo( return measured_loudness, scale_factor def print_plot_play(x: np.ndarray, fs: int, text: Optional[str] = "") -> None: """1. Prints information about an audio signal, 2. plots the waveform, and 3. Creates player Parameters ---------- x: np array Input signal fs: int Input sampling rate text: Optional[str] = '' text to print Returns ------- None """ plt = import_module("matplotlib.pyplot") ipd = import_module("IPython.display") print("%s fs = %d, x.shape = %s, x.dtype = %s" % (text, fs, x.shape, x.dtype)) plt.figure(figsize=(8, 2)) plt.plot(x, color="gray") plt.xlim([0, x.shape[0]]) plt.xlabel("Time (samples)") plt.ylabel("Amplitude") plt.tight_layout() plt.show() ipd.display(ipd.Audio(data=x, rate=fs)) def get_wav_file_info(filename: str) -> dict: """ Get the format information from a WAV file. Loading