Descript Audiotools

0.7.2 · active · verified Wed Apr 15

Descript Audiotools is a Python library providing object-oriented handling of audio data, featuring functionalities like fast augmentation routines, batching, padding, and GPU-powered operations. The current stable version available on PyPI is 0.7.2. The library is actively maintained, with development continuing on its GitHub repository.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a basic `AudioSignal` object, apply a simple audio transformation (low-pass filter), and print its properties. For actual audio playback using `signal.play()`, the `ffplay` utility (part of the FFmpeg suite) needs to be installed and accessible in your system's PATH. The example generates a dummy sine wave for immediate execution without external audio files.

import audiotools
import numpy as np

# Create a dummy AudioSignal (e.g., a sine wave)
sample_rate = 44100
duration = 3 # seconds
frequency = 440 # Hz
t = np.linspace(0, duration, int(sample_rate * duration), endpoint=False)
sine_wave = 0.5 * np.sin(2 * np.pi * frequency * t)

# AudioSignal expects a torch.Tensor, so convert numpy array
signal = audiotools.AudioSignal(sine_wave[np.newaxis, :], sample_rate)

print(f"Original signal sample rate: {signal.sample_rate}")
print(f"Original signal duration: {signal.duration} seconds")

# Apply a low-pass filter
filtered_signal = signal.low_pass(8000)
print(f"Filtered signal duration: {filtered_signal.duration} seconds")

# To play back audio, ffplay (part of FFmpeg) must be installed.
# signal.play() 
# filtered_signal.play()

view raw JSON →