Skip to main content

Phonotensor

Audio as mathematical data — collect, operate, transform, and export.

Phonotensor is a robust, well-typed Python library that treats audio not just as files, but as structured, manipulatable mathematical tensors. It provides a simple, fluent API for audio collection, mathematical manipulation (DSP), and deterministic playback with state-of-the-art OS-level permission management.

Features

  • Deterministic Recording & Playback: Cross-platform stream management via sounddevice and portaudio.
  • Comprehensive Permission Model: Safe hardware and filesystem verification before resource acquisition.
  • Fluent DSP Operators: Mix, concatenate, fade, filter, and modify volumes mathematically.
  • Robustness: 100% strict type coverage and exhaustive automated testing.

Installation

Install Phonotensor via pip:

pip install phonotensor

(Optional) For MP3 support:

pip install phonotensor[mp3]

Quickstart

Here is a simple example to record 3 seconds from your microphone, generate a sine wave, mix them together, and play the result:

import numpy as np
from phonotensor import MicrophoneSource, AudioTensor, AudioPlayer, ops, fmt

# Initialize your microphone securely
mic = MicrophoneSource(sample_rate=44100, channels=1)

print("Recording for 3 seconds...")
audio = mic.record(duration=3.0)

# Generate a 440Hz sine wave tone
frequency = 440
tone = AudioTensor.from_function(
    lambda t: 0.3 * np.sin(2 * np.pi * frequency * t),
    duration=3.0,
    sample_rate=44100,
)

# Math operations: Mixing the microphone signal with the tone
mixed = ops.mix([audio, tone], weights=[0.7, 0.3])

# Summarize the audio context
print(fmt.describe(mixed))

# Play it back
player = AudioPlayer()
player.play(mixed)

License

Copyright (c) 2026 Emberflock Labs (Owner: Ayush Jha). All rights reserved.

Metadata

Release files for phonotensor 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phonotensor 0.2.2
File Size Uploaded Provenance Actions
phonotensor-0.2.2.tar.gz 34.1 kB Without provenance Details for phonotensor-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phonotensor 0.2.2
File Interpreter ABI Platform Actions
phonotensor-0.2.2-py3-none-any.whl Python 3 none any Details for phonotensor-0.2.2-py3-none-any.whl

Total release size: 71.8 kB

Release files / phonotensor-0.2.2.tar.gz

Download URL phonotensor-0.2.2.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2634833bd3795de2261564535c63aa88458a4f20f18d7b787fd2ee6c550c6b5e
BLAKE2b-256 checksum
How to use checksums
88074f284ad8ab02120b76ec038af5246f3a3ea79a417dd01b103c01c67f7686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / phonotensor-0.2.2-py3-none-any.whl

Download URL phonotensor-0.2.2-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a21b308644c6bdf4db68c3fbc32f3895c4bc597729b493b70c9d3c0f3db7d5fd
BLAKE2b-256 checksum
How to use checksums
b2134b7feb22678f2186a5e949af3c7948d0f50d8d38234a6379a6e24b4c3f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for phonotensor 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page