pyaudiohost 0.1.0__tar.gz
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.
- pyaudiohost-0.1.0/LICENSE +202 -0
- pyaudiohost-0.1.0/MANIFEST.in +5 -0
- pyaudiohost-0.1.0/PKG-INFO +136 -0
- pyaudiohost-0.1.0/README.md +98 -0
- pyaudiohost-0.1.0/THIRD_PARTY_NOTICES.md +18 -0
- pyaudiohost-0.1.0/docs/README.md +25 -0
- pyaudiohost-0.1.0/docs/api-reference.md +179 -0
- pyaudiohost-0.1.0/docs/architecture.md +133 -0
- pyaudiohost-0.1.0/docs/array-processing.md +96 -0
- pyaudiohost-0.1.0/docs/development.md +104 -0
- pyaudiohost-0.1.0/docs/discovery.md +124 -0
- pyaudiohost-0.1.0/docs/editors.md +67 -0
- pyaudiohost-0.1.0/docs/examples.md +109 -0
- pyaudiohost-0.1.0/docs/installation.md +95 -0
- pyaudiohost-0.1.0/docs/instruments.md +167 -0
- pyaudiohost-0.1.0/docs/multichannel.md +206 -0
- pyaudiohost-0.1.0/docs/parameters-and-state.md +94 -0
- pyaudiohost-0.1.0/docs/platform-support.md +111 -0
- pyaudiohost-0.1.0/docs/rendering.md +137 -0
- pyaudiohost-0.1.0/docs/troubleshooting.md +126 -0
- pyaudiohost-0.1.0/pyaudiohost/__init__.py +55 -0
- pyaudiohost-0.1.0/pyaudiohost/_channels.py +82 -0
- pyaudiohost-0.1.0/pyaudiohost/_render.py +58 -0
- pyaudiohost-0.1.0/pyaudiohost/_worker.py +305 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/__init__.py +1 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_com.py +409 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_common.py +87 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_vst3_events.py +76 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_window.py +22 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_window_cocoa.py +80 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_window_win32.py +102 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/_window_x11.py +85 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/aax.py +43 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/au.py +814 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/vst2.py +495 -0
- pyaudiohost-0.1.0/pyaudiohost/backends/vst3.py +854 -0
- pyaudiohost-0.1.0/pyaudiohost/discovery.py +385 -0
- pyaudiohost-0.1.0/pyaudiohost/errors.py +39 -0
- pyaudiohost-0.1.0/pyaudiohost/host.py +576 -0
- pyaudiohost-0.1.0/pyaudiohost/midi.py +76 -0
- pyaudiohost-0.1.0/pyaudiohost/plugin.py +887 -0
- pyaudiohost-0.1.0/pyaudiohost.egg-info/PKG-INFO +136 -0
- pyaudiohost-0.1.0/pyaudiohost.egg-info/SOURCES.txt +46 -0
- pyaudiohost-0.1.0/pyaudiohost.egg-info/dependency_links.txt +1 -0
- pyaudiohost-0.1.0/pyaudiohost.egg-info/requires.txt +11 -0
- pyaudiohost-0.1.0/pyaudiohost.egg-info/top_level.txt +1 -0
- pyaudiohost-0.1.0/pyproject.toml +72 -0
- pyaudiohost-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyaudiohost
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python audio effect and instrument hosting with VST2/VST3/AU plugin editors
|
|
5
|
+
Author-email: Sucial <1584846096@qq.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Source Code, https://github.com/SUC-DriverOld/pyaudiohost
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/SUC-DriverOld/pyaudiohost/issues
|
|
9
|
+
Project-URL: Documentation, https://github.com/SUC-DriverOld/pyaudiohost/blob/main/docs/README.md
|
|
10
|
+
Keywords: audio,audio-plugins,plugin-host,vst,vst2,vst3,audio-unit
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
22
|
+
Classifier: Operating System :: MacOS
|
|
23
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
24
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
25
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: MIDI
|
|
26
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
32
|
+
Requires-Dist: numpy>=1.24
|
|
33
|
+
Requires-Dist: pywin32>=308; sys_platform == "win32"
|
|
34
|
+
Requires-Dist: python-xlib>=0.33; sys_platform == "linux"
|
|
35
|
+
Requires-Dist: pyobjc-framework-Cocoa>=10; sys_platform == "darwin"
|
|
36
|
+
Requires-Dist: rubicon-objc>=0.5; sys_platform == "darwin"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# pyaudiohost
|
|
40
|
+
|
|
41
|
+
A pure Python audio effect and instrument host with NumPy input/output and native plugin
|
|
42
|
+
editors. Plugin interfaces use `ctypes`; each plugin runs in an isolated Python
|
|
43
|
+
process, with audio processing independent of the editor event loop.
|
|
44
|
+
|
|
45
|
+
- VST2 and VST3 effects on Windows, macOS, and Linux.
|
|
46
|
+
- Audio Unit v2/v3 effects on macOS.
|
|
47
|
+
- VST2/VST3 and macOS AU instruments with MIDI note-on/off input.
|
|
48
|
+
- Multichannel audio and independent plugin buses, with layout negotiation.
|
|
49
|
+
- Native editors for live adjustment, normalized parameters, and state snapshots.
|
|
50
|
+
- Streaming processing and offline rendering with latency compensation,
|
|
51
|
+
progress callbacks, and cancellation.
|
|
52
|
+
- AAX module probing is reserved; AAX audio processing and editors are unavailable.
|
|
53
|
+
|
|
54
|
+
The library handles plugins and arrays. Your application handles audio files,
|
|
55
|
+
playback devices, and saving. Runtime dependencies are NumPy plus native platform
|
|
56
|
+
bridges: pywin32 on Windows, python-xlib on Linux, and PyObjC/Rubicon ObjC on macOS.
|
|
57
|
+
The library installs without compiling a project extension. Playback and file I/O
|
|
58
|
+
dependencies belong to the application.
|
|
59
|
+
|
|
60
|
+
## Install from source
|
|
61
|
+
|
|
62
|
+
Python 3.10 or newer is required. In this checkout:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
uv sync --dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To use the checkout from another uv project:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
uv add /path/to/pyaudiohost
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
See [installation](docs/installation.md) for platform requirements and packaging.
|
|
75
|
+
|
|
76
|
+
## Process an array
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import numpy as np
|
|
80
|
+
from pyaudiohost import PluginChain
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
# Replace this path with a compatible effect installed on your machine.
|
|
84
|
+
plugin_path = "/path/to/effect.vst3"
|
|
85
|
+
audio = np.zeros((2, 48000), dtype=np.float32) # channels, frames
|
|
86
|
+
audio[:, 0] = 0.1
|
|
87
|
+
|
|
88
|
+
with PluginChain([plugin_path], sample_rate=48000) as chain:
|
|
89
|
+
processed = chain.render(
|
|
90
|
+
audio,
|
|
91
|
+
progress=lambda value: print(f"Rendering: {value:.0%}"),
|
|
92
|
+
)
|
|
93
|
+
assert processed.shape == audio.shape
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For a plugin bundle, pass the outer bundle directory (such as `Effect.vst3`),
|
|
97
|
+
not a binary inside its `Contents/` directory. Single-file plugins accept the file
|
|
98
|
+
path directly.
|
|
99
|
+
|
|
100
|
+
Use the `__main__` guard because plugin workers use multiprocessing spawn.
|
|
101
|
+
[Array processing](docs/array-processing.md) covers continuous audio blocks;
|
|
102
|
+
[rendering](docs/rendering.md) covers progress, tails, cancellation, and background
|
|
103
|
+
GUI integration.
|
|
104
|
+
|
|
105
|
+
## Try the standalone player
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
uv run --script examples/player.py
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Open an audio file, add effects, open their native editors, adjust settings during
|
|
112
|
+
playback, and render to WAV. The example declares its own playback/file dependencies
|
|
113
|
+
and is not included in the installed library. See the [player guide](docs/examples.md).
|
|
114
|
+
|
|
115
|
+
For a single instrument with an on-screen piano keyboard:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
uv run --script examples/instrument.py
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Load an instrument, open its native editor to select a sound, and hold or drag the
|
|
122
|
+
piano keys to play through the default output device. See [instruments](docs/instruments.md)
|
|
123
|
+
for the array/MIDI API and tested scope.
|
|
124
|
+
|
|
125
|
+
## Documentation
|
|
126
|
+
|
|
127
|
+
Start with the [documentation index](docs/README.md) for the API reference, plugin
|
|
128
|
+
discovery, editors, parameters/state, platform support, and troubleshooting.
|
|
129
|
+
See [multichannel audio](docs/multichannel.md) for surround layouts, sidechains,
|
|
130
|
+
and instruments with multiple output buses.
|
|
131
|
+
|
|
132
|
+
See [platform support](docs/platform-support.md) for native plugin verification
|
|
133
|
+
and the remaining platform/format coverage.
|
|
134
|
+
|
|
135
|
+
License: Apache-2.0. See [LICENSE](LICENSE) and
|
|
136
|
+
[third-party notices](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# pyaudiohost
|
|
2
|
+
|
|
3
|
+
A pure Python audio effect and instrument host with NumPy input/output and native plugin
|
|
4
|
+
editors. Plugin interfaces use `ctypes`; each plugin runs in an isolated Python
|
|
5
|
+
process, with audio processing independent of the editor event loop.
|
|
6
|
+
|
|
7
|
+
- VST2 and VST3 effects on Windows, macOS, and Linux.
|
|
8
|
+
- Audio Unit v2/v3 effects on macOS.
|
|
9
|
+
- VST2/VST3 and macOS AU instruments with MIDI note-on/off input.
|
|
10
|
+
- Multichannel audio and independent plugin buses, with layout negotiation.
|
|
11
|
+
- Native editors for live adjustment, normalized parameters, and state snapshots.
|
|
12
|
+
- Streaming processing and offline rendering with latency compensation,
|
|
13
|
+
progress callbacks, and cancellation.
|
|
14
|
+
- AAX module probing is reserved; AAX audio processing and editors are unavailable.
|
|
15
|
+
|
|
16
|
+
The library handles plugins and arrays. Your application handles audio files,
|
|
17
|
+
playback devices, and saving. Runtime dependencies are NumPy plus native platform
|
|
18
|
+
bridges: pywin32 on Windows, python-xlib on Linux, and PyObjC/Rubicon ObjC on macOS.
|
|
19
|
+
The library installs without compiling a project extension. Playback and file I/O
|
|
20
|
+
dependencies belong to the application.
|
|
21
|
+
|
|
22
|
+
## Install from source
|
|
23
|
+
|
|
24
|
+
Python 3.10 or newer is required. In this checkout:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
uv sync --dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
To use the checkout from another uv project:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
uv add /path/to/pyaudiohost
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See [installation](docs/installation.md) for platform requirements and packaging.
|
|
37
|
+
|
|
38
|
+
## Process an array
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import numpy as np
|
|
42
|
+
from pyaudiohost import PluginChain
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
# Replace this path with a compatible effect installed on your machine.
|
|
46
|
+
plugin_path = "/path/to/effect.vst3"
|
|
47
|
+
audio = np.zeros((2, 48000), dtype=np.float32) # channels, frames
|
|
48
|
+
audio[:, 0] = 0.1
|
|
49
|
+
|
|
50
|
+
with PluginChain([plugin_path], sample_rate=48000) as chain:
|
|
51
|
+
processed = chain.render(
|
|
52
|
+
audio,
|
|
53
|
+
progress=lambda value: print(f"Rendering: {value:.0%}"),
|
|
54
|
+
)
|
|
55
|
+
assert processed.shape == audio.shape
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For a plugin bundle, pass the outer bundle directory (such as `Effect.vst3`),
|
|
59
|
+
not a binary inside its `Contents/` directory. Single-file plugins accept the file
|
|
60
|
+
path directly.
|
|
61
|
+
|
|
62
|
+
Use the `__main__` guard because plugin workers use multiprocessing spawn.
|
|
63
|
+
[Array processing](docs/array-processing.md) covers continuous audio blocks;
|
|
64
|
+
[rendering](docs/rendering.md) covers progress, tails, cancellation, and background
|
|
65
|
+
GUI integration.
|
|
66
|
+
|
|
67
|
+
## Try the standalone player
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uv run --script examples/player.py
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Open an audio file, add effects, open their native editors, adjust settings during
|
|
74
|
+
playback, and render to WAV. The example declares its own playback/file dependencies
|
|
75
|
+
and is not included in the installed library. See the [player guide](docs/examples.md).
|
|
76
|
+
|
|
77
|
+
For a single instrument with an on-screen piano keyboard:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
uv run --script examples/instrument.py
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Load an instrument, open its native editor to select a sound, and hold or drag the
|
|
84
|
+
piano keys to play through the default output device. See [instruments](docs/instruments.md)
|
|
85
|
+
for the array/MIDI API and tested scope.
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
Start with the [documentation index](docs/README.md) for the API reference, plugin
|
|
90
|
+
discovery, editors, parameters/state, platform support, and troubleshooting.
|
|
91
|
+
See [multichannel audio](docs/multichannel.md) for surround layouts, sidechains,
|
|
92
|
+
and instruments with multiple output buses.
|
|
93
|
+
|
|
94
|
+
See [platform support](docs/platform-support.md) for native plugin verification
|
|
95
|
+
and the remaining platform/format coverage.
|
|
96
|
+
|
|
97
|
+
License: Apache-2.0. See [LICENSE](LICENSE) and
|
|
98
|
+
[third-party notices](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
pyaudiohost is distributed under the Apache License, Version 2.0. See [LICENSE](LICENSE).
|
|
4
|
+
Third-party dependencies and plugin SDKs retain their respective licenses.
|
|
5
|
+
|
|
6
|
+
The package uses NumPy (BSD-3-Clause), pywin32 on Windows, python-xlib
|
|
7
|
+
(LGPL-2.1-or-later) on Linux, and PyObjC (MIT) / Rubicon Objective-C
|
|
8
|
+
(BSD-3-Clause) on macOS. pywin32 includes multiple notices; consult its
|
|
9
|
+
distribution for the licenses of individual components.
|
|
10
|
+
These packages are installed as dependencies;
|
|
11
|
+
their source and binary distributions retain their own license notices.
|
|
12
|
+
|
|
13
|
+
VST2 and VST3 interface identifiers and ABI signatures describe Steinberg plugin
|
|
14
|
+
interfaces. Apple Audio Unit calls follow the public AudioToolbox APIs.
|
|
15
|
+
No Steinberg or Avid SDK headers or proprietary plugin binaries are distributed.
|
|
16
|
+
|
|
17
|
+
The standalone examples optionally install SoundDevice (MIT) and SoundFile
|
|
18
|
+
(BSD-3-Clause). They are not dependencies of the pyaudiohost library.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
pyaudiohost hosts audio effects and instruments and exchanges NumPy arrays with your application.
|
|
4
|
+
Start with the short [project overview](../README.md), then choose the relevant guide.
|
|
5
|
+
|
|
6
|
+
| Guide | Contents |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| [Installation](installation.md) | Python, uv, dependencies, and platform prerequisites |
|
|
9
|
+
| [Array processing](array-processing.md) | Array shape, streaming blocks, preparation, and latency |
|
|
10
|
+
| [Multichannel audio](multichannel.md) | Channel negotiation, surround layouts, sidechains, and separate output buses |
|
|
11
|
+
| [Instruments](instruments.md) | MIDI notes, offline score rendering, and the Tk piano example |
|
|
12
|
+
| [Offline rendering](rendering.md) | Snapshots, progress callbacks, cancellation, and tails |
|
|
13
|
+
| [Native editors](editors.md) | OS windows, threading, resizing, and live adjustment |
|
|
14
|
+
| [Parameters and state](parameters-and-state.md) | Normalized parameters, snapshots, restore, and ownership |
|
|
15
|
+
| [Discovery](discovery.md) | Search paths, inspection, multiple classes, AU IDs, and AAX probing |
|
|
16
|
+
| [Player and smoke checks](examples.md) | Standalone playback, WAV export, and installed plugin checks |
|
|
17
|
+
| [API reference](api-reference.md) | Public functions, classes, signatures, and errors |
|
|
18
|
+
| [Platform support](platform-support.md) | Format matrix, implementation scope, and verification limits |
|
|
19
|
+
| [Architecture](architecture.md) | Process isolation, audio/UI threads, ctypes bridges, and builds |
|
|
20
|
+
| [Development](development.md) | Tests, lint, packaging, and CI |
|
|
21
|
+
| [Troubleshooting](troubleshooting.md) | Loading failures, editor issues, timeouts, and playback problems |
|
|
22
|
+
|
|
23
|
+
All examples that create plugin processes must run from an importable Python
|
|
24
|
+
script under an `if __name__ == "__main__":` guard. Plugin binaries must match the
|
|
25
|
+
operating system and CPU architecture of Python.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Public API reference
|
|
2
|
+
|
|
3
|
+
Import public names from `pyaudiohost`. Backend modules and `_worker` are internal.
|
|
4
|
+
`AudioHost` and `Host` are aliases of `PluginChain` and expose the same array API.
|
|
5
|
+
|
|
6
|
+
All public exports have English docstrings in their defining Python modules.
|
|
7
|
+
Class documentation covers constructor arguments and data fields; method and
|
|
8
|
+
property docstrings describe return values, validation, ownership, and lifecycle.
|
|
9
|
+
The imported names retain this documentation for IDE tooltips and Python help:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import pyaudiohost
|
|
13
|
+
|
|
14
|
+
help(pyaudiohost.Plugin)
|
|
15
|
+
help(pyaudiohost.Plugin.prepare)
|
|
16
|
+
help(pyaudiohost.PluginChain.render)
|
|
17
|
+
help(pyaudiohost.scan_plugins)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`Plugin`, `PluginChain`, and their aliases support `with` statements. Leaving a
|
|
21
|
+
context closes its owned workers without suppressing exceptions. Metadata classes
|
|
22
|
+
`PluginDescription` and `ScanResult` use the dataclass-generated constructors.
|
|
23
|
+
|
|
24
|
+
## Loading and descriptions
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Plugin(path, *, plugin_id=None, timeout=30.0)
|
|
28
|
+
load_plugin(path, *, plugin_id=None, timeout=30.0)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`path` is a string, `Path`, or `PluginDescription`. Passing a description selects
|
|
32
|
+
its native class ID. A handle owns an isolated worker and should be used as a
|
|
33
|
+
context manager or closed explicitly. `timeout` is the default request timeout
|
|
34
|
+
in seconds. AAX loading is rejected; use `probe_aax()` instead.
|
|
35
|
+
|
|
36
|
+
`PluginDescription` is an immutable dataclass:
|
|
37
|
+
|
|
38
|
+
| Field | Type | Default |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| `id` | `str` | Required native class ID |
|
|
41
|
+
| `name` | `str` | Required display name |
|
|
42
|
+
| `path` | `str` | Required resolved path or AU registry ID |
|
|
43
|
+
| `format` | `str` | Required format code |
|
|
44
|
+
| `vendor` | `str` | `""` |
|
|
45
|
+
| `version` | `str` | `""` |
|
|
46
|
+
| `is_instrument` | `bool` | `False` |
|
|
47
|
+
|
|
48
|
+
`description.to_dict()` returns a serializable dictionary.
|
|
49
|
+
|
|
50
|
+
## Plugin methods
|
|
51
|
+
|
|
52
|
+
| Method | Behavior |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `prepare(sample_rate=48000, block_size=1024, channels=2, *, offline=False, input_buses=None, output_buses=None)` | Negotiate channels and enabled buses; returns the handle |
|
|
55
|
+
| `audio_buses()` | Query current native bus indices, widths, speaker masks, and activation |
|
|
56
|
+
| `process(audio, sample_rate=None, *, position=0, playing=True, tempo=120.0, midi=())` | Return `(channels, frames)` float32 audio; optionally deliver `MidiNote` events |
|
|
57
|
+
| `process_buses(audio=None, *, frames=None, position=0, playing=True, tempo=120.0, midi=())` | Process independent inputs and return `{output_bus: array}` |
|
|
58
|
+
| `render(duration_seconds, *, midi=(), ...)` | Render an instrument's settings into an independent, latency-compensated audio array |
|
|
59
|
+
| `render_buses(duration_seconds, **kwargs)` | Render every enabled instrument output together; accepts `render()` options except `output_bus` |
|
|
60
|
+
| `parameters()` | Return parameter metadata/value dictionaries |
|
|
61
|
+
| `set_parameter(parameter_id, value)` | Set a normalized finite value in `[0, 1]` |
|
|
62
|
+
| `save_state()` | Return native state as bytes |
|
|
63
|
+
| `load_state(state)` | Restore bytes into the same native class |
|
|
64
|
+
| `snapshot()` | Return description, instance ID, bypass, and base64 state |
|
|
65
|
+
| `clone(*, sample_rate=None, block_size=None, channels=None, offline=True, input_buses=None, output_buses=None)` | Return an independent handle with copied settings and inherited or overridden bus configuration |
|
|
66
|
+
| `reset()` | Reset processing history while preserving plugin settings |
|
|
67
|
+
| `open_editor()` | Open/activate the worker's native plugin view |
|
|
68
|
+
| `close_editor()` | Close only the native view |
|
|
69
|
+
| `close()` | Close editor and plugin worker; safe to repeat |
|
|
70
|
+
|
|
71
|
+
Properties: `name`, `description`, `id` (instance UUID string), `bypassed` (mutable),
|
|
72
|
+
`closed`, `latency_samples`, `tail_samples`, and `editor_is_open`. Timing properties
|
|
73
|
+
report the worker's latest native timing information. They may briefly lag a GUI
|
|
74
|
+
change until the main thread refreshes/reconfigures the processor.
|
|
75
|
+
|
|
76
|
+
Audio arrays have 1 through 64 channels. Bus maps select native indices, for
|
|
77
|
+
example `input_buses={0: 6, 1: 2}` and `output_buses={0: 6}`. Values can also be
|
|
78
|
+
`{"channels": 6, "arrangement": 0x3f}` for an explicit VST3 speaker mask. Each
|
|
79
|
+
direction permits up to 64 enabled channels in total; indices range from 0 to 31.
|
|
80
|
+
`process()` uses the main bus, while `process_buses()` preserves each bus's native
|
|
81
|
+
width. Omitted input arrays receive silence; supply `frames` when no arrays are
|
|
82
|
+
given. See [multichannel audio](multichannel.md) for negotiation and format limits.
|
|
83
|
+
|
|
84
|
+
`MidiNote(note, velocity=1.0, channel=0, sample_offset=0)` is an immutable event.
|
|
85
|
+
Pitches are integers 0–127; channels are zero-based 0–15; velocity is normalized
|
|
86
|
+
to 0–1, with zero meaning note-off. Offsets are nonnegative integers smaller than
|
|
87
|
+
the current process array's frame count. In `render()`, note-offs may also be at
|
|
88
|
+
the score's final frame boundary. Events are sorted stably and translated into
|
|
89
|
+
their native processing blocks. See [instruments](instruments.md).
|
|
90
|
+
|
|
91
|
+
The instrument rendering signature is:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
Plugin.render(duration_seconds, *, midi=(), sample_rate=None, block_size=None,
|
|
95
|
+
channels=None, tail_seconds=None, max_tail_seconds=30.0,
|
|
96
|
+
progress=None, cancel=None, tempo=120.0, input_buses=None,
|
|
97
|
+
output_buses=None, output_bus=0)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The body contains `round(duration_seconds * sample_rate)` frames. It releases held
|
|
101
|
+
notes at the end and preserves the source instance's processing history. Omitted
|
|
102
|
+
audio configuration uses the source's prepared values or 48000 Hz / 1024 frames /
|
|
103
|
+
stereo. Explicit tails range from 0 to 30 seconds; `None` renders the entire
|
|
104
|
+
`max_tail_seconds` window and trims trailing silence without shortening the body.
|
|
105
|
+
Both render methods share the float progress callback (`0` through `1`, in the
|
|
106
|
+
calling thread), cancellation event, and cleanup contracts. See
|
|
107
|
+
[instrument rendering](instruments.md#high-level-offline-rendering).
|
|
108
|
+
|
|
109
|
+
`output_bus` selects an enabled output. `None` returns a dictionary containing all
|
|
110
|
+
enabled buses with native widths and aligned frame counts, as does `render_buses()`.
|
|
111
|
+
Bus maps default to the live handle's routing. They affect only the offline copy.
|
|
112
|
+
All outputs share one progress/cancellation stream and common tail trimming.
|
|
113
|
+
|
|
114
|
+
## PluginChain
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
PluginChain(plugins=(), *, sample_rate=48000, block_size=1024, channels=2)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`plugins` is an iterable of paths, descriptions, or existing handles. Paths and
|
|
121
|
+
descriptions create owned handles; existing handles are borrowed.
|
|
122
|
+
|
|
123
|
+
| Method/property | Behavior |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| `prepare(sample_rate=48000, block_size=1024, channels=2)` | Reconfigure the chain; returns the chain |
|
|
126
|
+
| `plugins` | Ordered tuple of handles |
|
|
127
|
+
| `add_plugin(path, *, plugin_id=None)` | Prepare/add a handle and return it |
|
|
128
|
+
| `remove_plugin(plugin)` | Remove; close if owned; return the handle |
|
|
129
|
+
| `move_plugin(plugin, index)` | Change order using a Python list insertion index |
|
|
130
|
+
| `latency_samples` | Sum latency of enabled handles |
|
|
131
|
+
| `process(audio, *, reset=False, position=None, tempo=120.0)` | Process a streaming block and retain DSP history/latency |
|
|
132
|
+
| `render(audio, *, tail_seconds=0.0, progress=None, cancel=None, tempo=120.0)` | Render a snapshot with latency compensation and return an array |
|
|
133
|
+
| `reset()` | Reset native DSP history and chain position |
|
|
134
|
+
| `snapshot()` | Return a serializable chain dictionary |
|
|
135
|
+
| `save_state()` | Return UTF-8 JSON bytes |
|
|
136
|
+
| `load_state(state)` | Transactionally replace the chain from bytes or a dictionary |
|
|
137
|
+
| `close()` | Close owned handles and detach borrowed handles |
|
|
138
|
+
|
|
139
|
+
Configuration attributes: `sample_rate`, `block_size`, and `channels`. Use
|
|
140
|
+
`prepare()` to change them rather than assigning them directly. The chain supports
|
|
141
|
+
context management.
|
|
142
|
+
|
|
143
|
+
The chain supports 1 through 64 channels on its main path. It does not route
|
|
144
|
+
sidechains or independent auxiliary outputs; use individual `Plugin` bus methods
|
|
145
|
+
for those connections.
|
|
146
|
+
|
|
147
|
+
`progress` is a synchronous callable receiving a fraction from 0 through 1;
|
|
148
|
+
`cancel` is a `threading.Event`. See [rendering](rendering.md) for their full
|
|
149
|
+
contracts and examples. File names, file objects, and output device arguments are
|
|
150
|
+
not accepted by processing methods.
|
|
151
|
+
|
|
152
|
+
## Discovery functions
|
|
153
|
+
|
|
154
|
+
| Function | Result |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `default_search_paths()` | Platform-default `Path` list including environment additions |
|
|
157
|
+
| `find_plugin_paths(paths=None)` | Sorted, deduplicated candidate paths without native inspection |
|
|
158
|
+
| `inspect_plugin(path, *, timeout=20.0)` | List of descriptions from one path/registry query |
|
|
159
|
+
| `scan_plugins(paths=None, *, timeout=20.0, include_instruments=False, probe_aax_plugins=False)` | `ScanResult` |
|
|
160
|
+
| `probe_aax(path, *, timeout=20.0)` | Module/export/version dictionary; processing unavailable |
|
|
161
|
+
| `capabilities()` | Implemented formats, probe-only formats, and default search paths |
|
|
162
|
+
|
|
163
|
+
`ScanResult.plugins` is a list of descriptions. `errors` maps candidate paths to
|
|
164
|
+
error strings; `aax_reports` maps AAX candidate paths to probe dictionaries.
|
|
165
|
+
See [discovery](discovery.md) for search semantics and AU identifiers.
|
|
166
|
+
|
|
167
|
+
## Errors
|
|
168
|
+
|
|
169
|
+
| Exception | Meaning |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `AudioHostError` | Base host/native-operation failure |
|
|
172
|
+
| `HostCrashedError` | Worker exited or communication failed |
|
|
173
|
+
| `HostTimeoutError` | Operation exceeded its deadline; worker terminated |
|
|
174
|
+
| `UnsupportedFormatError` | Unsupported format, platform, or reserved AAX processing |
|
|
175
|
+
| `ValueError` | Invalid array/configuration, parameter value, or public input |
|
|
176
|
+
|
|
177
|
+
`HostTimeoutError` also subclasses Python's `TimeoutError`. After a timeout/crash,
|
|
178
|
+
discard the closed handle and load a fresh instance. Native error messages arrive
|
|
179
|
+
as `AudioHostError` with the original error type/message included in the text.
|