pyquist 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyquist
3
+ Version: 0.1.0
4
+ Summary: Barebones utilities for low-level computer music programming in Python and NumPy. Teaching library for CMU 15-322.
5
+ Author: Chris Donahue
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://gclef-cmu.org/pyquist
8
+ Project-URL: Documentation, https://gclef-cmu.org/pyquist
9
+ Project-URL: Repository, https://github.com/gclef-cmu/pyquist
10
+ Project-URL: Issues, https://github.com/gclef-cmu/pyquist/issues
11
+ Keywords: audio,music,dsp,midi,numpy,computer-music,education
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Education
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Multimedia :: Sound/Audio
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: matplotlib
27
+ Requires-Dist: mido
28
+ Requires-Dist: numpy>=2.0
29
+ Requires-Dist: requests
30
+ Requires-Dist: resampy
31
+ Requires-Dist: sounddevice
32
+ Requires-Dist: soundfile
33
+ Requires-Dist: tqdm
34
+ Provides-Extra: dev
35
+ Requires-Dist: mypy>=1.13; extra == "dev"
36
+ Requires-Dist: pre-commit>=4.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.8; extra == "dev"
38
+ Provides-Extra: notebook
39
+ Requires-Dist: ipython; extra == "notebook"
40
+ Provides-Extra: docs
41
+ Requires-Dist: sphinx>=7; extra == "docs"
42
+ Requires-Dist: sphinx-autodoc-typehints>=2; extra == "docs"
43
+ Dynamic: license-file
44
+
45
+ # `pyquist`
46
+
47
+ `pyquist` provides basic utilities for **low-level computer music programming in Python and NumPy**.
48
+
49
+ `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.
50
+
51
+ Want to try it without installing anything? [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/gclef-cmu/pyquist/blob/main/examples/HelloPyquist.ipynb)
52
+
53
+ ## Quick example
54
+
55
+ ```python
56
+ import numpy as np
57
+ import pyquist as pq
58
+
59
+ # A 1-second, 440 Hz sine wave at CD quality.
60
+ sr = 44100
61
+ t = np.arange(sr) / sr
62
+ audio = pq.Audio(0.5 * np.sin(2 * np.pi * 440 * t), sample_rate=sr)
63
+
64
+ pq.play(audio) # play through default output (or notebook widget)
65
+ pq.plot(audio) # waveform
66
+ pq.plot_spec(audio) # spectrogram
67
+ ```
68
+
69
+ Loading and transforming:
70
+
71
+ ```python
72
+ riff = pq.Audio.from_url(
73
+ "https://github.com/gclef-cmu/pyquist/raw/refs/heads/main/pyquist/test_data/388954__fullmetaljedi__blues-riff-in-g-nylon.wav"
74
+ )
75
+ clip = riff.segment(offset=5.0, duration=3.0).resample(8000)
76
+ pq.play(clip)
77
+ ```
78
+
79
+ 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`:
80
+
81
+ ```python
82
+ from pyquist.score import Score, Event, BasicMetronome
83
+ from pyquist.helper import pitch_to_frequency
84
+
85
+ def sine_instrument(pitch, duration, **kwargs):
86
+ sr = 44100
87
+ t = np.arange(int(duration * sr)) / sr
88
+ freq = pitch_to_frequency(pitch)
89
+ return pq.Audio(0.3 * np.sin(2 * np.pi * freq * t) * np.exp(-3 * t), sample_rate=sr)
90
+
91
+ score = Score([
92
+ Event(0, {"pitch": 60, "duration": 0.5}),
93
+ Event(1, {"pitch": 64, "duration": 0.5}),
94
+ Event(2, {"pitch": 67, "duration": 0.5}),
95
+ ])
96
+ pq.play(score.render(sine_instrument, metronome=BasicMetronome(120)))
97
+ ```
98
+
99
+ For a guided walkthrough — visualization, MIDI parsing, scores, instruments — open [`examples/HelloPyquist.ipynb`](examples/HelloPyquist.ipynb) or [run it in Colab](https://colab.research.google.com/github/gclef-cmu/pyquist/blob/main/examples/HelloPyquist.ipynb).
100
+
101
+ ## Installation
102
+
103
+ Requires **Python 3.10 or later**.
104
+
105
+ ### macOS
106
+
107
+ ```sh
108
+ brew install python@3.10 # or 3.11, 3.12, 3.13
109
+ python3.10 -m venv .venv
110
+ source .venv/bin/activate
111
+ pip install --upgrade pyquist
112
+ ```
113
+
114
+ If `pq.play(...)` is silent, give Terminal (or your IDE) microphone/audio access in **System Settings → Privacy & Security → Microphone**.
115
+
116
+ ### Linux
117
+
118
+ Install Python and the PortAudio system library that `sounddevice` wraps:
119
+
120
+ ```sh
121
+ # Debian / Ubuntu
122
+ sudo apt install python3 python3-venv libportaudio2
123
+
124
+ # Fedora
125
+ sudo dnf install python3 python3-virtualenv portaudio
126
+
127
+ python3 -m venv .venv
128
+ source .venv/bin/activate
129
+ pip install --upgrade pyquist
130
+ ```
131
+
132
+ ### Windows
133
+
134
+ Install [Python](https://www.python.org/downloads/) (3.10 or later, with "Add Python to PATH" checked), then open **Command Prompt**:
135
+
136
+ ```bat
137
+ python -m venv .venv
138
+ .venv\Scripts\activate.bat
139
+ pip install --upgrade pyquist
140
+ ```
141
+
142
+ ### From source
143
+
144
+ For hacking on pyquist itself:
145
+
146
+ ```sh
147
+ git clone https://github.com/gclef-cmu/pyquist.git
148
+ cd pyquist
149
+ python3 -m venv .venv
150
+ source .venv/bin/activate
151
+ pip install -e ".[dev,notebook]"
152
+ pre-commit install
153
+ ```
154
+
155
+ ### Pick default audio devices
156
+
157
+ Once installed, the `pyquist` CLI lets you choose persistent default input/output devices (handy for laptops with multiple interfaces):
158
+
159
+ ```sh
160
+ pyquist devices
161
+ ```
162
+
163
+ ### Run notebooks
164
+
165
+ ```sh
166
+ pip install jupyter ipykernel ipywidgets
167
+ python -m ipykernel install --user --name=pyquist --display-name "Pyquist"
168
+ cd examples
169
+ jupyter notebook
170
+ ```
171
+
172
+ Then open [`HelloPyquist.ipynb`](examples/HelloPyquist.ipynb) and select the **Pyquist** kernel.
173
+
174
+ ## Acknowledgements
175
+
176
+ Inspired in part by:
177
+
178
+ - [Nyquist](https://sourceforge.net/projects/nyquist/)
179
+ - [Tone.js](https://tonejs.github.io/)
180
+ - [JUCE](https://juce.com/)
@@ -0,0 +1,26 @@
1
+ pyquist/__init__.py,sha256=obcliDdriSDx64eeT2Ea9u7DCgL-1BEgjj3nENvAI08,808
2
+ pyquist/audio.py,sha256=Q2N1PFcwJBwvlN9qcFhe48Kj7MuGlDtfaKqk79n0NOU,20007
3
+ pyquist/audio_test.py,sha256=t0RRolIYLVDiTt1-vs3q-xlyrACOF6g0rmJ8h8N58hk,18359
4
+ pyquist/cli.py,sha256=nld7a-8JghpyAOzlCpzcCdUXox4wF8RFC5kBi0OM22Q,3153
5
+ pyquist/device.py,sha256=xSeStMjWO5fnWFfYBygaPWB0zrrf0258Dy-romWmqz4,11686
6
+ pyquist/device_test.py,sha256=V_dw_IJnJP8aTmwFy0dllYCfnmDkdi7FgUMCyBbREdw,19744
7
+ pyquist/helper.py,sha256=NCuHnlI48sG7loIwBRWtG81mWzr9C79k0qgV3rJhOMI,4696
8
+ pyquist/helper_test.py,sha256=zVR2pb9OHy5tYkA5xzm9RhoqoD9Yz4KxoaiNzPadDrA,4736
9
+ pyquist/paths.py,sha256=Lsmtjvs7fA2k7xoBlq681I-RprWl12Nh0ZZanHQlnQM,370
10
+ pyquist/plot.py,sha256=KwSt1W0np-hZlIyMLN8Kb9IwAn2zYaFIJU4yb98Up-o,10615
11
+ pyquist/plot_test.py,sha256=0nHcZ-qxZTBa4skoEMemzYOrLvyk_vwUAVvrpBcwVrE,6900
12
+ pyquist/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ pyquist/score.py,sha256=5o_rVGchInpO5WimJOC340zhNsOgYcBLVSNo9E37t3s,19926
14
+ pyquist/score_test.py,sha256=ciRBzb4TtIX_xoGwazknaiQSsFXU-3pSPtMEJYoxG-o,18487
15
+ pyquist/test_data/388954__fullmetaljedi__blues-riff-in-g-nylon.wav,sha256=-ONIAdfoZt185YdqoEjQAimsWGGN_kxcp-H1QS_C4Bs,867536
16
+ pyquist/test_data/434013__mrpearch__drum-patern.mp3,sha256=4jSYF-aetLOz1EITZjZmzZwyAdwQPZccC7j6VpDbDZw,865801
17
+ pyquist/test_data/ravel_bolero.mid,sha256=6QMdnLMd77vz6C8mh6vb8P1ki8xsbKxpPNLcdIP0bsU,261384
18
+ pyquist/web/__init__.py,sha256=lCLVIuVwS49hsPr8fPCch4lcScP7EyMSMx1agcxOYDU,139
19
+ pyquist/web/freesound.py,sha256=EnHiKkzSIuK9EppAL2Gm8ksS3KM8Gt6u1VlQgP60D60,10185
20
+ pyquist/web/theorytab.py,sha256=J7tr-gCsVz2TRoPH9VSKBtawph4Q02mwhAVVMvVEhc8,14514
21
+ pyquist-0.1.0.dist-info/licenses/LICENSE,sha256=LkETpB22C4H2K2BjBMOV1PsZ2FDkZB5GB_aN527JZ5s,1057
22
+ pyquist-0.1.0.dist-info/METADATA,sha256=scOOLbBdSJYytUZavZSsYMzlmqYAbLhO0IeXNoVnGxo,5856
23
+ pyquist-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
24
+ pyquist-0.1.0.dist-info/entry_points.txt,sha256=vNL8_rJpW5nzN-Ho8mB2RSJ3LRSiTsQ-enVfcw4gcVQ,45
25
+ pyquist-0.1.0.dist-info/top_level.txt,sha256=oT4CDwocltnmc8iYEt9gLdOdbX_iAMe1j92ZtIOk4Ks,8
26
+ pyquist-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyquist = pyquist.cli:main
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026 Chris Donahue
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ pyquist