wavegraph 0.1.2-aarch64-linux-gnu
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +26 -0
- data/LICENSE-APACHE +201 -0
- data/LICENSE-MIT +22 -0
- data/README.md +209 -0
- data/examples/acid.rb +45 -0
- data/lib/wavegraph/host.rb +99 -0
- data/lib/wavegraph/native/libwavegraph.so +0 -0
- data/lib/wavegraph/native.rb +51 -0
- data/lib/wavegraph/patch.rb +41 -0
- data/lib/wavegraph/performance.rb +47 -0
- data/lib/wavegraph/version.rb +5 -0
- data/lib/wavegraph.rb +33 -0
- data/licenses/COPYRIGHT-library.html +29630 -0
- data/licenses/alsa-0.11.0/LICENSE-APACHE +177 -0
- data/licenses/alsa-0.11.0/LICENSE-MIT +21 -0
- data/licenses/alsa-sys-0.4.0/LICENSE +21 -0
- data/licenses/audio-codec-algorithms-0.8.1/LICENSE-0BSD +14 -0
- data/licenses/audio-codec-algorithms-0.8.1/LICENSE-APACHE +176 -0
- data/licenses/audioadapter-5.0.0/LICENSE-APACHE +201 -0
- data/licenses/audioadapter-5.0.0/LICENSE-MIT +19 -0
- data/licenses/audioadapter-5.0.0/LICENSE.txt +6 -0
- data/licenses/audioadapter-buffers-5.2.0/LICENSE-APACHE +201 -0
- data/licenses/audioadapter-buffers-5.2.0/LICENSE-MIT +19 -0
- data/licenses/audioadapter-buffers-5.2.0/LICENSE.txt +6 -0
- data/licenses/audioadapter-sample-5.2.0/LICENSE-APACHE +201 -0
- data/licenses/audioadapter-sample-5.2.0/LICENSE-MIT +19 -0
- data/licenses/audioadapter-sample-5.2.0/LICENSE.txt +6 -0
- data/licenses/bitflags-2.13.2/LICENSE-APACHE +201 -0
- data/licenses/bitflags-2.13.2/LICENSE-MIT +25 -0
- data/licenses/byteorder-1.5.0/COPYING +3 -0
- data/licenses/byteorder-1.5.0/LICENSE-MIT +21 -0
- data/licenses/byteorder-1.5.0/UNLICENSE +24 -0
- data/licenses/bytes-1.12.2/LICENSE +25 -0
- data/licenses/cfg-if-1.0.5/LICENSE-APACHE +201 -0
- data/licenses/cfg-if-1.0.5/LICENSE-MIT +25 -0
- data/licenses/cpal-0.18.2/LICENSE +201 -0
- data/licenses/dasp_sample-0.11.0/dasp_sample-MIT +21 -0
- data/licenses/hash32-0.3.1/LICENSE-APACHE +201 -0
- data/licenses/hash32-0.3.1/LICENSE-MIT +25 -0
- data/licenses/heapless-0.9.4/LICENSE-APACHE +201 -0
- data/licenses/heapless-0.9.4/LICENSE-MIT +25 -0
- data/licenses/libc-0.2.191/LICENSE-APACHE +176 -0
- data/licenses/libc-0.2.191/LICENSE-MIT +25 -0
- data/licenses/libm-0.2.16/LICENSE.txt +258 -0
- data/licenses/micromath-2.2.0/LICENSE-APACHE +202 -0
- data/licenses/micromath-2.2.0/LICENSE-MIT +21 -0
- data/licenses/mio-1.2.5/LICENSE +19 -0
- data/licenses/num-integer-0.1.47/LICENSE-APACHE +201 -0
- data/licenses/num-integer-0.1.47/LICENSE-MIT +25 -0
- data/licenses/num-traits-0.2.19/LICENSE-APACHE +201 -0
- data/licenses/num-traits-0.2.19/LICENSE-MIT +25 -0
- data/licenses/once_cell-1.21.4/LICENSE-APACHE +201 -0
- data/licenses/once_cell-1.21.4/LICENSE-MIT +23 -0
- data/licenses/peg-0.8.6/LICENSE +25 -0
- data/licenses/peg-runtime-0.8.6/LICENSE +25 -0
- data/licenses/pin-project-lite-0.2.19/LICENSE-APACHE +177 -0
- data/licenses/pin-project-lite-0.2.19/LICENSE-MIT +23 -0
- data/licenses/rtrb-0.3.6/LICENSE-APACHE +201 -0
- data/licenses/rtrb-0.3.6/LICENSE-MIT +23 -0
- data/licenses/rubato-5.1.0/LICENSE-APACHE +201 -0
- data/licenses/rubato-5.1.0/LICENSE-MIT +19 -0
- data/licenses/rubato-5.1.0/LICENSE.txt +6 -0
- data/licenses/socket2-0.6.5/LICENSE-APACHE +201 -0
- data/licenses/socket2-0.6.5/LICENSE-MIT +25 -0
- data/licenses/stable_deref_trait-1.2.1/LICENSE-APACHE +201 -0
- data/licenses/stable_deref_trait-1.2.1/LICENSE-MIT +25 -0
- data/licenses/tokio-1.54.1/LICENSE +21 -0
- data/licenses/tracing-0.1.44/LICENSE +25 -0
- data/licenses/tracing-core-0.1.36/LICENSE +25 -0
- data/licenses/wavegraph-0.1.3/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-0.1.3/LICENSE-MIT +22 -0
- data/licenses/wavegraph-303-0.1.2/LICENSE +21 -0
- data/licenses/wavegraph-808-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-808-0.1.0/LICENSE-MIT +22 -0
- data/licenses/wavegraph-909-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-909-0.1.0/LICENSE-CC0 +102 -0
- data/licenses/wavegraph-909-0.1.0/LICENSE-MIT +21 -0
- data/licenses/wavegraph-909-0.1.0/README.md +25 -0
- data/licenses/wavegraph-adsr-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-adsr-0.1.0/LICENSE-MIT +22 -0
- data/licenses/wavegraph-audio-0.1.1/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-audio-0.1.1/LICENSE-MIT +21 -0
- data/licenses/wavegraph-compiler-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-compiler-0.1.0/LICENSE-MIT +22 -0
- data/licenses/wavegraph-core-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-core-0.1.0/LICENSE-MIT +22 -0
- data/licenses/wavegraph-dsp-0.1.1/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-dsp-0.1.1/LICENSE-MIT +21 -0
- data/licenses/wavegraph-fx-0.1.1/LICENSE-APACHE +202 -0
- data/licenses/wavegraph-fx-0.1.1/LICENSE-MIT +22 -0
- data/licenses/wavegraph-lfo-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-lfo-0.1.0/LICENSE-MIT +22 -0
- data/licenses/wavegraph-remote-0.1.2/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-remote-0.1.2/LICENSE-MIT +21 -0
- data/licenses/wavegraph-sample-0.1.1/LICENSE-APACHE +216 -0
- data/licenses/wavegraph-sample-0.1.1/LICENSE-MIT +22 -0
- data/licenses/wavegraph-sampler-0.1.0/LICENSE-APACHE +201 -0
- data/licenses/wavegraph-sampler-0.1.0/LICENSE-MIT +21 -0
- data/licenses/windowfunctions-0.1.1/LICENSE.txt +19 -0
- metadata +172 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: de00311b0403c70cd5a06fce924c56e442a0b6a0afec47927520f5dd00329dd3
|
|
4
|
+
data.tar.gz: 8f6dde5f1baa8940eea9654a2ea5eafb266a566c5df80ee7e91511b6bdcf7ebb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 55ef0a7defc7760e44f5cf16a87dbab5047aa19ed03c681842cd36a35a17eb4834e2e0085fc885039e08db8f7d13c5dabadb2f620102d484336d3a33c95185e8
|
|
7
|
+
data.tar.gz: b1e15ead758d320f62c7260123e1b34ac21ebc39edf12e8c966e6e8790ac7c2a188f15cbfcd3d9252f408759f9ea2c9a5f2f30bda4904a06dbebdf86cc53ba8d
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.2 (2026-12-05)
|
|
4
|
+
|
|
5
|
+
- Ship native gems for `x86_64-linux-gnu` and `aarch64-linux-gnu`. The
|
|
6
|
+
Ubuntu 22.04 builds bundle the WaveGraph 0.1.3 host and use the system
|
|
7
|
+
ALSA library (`libasound.so.2`) for playback.
|
|
8
|
+
- Honor `CARGO_BUILD_TARGET` when building a platform gem from source.
|
|
9
|
+
|
|
10
|
+
## 0.1.1 (2026-12-05)
|
|
11
|
+
|
|
12
|
+
- Introduce wavegraph.rb with examples for embedding the factory rack and
|
|
13
|
+
playing a custom patch. Include the guide in the gem's RDoc.
|
|
14
|
+
- Expand the RubyGems description and link to the bass-line example and issue
|
|
15
|
+
tracker.
|
|
16
|
+
- Use RubyGems 4.1 in the release workflow for automatic Sigstore signing.
|
|
17
|
+
|
|
18
|
+
## 0.1.0 (2026-12-05)
|
|
19
|
+
|
|
20
|
+
- Embed the WaveGraph 0.1.3 host in Ruby. Start the factory 3389 rack or
|
|
21
|
+
supply a `.wg` patch to `WaveGraph.open`. Use `WaveGraph.compile` to reuse a
|
|
22
|
+
patch across hosts.
|
|
23
|
+
- Send MIDI notes, control changes and transport commands, or use the host's
|
|
24
|
+
Unix socket for graph discovery. Headless playback runs at the DSP rate.
|
|
25
|
+
- The macOS platform gem includes the native host library and its license
|
|
26
|
+
notices.
|
data/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/LICENSE-MIT
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WaveGraph Developers
|
|
4
|
+
Copyright (c) 2026 FM-1 Rust Developers
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# wavegraph.rb
|
|
2
|
+
|
|
3
|
+
[][gem]
|
|
4
|
+
[][ci]
|
|
5
|
+
[][chat-link]
|
|
6
|
+
|
|
7
|
+
Embed the [WaveGraph audio engine][wavegraph] in a Ruby application. The
|
|
8
|
+
`wavegraph` gem runs the synths, drum machines and effects in your process.
|
|
9
|
+
Ruby supplies the patch and sends MIDI controls while the engine sequences
|
|
10
|
+
notes on the audio sample clock.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Use Ruby 3.1 or later. Each platform gem includes the native engine.
|
|
15
|
+
Check the [published versions][versions] for your platform.
|
|
16
|
+
|
|
17
|
+
| Gem platform | Runtime |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `arm64-darwin` | Apple silicon, macOS 14.2+ (CoreAudio) |
|
|
20
|
+
| `x86_64-linux-gnu`, `aarch64-linux-gnu` | glibc Linux (Ubuntu 22.04 baseline), `libasound.so.2` (ALSA), RubyGems 3.3.22+ |
|
|
21
|
+
|
|
22
|
+
In an application with a Gemfile, add the gem with Bundler.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
bundle add wavegraph
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For a standalone Ruby script, install it directly.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
gem install wavegraph
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
On an Intel Mac or on musl Linux (x86-64 or AArch64), [build from the checkout][build].
|
|
35
|
+
|
|
36
|
+
## Play the factory rack
|
|
37
|
+
|
|
38
|
+
`WaveGraph.open` starts the 3389 rack with two TB-303 bass lines, a TR-808
|
|
39
|
+
and a TR-909. This plays one bar, pauses the sequencer to play a note on the
|
|
40
|
+
first 303, then restarts the patterns at step one.
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
require "wavegraph"
|
|
44
|
+
|
|
45
|
+
WaveGraph.open(bpm: 120) do |rack|
|
|
46
|
+
sleep 2
|
|
47
|
+
rack.stop
|
|
48
|
+
rack.note_on(38, velocity: 116, channel: 1)
|
|
49
|
+
sleep 0.25
|
|
50
|
+
rack.note_off(38, channel: 1)
|
|
51
|
+
rack.play
|
|
52
|
+
sleep 2
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The block returns its last value and shuts down the engine on exit, including
|
|
57
|
+
when the block raises. MIDI channels run from 1 to 16 and default to 1.
|
|
58
|
+
|
|
59
|
+
## Play a bass line
|
|
60
|
+
|
|
61
|
+
Pass a WaveGraph Language (`.wg`) patch to build your own rack. Here a
|
|
62
|
+
square-wave 303 loops an eight-step pattern while Ruby moves its cutoff
|
|
63
|
+
once per beat.
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
require "wavegraph"
|
|
67
|
+
|
|
68
|
+
acid = <<~WG
|
|
69
|
+
node bass tb303 ch=1 wave=square resonance=0.82 steps=38!,-,38,45,38,-,50!,38
|
|
70
|
+
gain trim bass.out 80
|
|
71
|
+
output left trim.out
|
|
72
|
+
output right trim.out
|
|
73
|
+
WG
|
|
74
|
+
|
|
75
|
+
bpm = 124
|
|
76
|
+
WaveGraph.open(acid, bpm:) do |host|
|
|
77
|
+
[32, 48, 64, 80, 96, 80, 64, 48].each do |cutoff|
|
|
78
|
+
host.cc(74, cutoff)
|
|
79
|
+
sleep 60.0 / bpm
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The [patch reference][patches] lists instruments, effects and their MIDI
|
|
85
|
+
controls. The [acid example][acid] shipped with the gem adds a four-on-the-floor
|
|
86
|
+
909 kick and uses it to sidechain the bass. Run it from your bundled application.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
bundle exec ruby "$(bundle info wavegraph --path)/examples/acid.rb"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Load a patch from disk
|
|
93
|
+
|
|
94
|
+
Pass `File.binread("bass.wg")` to `WaveGraph.open` to play a patch file.
|
|
95
|
+
To reuse it, compile it once and pass the result to each host. Each host
|
|
96
|
+
takes its own copy. Set `headless: true` to run at playback speed without
|
|
97
|
+
opening an audio device.
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
require "wavegraph"
|
|
101
|
+
|
|
102
|
+
patch = WaveGraph.compile(File.binread("bass.wg"))
|
|
103
|
+
begin
|
|
104
|
+
[110, 124].each do |tempo|
|
|
105
|
+
WaveGraph.open(patch, bpm: tempo, headless: true) do |host|
|
|
106
|
+
host.cc(74, 90)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
ensure
|
|
110
|
+
patch.close
|
|
111
|
+
end
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Compilation errors raise `WaveGraph::InvalidPatch` with the native
|
|
115
|
+
diagnostic. The compiler checks the patch language at compile time.
|
|
116
|
+
The host checks instrument-specific options when it starts.
|
|
117
|
+
|
|
118
|
+
## Control a running host
|
|
119
|
+
|
|
120
|
+
For an interactive session, use `host = WaveGraph::Host.start` and call
|
|
121
|
+
`host.shutdown` when finished. The default wait is five seconds.
|
|
122
|
+
`shutdown(timeout_ms: 0)` requests shutdown and polls. If it returns
|
|
123
|
+
`false`, the handle is still live and a later call can finish the join.
|
|
124
|
+
Local shutdown also works after the peer socket closes.
|
|
125
|
+
|
|
126
|
+
`host.socket` is the connected Ruby `UNIXSocket` for applications that
|
|
127
|
+
speak the [WaveGraph Remote wire protocol][remote]. Coordinate reads and
|
|
128
|
+
writes when combining raw socket traffic with the MIDI helpers.
|
|
129
|
+
|
|
130
|
+
## Install from the checkout
|
|
131
|
+
|
|
132
|
+
Build on macOS 14.2+ or 64-bit Linux with Ruby 3.1+, Bundler and Rust 1.95+.
|
|
133
|
+
On Debian or Ubuntu, install `pkg-config` and `libasound2-dev` for the
|
|
134
|
+
ALSA backend. macOS uses CoreAudio.
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
cd wavegraph-ruby
|
|
138
|
+
bundle install
|
|
139
|
+
bundle exec rake build
|
|
140
|
+
gem install ./pkg/wavegraph-*.gem
|
|
141
|
+
ruby examples/acid.rb
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`rake build` packages the native library for the build machine. To cross-compile,
|
|
145
|
+
set `CARGO_BUILD_TARGET` to the Rust target triple and configure its linker in
|
|
146
|
+
Cargo. For Linux, point `pkg-config` at the target's ALSA development files.
|
|
147
|
+
The build environment determines the libc and minimum symbol versions.
|
|
148
|
+
|
|
149
|
+
## Develop against a local host build
|
|
150
|
+
|
|
151
|
+
`WAVEGRAPH_LIBRARY` selects a shared library by path and takes
|
|
152
|
+
precedence over the copy in a platform gem. From a Linux workspace
|
|
153
|
+
checkout, run the tests against a debug build.
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
cargo rustc -p wavegraph --locked --lib --no-default-features --features ffi --crate-type cdylib
|
|
157
|
+
export WAVEGRAPH_LIBRARY="$PWD/target/debug/libwavegraph.so"
|
|
158
|
+
cd wavegraph-ruby
|
|
159
|
+
bundle install
|
|
160
|
+
bundle exec rake test
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Use `libwavegraph.dylib` on macOS. To build a generic Ruby gem for an
|
|
164
|
+
application that supplies its own native library, run
|
|
165
|
+
`gem build wavegraph.gemspec` from this directory.
|
|
166
|
+
|
|
167
|
+
## Publish to RubyGems
|
|
168
|
+
|
|
169
|
+
After merging a gem version bump, push a new `wavegraph-ruby/v<VERSION>` tag.
|
|
170
|
+
The [release workflow][publish] builds each platform gem on its native runner,
|
|
171
|
+
installs it and runs the headless tests against the installed copy. Once all
|
|
172
|
+
platforms pass, it publishes each tested gem through the `rubygems` environment.
|
|
173
|
+
RubyGems 4.1 attempts a Sigstore attestation at push time. Choose **Run workflow**
|
|
174
|
+
on `main` for a dry run that leaves one downloadable artifact per platform.
|
|
175
|
+
|
|
176
|
+
The release task verifies the crates.io archive for `wavegraph` 0.1.3 against
|
|
177
|
+
its SHA-256 checksum, uses the archive's `Cargo.lock`, and packages the native
|
|
178
|
+
dependency notices. To reproduce the build, run `bundle exec rake build:release`
|
|
179
|
+
in `wavegraph-ruby/` on Ubuntu 22.04 or set `MACOSX_DEPLOYMENT_TARGET=14.2`
|
|
180
|
+
when running it on macOS. The gem is written to `pkg/release/`.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
The Ruby binding is licensed under either of
|
|
185
|
+
|
|
186
|
+
- [Apache License, Version 2.0][apache]
|
|
187
|
+
- [MIT License][mit]
|
|
188
|
+
|
|
189
|
+
at your option. Platform gems include notices for the bundled native code
|
|
190
|
+
in `licenses/`.
|
|
191
|
+
|
|
192
|
+
### Contribution
|
|
193
|
+
|
|
194
|
+
Unless you explicitly state otherwise, you license any contribution you
|
|
195
|
+
intentionally submit for inclusion in this work (as defined in the Apache-2.0
|
|
196
|
+
license) under both licenses above, without additional terms or conditions.
|
|
197
|
+
|
|
198
|
+
[gem]: https://rubygems.org/gems/wavegraph
|
|
199
|
+
[ci]: https://github.com/fm1-rust/wavegraph/actions/workflows/wavegraph-ruby.yml
|
|
200
|
+
[chat-link]: https://discord.gg/bq8NYQWzm5
|
|
201
|
+
[wavegraph]: https://wavegraph.org/
|
|
202
|
+
[versions]: https://rubygems.org/gems/wavegraph/versions
|
|
203
|
+
[build]: https://github.com/fm1-rust/wavegraph/blob/main/wavegraph-ruby/README.md#install-from-the-checkout
|
|
204
|
+
[patches]: https://docs.rs/wavegraph/0.1.3/wavegraph/#write-a-patch
|
|
205
|
+
[acid]: https://github.com/fm1-rust/wavegraph/blob/main/wavegraph-ruby/examples/acid.rb
|
|
206
|
+
[remote]: https://github.com/fm1-rust/wavegraph/blob/main/wavegraph-remote/README.md#protocol-and-scope
|
|
207
|
+
[publish]: https://github.com/fm1-rust/wavegraph/actions/workflows/publish-rubygem.yml
|
|
208
|
+
[apache]: https://github.com/fm1-rust/wavegraph/blob/main/wavegraph-ruby/LICENSE-APACHE
|
|
209
|
+
[mit]: https://github.com/fm1-rust/wavegraph/blob/main/wavegraph-ruby/LICENSE-MIT
|
data/examples/acid.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "wavegraph"
|
|
4
|
+
|
|
5
|
+
# Count each row "1 e & a". The 303 leaves the first kick of the bar exposed.
|
|
6
|
+
bass = %w[
|
|
7
|
+
- 38 38! 45
|
|
8
|
+
38 - 50! 38
|
|
9
|
+
- 41! 38 45
|
|
10
|
+
38 - 48 45!
|
|
11
|
+
]
|
|
12
|
+
# Kick (36) on every beat, clap (39) on 2 and 4. Each open hat (46)
|
|
13
|
+
# lands on the "&" and the closed hat (42) chokes it on the next beat.
|
|
14
|
+
drums = %w[
|
|
15
|
+
36+42 - 46 -
|
|
16
|
+
36+39+42 - 46 -
|
|
17
|
+
36+42 - 46 -
|
|
18
|
+
36+39+42 - 46 -
|
|
19
|
+
]
|
|
20
|
+
patch = <<~WG
|
|
21
|
+
node acid tb303 ch=1 wave=square cutoff=212 resonance=0.94 env=2.8 decay=0.26 accent=0.90 overdrive=0.84 steps=#{bass.join(",")}
|
|
22
|
+
node kit tr909 decay=72 steps=#{drums.join(",")}
|
|
23
|
+
|
|
24
|
+
node bassFx strip slot1=saturator slot2=compressor
|
|
25
|
+
connect acid.out bassFx.in
|
|
26
|
+
connect kit.kick bassFx.key
|
|
27
|
+
|
|
28
|
+
# The kit mix already includes the kick. Blend in another quarter of its dry signal.
|
|
29
|
+
gain punch kit.kick 32
|
|
30
|
+
mix drums kit.out punch.out
|
|
31
|
+
mix master bassFx.out drums.out
|
|
32
|
+
output left master.out
|
|
33
|
+
output right master.out
|
|
34
|
+
WG
|
|
35
|
+
|
|
36
|
+
bpm = 124
|
|
37
|
+
WaveGraph.open(patch, bpm: bpm) do |rack|
|
|
38
|
+
# The DSP clocks both patterns. Ruby moves the 303 cutoff once per beat.
|
|
39
|
+
2.times do
|
|
40
|
+
[32, 40, 52, 68, 84, 100, 74, 48].each do |cutoff|
|
|
41
|
+
rack.cc(74, cutoff, channel: 1)
|
|
42
|
+
sleep 60.0 / bpm
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "socket"
|
|
4
|
+
|
|
5
|
+
module WaveGraph
|
|
6
|
+
class Host
|
|
7
|
+
include Performance
|
|
8
|
+
|
|
9
|
+
attr_reader :socket
|
|
10
|
+
|
|
11
|
+
# A nil source selects the bundled 3389 rack.
|
|
12
|
+
def self.start(source = nil, bpm: 122, headless: false)
|
|
13
|
+
new(source, bpm, headless)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.open(...)
|
|
17
|
+
raise ArgumentError, "Host.open requires a block" unless block_given?
|
|
18
|
+
|
|
19
|
+
host = start(...)
|
|
20
|
+
begin
|
|
21
|
+
yield host
|
|
22
|
+
ensure
|
|
23
|
+
loop { break if host.shutdown }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private_class_method :new
|
|
28
|
+
|
|
29
|
+
# The closure owns only the native slot. Copies of a Host share its
|
|
30
|
+
# mutex, slot and socket, and the last owner triggers this fallback.
|
|
31
|
+
def self.reaper(slot, pid)
|
|
32
|
+
proc do
|
|
33
|
+
next if Process.pid != pid || slot.read_pointer.null?
|
|
34
|
+
begin
|
|
35
|
+
Thread.new do
|
|
36
|
+
loop { break unless Native.host_shutdown(slot, 5000) == Native::TIMEOUT }
|
|
37
|
+
end
|
|
38
|
+
rescue ThreadError
|
|
39
|
+
# Ruby is exiting and can no longer start a thread.
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
private_class_method :reaper
|
|
44
|
+
|
|
45
|
+
def initialize(source, bpm, headless)
|
|
46
|
+
unless bpm.is_a?(Integer) && (30..300).cover?(bpm)
|
|
47
|
+
raise ArgumentError, "bpm must be an Integer between 30 and 300"
|
|
48
|
+
end
|
|
49
|
+
unless headless == true || headless == false
|
|
50
|
+
raise ArgumentError, "headless must be true or false"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
@pid = Process.pid
|
|
54
|
+
@lock = Mutex.new
|
|
55
|
+
@slot = FFI::MemoryPointer.new(:pointer)
|
|
56
|
+
ObjectSpace.define_finalizer(@lock, Host.send(:reaper, @slot, @pid))
|
|
57
|
+
server, peer = UNIXSocket.pair
|
|
58
|
+
begin
|
|
59
|
+
case source
|
|
60
|
+
when nil
|
|
61
|
+
Native.check(Native.host_start(server.fileno, nil, bpm, headless, @slot))
|
|
62
|
+
when Patch
|
|
63
|
+
source.send(:with_pointer) do |pointer|
|
|
64
|
+
Native.check(Native.host_start(server.fileno, pointer, bpm, headless, @slot))
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
Native.with_source(source) do |buffer, length|
|
|
68
|
+
Native.check(Native.host_start_source(server.fileno, buffer, length, bpm, headless, @slot))
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
@socket = peer
|
|
72
|
+
ensure
|
|
73
|
+
server.close # The host duplicated this end on success.
|
|
74
|
+
peer.close unless @socket
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Return false on timeout. The caller retains the host and can retry.
|
|
79
|
+
def shutdown(timeout_ms: 5000)
|
|
80
|
+
unless timeout_ms.is_a?(Integer) && (0..0xffff_ffff).cover?(timeout_ms)
|
|
81
|
+
raise ArgumentError, "timeout_ms must be an unsigned 32-bit Integer"
|
|
82
|
+
end
|
|
83
|
+
raise Error, "cannot join a host started before fork" if Process.pid != @pid
|
|
84
|
+
|
|
85
|
+
@lock.synchronize do
|
|
86
|
+
status = Native.host_shutdown(@slot, timeout_ms)
|
|
87
|
+
return false if status == Native::TIMEOUT
|
|
88
|
+
|
|
89
|
+
@socket.close if @slot.read_pointer.null? && !@socket.closed?
|
|
90
|
+
Native.check(status)
|
|
91
|
+
true
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def closed?
|
|
96
|
+
@lock.synchronize { @slot.read_pointer.null? }
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ffi"
|
|
4
|
+
|
|
5
|
+
module WaveGraph
|
|
6
|
+
module Native
|
|
7
|
+
extend FFI::Library
|
|
8
|
+
|
|
9
|
+
bundled = File.join(__dir__, "native", FFI.map_library_name("wavegraph"))
|
|
10
|
+
library = ENV.fetch("WAVEGRAPH_LIBRARY") { File.file?(bundled) ? bundled : "wavegraph" }
|
|
11
|
+
begin
|
|
12
|
+
ffi_lib library
|
|
13
|
+
rescue LoadError => error
|
|
14
|
+
raise LoadError, "Could not load #{library.inspect}. Install the matching WaveGraph platform gem " \
|
|
15
|
+
"or set WAVEGRAPH_LIBRARY to the host shared library.\n#{error.message}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attach_function :last_error, :wavegraph_last_error, [], :string
|
|
19
|
+
attach_function :compile, :wavegraph_compile, [:pointer, :size_t, :pointer], :int32, blocking: true
|
|
20
|
+
attach_function :patch_free, :wavegraph_patch_free, [:pointer], :void
|
|
21
|
+
attach_function :host_start, :wavegraph_host_start,
|
|
22
|
+
[:int, :pointer, :uint16, :bool, :pointer], :int32, blocking: true
|
|
23
|
+
attach_function :host_start_source, :wavegraph_host_start_source,
|
|
24
|
+
[:int, :pointer, :size_t, :uint16, :bool, :pointer], :int32, blocking: true
|
|
25
|
+
attach_function :host_shutdown, :wavegraph_host_shutdown, [:pointer, :uint32], :int32, blocking: true
|
|
26
|
+
|
|
27
|
+
TIMEOUT = 3
|
|
28
|
+
|
|
29
|
+
def self.check(status)
|
|
30
|
+
return if status.zero?
|
|
31
|
+
|
|
32
|
+
error = case status
|
|
33
|
+
when 1 then ArgumentError
|
|
34
|
+
when 2 then InvalidPatch
|
|
35
|
+
else Error
|
|
36
|
+
end
|
|
37
|
+
raise error, last_error.force_encoding(Encoding::UTF_8)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.with_source(source)
|
|
41
|
+
raise TypeError, "source must be a String of .wg bytes" unless source.is_a?(String)
|
|
42
|
+
|
|
43
|
+
# The native call releases the GVL. Keep a private, stable copy even when
|
|
44
|
+
# another Ruby thread mutates the caller's string.
|
|
45
|
+
buffer = FFI::MemoryPointer.from_string(source)
|
|
46
|
+
yield buffer, buffer.size - 1 # omit the trailing NUL
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private_constant :Native
|
|
51
|
+
end
|