beeps 0.3.12 → 0.3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a848993e9610dd9598a6685f4ef669083aea313d68b533fb6d222b723348cd9
4
- data.tar.gz: ea8610eb20594ac731580377a1d7966fac499afb36074973149d2449deaab14e
3
+ metadata.gz: be0112d74491238712ca27ab7da557b8dbffac3075e2ac1eb13efa7ca91b4f18
4
+ data.tar.gz: 935312ec040f4dc78ab97135d8ff5035ee5f8712a5e1019bb720aead83e7bb90
5
5
  SHA512:
6
- metadata.gz: 7942136dd8a5cedc43842ff907211d73e38864b80b7aa4a79287d95d2e9bc5531d551afd8a08acf6ca294c9f73e66feb37c2a02be996d8484e9347e94c663b6f
7
- data.tar.gz: 6ea818cccb69bbc0967700687dc23ef699802d5c915770be1153fc175a9150f0ae5a0bd845831c17ae86c8239c42915bd596718f1a5ca1b98662ea73f09b88d7
6
+ metadata.gz: c83043583de20a32cd345f29cf01c3e56cebbbfc6dc960d9a2032e1b2d179c8fcf5013f67f0a775807e5084b00c8e7d8674f464da2e8383ce4bf5e46e8d9c804
7
+ data.tar.gz: aabb022c116a6c942b2b4c253e0caed24ed7f62320190b768dfd76d331da2acb6d28fb2f4ddd939db577b4bfce625af968baadba095de66a2a1fd2ba9667cc58
@@ -36,23 +36,9 @@ jobs:
36
36
  echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
37
37
 
38
38
  - name: create github release
39
- id: release
40
- uses: actions/create-release@v1
41
39
  env:
42
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43
- with:
44
- tag_name: ${{ github.ref }}
45
- release_name: ${{ github.ref }}
46
-
47
- - name: upload to github release
48
- uses: actions/upload-release-asset@v1
49
- env:
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
- with:
52
- upload_url: ${{ steps.release.outputs.upload_url }}
53
- asset_path: ./${{ steps.gem.outputs.path }}
54
- asset_name: ${{ steps.gem.outputs.path }}
55
- asset_content_type: application/zip
40
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ run: ruby -I.github/workflows -rutils -e 'release(*ARGV)' ./${{ steps.gem.outputs.path }}
56
42
 
57
43
  - name: upload to rubygems
58
44
  env:
data/ChangeLog.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # beeps ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.13] - 2026-05-17
5
+
6
+ - Rewrite README.md
7
+ - CI: Migrate release-gem.yml from actions/create-release to gh release create
8
+
9
+
4
10
  ## [v0.3.12] - 2026-05-10
5
11
 
6
12
  - Support WebAssembly
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Beeps - Plays beep sound
1
+ # Beeps - Audio synthesis and playback library
2
2
 
3
3
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/xord/beeps)
4
4
  ![License](https://img.shields.io/github/license/xord/beeps)
@@ -21,18 +21,37 @@ Thanks for your support! 🙌
21
21
 
22
22
  ## 🚀 About
23
23
 
24
- **Beeps** is a simple utility that plays a beep sound.
24
+ **Beeps** is an audio library for Ruby. You build a processor graph oscillators, file / mic input, filters, envelopes, effects — by wiring nodes together with the `>>` operator, then render the result to a `Sound` and play it back.
25
25
 
26
- It is designed to be lightweight and easy to use, making it perfect for adding audible notifications to your scripts or applications.
26
+ It is part of the `xord/*` family and underlies the audio support in [Reflex](https://github.com/xord/reflex), [Processing](https://github.com/xord/processing), [RubySketch](https://github.com/xord/rubysketch), and [Reight](https://github.com/xord/reight). Like the rest of the family, it is primarily developed for our own use, but it works as a standalone audio synthesis gem.
27
+
28
+ ## 📋 Requirements
29
+
30
+ - Ruby **3.0.0** or later
31
+ - A C++ compiler with C++20 support
32
+ - [Xot](https://rubygems.org/gems/xot) and [Rucy](https://rubygems.org/gems/rucy) (declared as runtime dependencies)
33
+ - Platform audio backend:
34
+ - **macOS** — OpenAL and AVFoundation (bundled with the OS)
35
+ - **Windows** — OpenAL (`MINGW_PACKAGE_PREFIX-openal`) and Media Foundation
36
+ - **Linux** — `libopenal-dev`
37
+
38
+ The following third-party DSP libraries are cloned from GitHub and statically linked while the native extension is being built, so you do not need to install them separately:
39
+
40
+ | Library | Role |
41
+ | ----------------------------------------------------------------------------- | ----------------------------------- |
42
+ | [STK](https://github.com/thestk/stk) | Core synthesis primitives |
43
+ | [AudioFile](https://github.com/adamstark/AudioFile) | WAV / AIFF file I/O |
44
+ | [r8brain-free-src](https://github.com/avaneev/r8brain-free-src) | High-quality sample-rate conversion |
45
+ | [signalsmith-stretch](https://github.com/Signalsmith-Audio/signalsmith-stretch) | Time stretching and pitch shifting |
27
46
 
28
47
  ## 📦 Installation
29
48
 
30
49
  Add this line to your Gemfile:
31
50
  ```ruby
32
- $ gem 'beeps'
51
+ gem 'beeps'
33
52
  ```
34
53
 
35
- Then, install gem:
54
+ Then install:
36
55
  ```bash
37
56
  $ bundle install
38
57
  ```
@@ -42,7 +61,131 @@ Or install it directly:
42
61
  $ gem install beeps
43
62
  ```
44
63
 
64
+ `require 'beeps'` automatically calls `Beeps.init!` and registers `Beeps.fin!` at exit. Set `$BEEPS_NOAUTOINIT = true` before requiring if you want to manage the lifetime yourself.
65
+
66
+ ## 📚 What's Included
67
+
68
+ ### Generators (signal sources)
69
+
70
+ | Class | Purpose |
71
+ | -------------------- | ------------------------------------------------------------------------ |
72
+ | `Beeps::Oscillator` | Sine / triangle / square / sawtooth / noise / sample-playback oscillator |
73
+ | `Beeps::Value` | Constant or linearly-interpolated control value over time |
74
+ | `Beeps::Sequencer` | Schedule processors at given offsets and durations |
75
+ | `Beeps::FileIn` | Stream audio from a WAV / AIFF / other supported file |
76
+ | `Beeps::MicIn` | Capture audio from a microphone |
77
+ | `Beeps::TextIn` | Synthesize speech from text |
78
+
79
+ ### Filters (processors that take an input)
80
+
81
+ | Class | Purpose |
82
+ | -------------------- | ----------------------------------------------------------------------- |
83
+ | `Beeps::Gain` | Multiply the signal by a gain coefficient |
84
+ | `Beeps::Mixer` | Sum multiple inputs |
85
+ | `Beeps::Envelope` | Attack / Decay / Sustain / Release envelope with `note_on` / `note_off` |
86
+ | `Beeps::LowPass` | Low-pass filter with cutoff frequency |
87
+ | `Beeps::HighPass` | High-pass filter with cutoff frequency |
88
+ | `Beeps::Reverb` | Reverb with `mix`, `room_size`, `damping` controls |
89
+ | `Beeps::TimeStretch` | Change duration without affecting pitch |
90
+ | `Beeps::PitchShift` | Change pitch without affecting duration |
91
+ | `Beeps::Analyser` | FFT analyser — exposes time-domain and spectrum readings |
92
+
93
+ ### Playback
94
+
95
+ | Class | Purpose |
96
+ | -------------------- | --------------------------------------------------------------------------- |
97
+ | `Beeps::Sound` | A finite, renderable audio asset (created from a processor or `load_sound`) |
98
+ | `Beeps::SoundPlayer` | Returned by `Sound#play`; supports `pause`, `stop`, `position`, `loop`, ... |
99
+
100
+ ## 💡 Usage
101
+
102
+ ### Play a 440 Hz sine tone for one second
103
+
104
+ ```ruby
105
+ require 'beeps'
106
+
107
+ osc = Beeps::Oscillator.new(:sine, frequency: 440)
108
+ sound = Beeps::Sound.new(osc, 1)
109
+ player = sound.play
110
+
111
+ sleep 1 # keep the script alive while the sound plays
112
+ ```
113
+
114
+ ### Build a processor chain with `>>`
115
+
116
+ ```ruby
117
+ require 'beeps'
118
+
119
+ # oscillator -> half-volume -> low-pass at 800 Hz -> reverb
120
+ chain =
121
+ Beeps::Oscillator.new(:sawtooth, frequency: 220) >>
122
+ Beeps::Gain.new(0.5) >>
123
+ Beeps::LowPass.new(cutoff: 800) >>
124
+ Beeps::Reverb.new(mix: 0.3, room_size: 0.7)
125
+
126
+ Beeps::Sound.new(chain, 2).play
127
+ sleep 2
128
+ ```
129
+
130
+ `a >> b` calls `b.add_input(a)` and returns `b`, so the right-most node is the head of the chain you pass to `Sound.new`.
131
+
132
+ ### ADSR envelope
133
+
134
+ ```ruby
135
+ require 'beeps'
136
+
137
+ osc = Beeps::Oscillator.new(:sine, frequency: 440)
138
+ env = Beeps::Envelope.new(0.05, 0.1, 0.7, 0.3, input: osc)
139
+ env.note_on
140
+ env.note_off 0.5 # release after 0.5 s
141
+
142
+ Beeps::Sound.new(env, 1).play
143
+ sleep 1
144
+ ```
145
+
146
+ ### Play and save a wave file
147
+
148
+ ```ruby
149
+ require 'beeps'
150
+
151
+ # play an existing file
152
+ player = Beeps.load_sound('drum.wav').play
153
+
154
+ # render a chain and save it to disk
155
+ sound = Beeps::Sound.new(Beeps::Oscillator.new(:square, frequency: 880), 0.5)
156
+ sound.save 'square.wav'
157
+ ```
158
+
159
+ ### Capture from the microphone and analyse
160
+
161
+ ```ruby
162
+ require 'beeps'
163
+
164
+ mic = Beeps::MicIn.new(1) # 1 channel
165
+ analyser = Beeps::Analyser.new(1024, mic) # 1024-point FFT
166
+ mic.start
167
+
168
+ loop do
169
+ sleep 0.1
170
+ puts analyser.spectrum.first(8).map {|v| v.round 3 }.inspect
171
+ end
172
+ ```
173
+
174
+ ## 🛠️ Development
175
+
176
+ ```bash
177
+ $ rake lib # build the native C++ library (libbeeps)
178
+ $ rake ext # build the Ruby C extension
179
+ $ rake test # run the test suite
180
+ $ rake doc # generate RDoc from C++ sources
181
+ $ rake # default: builds the extension
182
+ ```
183
+
184
+ In the [`xord/all`](https://github.com/xord/all) monorepo you can scope by module, e.g. `rake beeps test`.
185
+
45
186
  ## 📜 License
46
187
 
47
188
  **Beeps** is licensed under the MIT License.
48
189
  See the [LICENSE](./LICENSE) file for details.
190
+
191
+ The third-party DSP libraries listed above retain their own licenses.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.12
1
+ 0.3.13
data/beeps.gemspec CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.platform = Gem::Platform::RUBY
26
26
  s.required_ruby_version = '>= 3.0.0'
27
27
 
28
- s.add_dependency 'xot', '~> 0.3.12'
29
- s.add_dependency 'rucy', '~> 0.3.12'
28
+ s.add_dependency 'xot', '~> 0.3.13'
29
+ s.add_dependency 'rucy', '~> 0.3.13'
30
30
 
31
31
  s.files = `git ls-files`.split $/
32
32
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beeps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-09 00:00:00.000000000 Z
11
+ date: 2026-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.12
19
+ version: 0.3.13
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.12
26
+ version: 0.3.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rucy
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.12
33
+ version: 0.3.13
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.12
40
+ version: 0.3.13
41
41
  description: Synthesize and play beep sounds.
42
42
  email: xordog@gmail.com
43
43
  executables: []