pyquist
pyquist provides basic utilities for low-level computer music programming in Python and NumPy.
pyquist is designed for learning and is the teaching library for CMU's 15-322 Intro to Computer Music. Its primary purpose is to provide a barebones foundation for working with audio in Python, e.g., allocating sample buffers, audio file decoding and playback. Accordingly, it intentionally lacks a lot of functionality found in full-fledged computer music programming frameworks, such as a rich collection of unit generators.
Want to try it without installing anything?
Quick example
import numpy as np
import pyquist as pq
# A 1-second, 440 Hz sine wave at CD quality.
sr = 44100
t = np.arange(sr) / sr
audio = pq.Audio(0.5 * np.sin(2 * np.pi * 440 * t), sample_rate=sr)
pq.play(audio) # play through default output (or notebook widget)
pq.plot(audio) # waveform
pq.plot_spec(audio) # spectrogram
Loading and transforming:
from pyquist.paths import TEST_DATA_DIR
riff = pq.Audio.from_file(
TEST_DATA_DIR / "388954__fullmetaljedi__blues-riff-in-g-nylon.wav"
)
clip = riff.segment(offset=5.0, duration=3.0).resample(8000)
pq.play(clip)
Rendering a Score with a custom instrument. An instrument is called as instrument(**event.kwargs) — declare the kwargs you use and absorb the rest with **kwargs:
from pyquist.score import Score, BasicMetronome
from pyquist.helper import pitch_to_frequency
def sine_instrument(pitch, duration, **kwargs):
sr = 44100
t = np.arange(int(duration * sr)) / sr
freq = pitch_to_frequency(pitch)
return pq.Audio(0.3 * np.sin(2 * np.pi * freq * t) * np.exp(-3 * t), sample_rate=sr)
score = Score([
(0, {"pitch": 60, "duration": 0.5}),
(1, {"pitch": 64, "duration": 0.5}),
(2, {"pitch": 67, "duration": 0.5}),
])
pq.play(score.render(sine_instrument, metronome=BasicMetronome(bpm=120)))
For a guided walkthrough — visualization, MIDI parsing, scores, instruments — open examples/HelloPyquist.ipynb or run it in Colab.
Installation
Requires Python 3.10 or later.
macOS
brew install python@3.10 # or 3.11, 3.12, 3.13
python3.10 -m venv .venv
source .venv/bin/activate
pip install --upgrade pyquist
If pq.play(...) is silent, give Terminal (or your IDE) microphone/audio access in System Settings → Privacy & Security → Microphone.
Linux
Install Python and the PortAudio system library that sounddevice wraps:
# Debian / Ubuntu
sudo apt install python3 python3-venv libportaudio2
# Fedora
sudo dnf install python3 python3-virtualenv portaudio
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pyquist
Windows
Install Python (3.10 or later, with "Add Python to PATH" checked), then open Command Prompt:
python -m venv .venv
.venv\Scripts\activate.bat
pip install --upgrade pyquist
From source
For hacking on pyquist itself:
git clone https://github.com/gclef-cmu/pyquist.git
cd pyquist
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,notebook]"
pre-commit install
Pick default audio devices
Once installed, the pyquist CLI (also available as pq) lets you choose persistent default input/output devices (handy for laptops with multiple interfaces):
pyquist devices
pyquist play test
Run notebooks
pip install jupyter ipykernel ipywidgets
python -m ipykernel install --user --name=pyquist --display-name "Pyquist"
cd examples
jupyter notebook
Then open HelloPyquist.ipynb and select the Pyquist kernel.
Acknowledgements
Inspired in part by:
Metadata
Release files for pyquist 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyquist-0.2.4.tar.gz | 1.9 MB | With provenance | Details for pyquist-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyquist-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for pyquist-0.2.4-py3-none-any.whl |
Total release size: 3.8 MB
Release files / pyquist-0.2.4.tar.gz
| Download URL | pyquist-0.2.4.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3941ec78321872b6b58aa5bfcd88a3c75032dfdbabb8baa846a6750d472ba60a
|
|
BLAKE2b-256 checksum How to use checksums |
f69048e4f5855fe8b18aa02fe5754749d66518457720e9ae8e6163ba40c9527c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.
Transparency logRelease files / pyquist-0.2.4-py3-none-any.whl
| Download URL | pyquist-0.2.4-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd2ae9912d841eff0c68ff740fbd751088e312e9cc15e07e236fadd3657fa871
|
|
BLAKE2b-256 checksum How to use checksums |
2184631396efd2c132bb3a8419dfd28ce9fb73f3ac05f8686a4821a857caafd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.
Transparency logSecurity for pyquist 0.2.4
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyquist-0.2.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.
Transparency logA 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.