PHONOTENSOR / GUIDE / v0.2.2

Getting started

From a fresh Python environment to your first audio tensor.

Install Phonotensor

Use Python 3.11 or newer. A virtual environment keeps your audio project’s dependencies isolated. These docs target the published 0.2.2 release.

Shell
python -m venv .venv
# macOS / Linux
source .venv/bin/activate
# Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install phonotensor==0.2.2
NumPy, SciPy, soundfile, and sounddevice are installed as dependencies. The package imports sounddevice at startup, so PortAudio must be available even for file-only workflows. On Debian/Ubuntu, install the runtime with sudo apt install libportaudio2; some systems also need libsndfile1.

Create, shape, and save a signal

Generate a quiet sine wave, add short fades, and write a WAV file. This example runs without recording or playing audio.

Python
from phonotensor import FileIO, ops

# Create a two-second tone. No microphone needed.
audio = ops.sine(440, duration=2.0, amplitude=0.25)
audio = ops.fade_in(audio, duration=0.02)
audio = ops.fade_out(audio, duration=0.1)

FileIO.write(audio, "tone.wav")
print(audio.shape)  # (88200, 1)
print(audio.sample_rate)  # 44100

Choose your workflow

Read the tensor guide to understand shapes and sample rates. The audio I/O guide covers files, recording, and playback. Signal processing covers filters and features; the API reference lists parameters, defaults, and return types.

Python
from importlib.metadata import version
print(version("phonotensor"))  # Installed distribution version
Use distribution metadata to check your version. The 0.2.2 wheel currently contains an internal __version__ value of 0.2.1.