lively 0.14.1 → 0.15.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/lively/version.rb +1 -1
- data/public/_components/@socketry/live-audio/Live/Audio/Library.js +24 -9
- data/public/_components/@socketry/live-audio/package.json +1 -1
- data/public/_components/@socketry/live-audio/readme.md +32 -5
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b53e8a7bba336aef8ef7170bdf1aac5870b036ad7e4069c92d2b391c7413664d
|
4
|
+
data.tar.gz: 2ca053c24f1f25540b53e44fec743b7445cb139abb8d8f4f44d302fefb0a5bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8655863e04c5eb0d4d7a0306eed6d81a679f51d73304d4d81888f3ac0c56c99ffb20b6ed281ea4b35ed5557c89055f1098697bb6570f317c2d8561babebe5925
|
7
|
+
data.tar.gz: 0425a8509065b052bae71e87bd546b229a570555461845713ab663394a115884c6d8f7610966e3213ece45d9a6c74914be206b576adb13828574263e1663f8d2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/lively/version.rb
CHANGED
@@ -723,26 +723,41 @@ export class SampleSound extends Sound {
|
|
723
723
|
|
724
724
|
// Background Music class extending SampleSound with looping functionality
|
725
725
|
export class BackgroundMusicSound extends SampleSound {
|
726
|
-
constructor(url,
|
727
|
-
|
728
|
-
|
729
|
-
|
726
|
+
constructor(url, options = {}) {
|
727
|
+
const { volume = 0.8, loop = true, loopStart, loopEnd } = options;
|
728
|
+
super(url, volume);
|
729
|
+
|
730
|
+
// Store loop configuration
|
731
|
+
this.options = {
|
732
|
+
loop,
|
733
|
+
loopStart,
|
734
|
+
loopEnd
|
735
|
+
};
|
730
736
|
}
|
731
737
|
|
732
738
|
// Override to configure looping with specific loop points
|
733
739
|
configurePlayback(source) {
|
734
|
-
|
735
|
-
|
736
|
-
|
740
|
+
const { loop, loopStart, loopEnd } = this.options;
|
741
|
+
|
742
|
+
// Only set loop properties if they are explicitly provided:
|
743
|
+
if (loop !== undefined) {
|
744
|
+
source.loop = loop;
|
745
|
+
}
|
746
|
+
|
747
|
+
if (loopStart !== undefined) {
|
748
|
+
source.loopStart = loopStart;
|
749
|
+
}
|
750
|
+
|
751
|
+
if (loopEnd !== undefined) {
|
752
|
+
source.loopEnd = loopEnd;
|
753
|
+
}
|
737
754
|
}
|
738
755
|
|
739
756
|
async start(output) {
|
740
757
|
if (this.isPlaying) {
|
741
|
-
console.log('Background music is already playing');
|
742
758
|
return;
|
743
759
|
}
|
744
760
|
|
745
761
|
await super.start(output);
|
746
|
-
console.log('Background music started with loop points:', this.loopStart, 'to', this.loopEnd);
|
747
762
|
}
|
748
763
|
}
|
@@ -7,7 +7,7 @@ A Web Audio API-based game audio synthesis and background music library for Ruby
|
|
7
7
|
## Features
|
8
8
|
|
9
9
|
- **Synthesized Sound Effects**: Classic game sounds including jump, coin, power-up, death, explosion, laser, and animal sounds.
|
10
|
-
- **Background Music**:
|
10
|
+
- **Background Music**: Audio file playback with loop points and volume control.
|
11
11
|
- **Audio Visualization**: Real-time waveform display with quality monitoring.
|
12
12
|
- **Anti-Clipping Protection**: Built-in gain management to prevent audio distortion.
|
13
13
|
- **Modular Architecture**: Clean separation between sound synthesis, output routing, and visualization.
|
@@ -33,7 +33,10 @@ window.liveAudio = Audio.start();
|
|
33
33
|
// Add sounds using the controller
|
34
34
|
const meow = new MeowSound();
|
35
35
|
const explosion = new ExplosionSound();
|
36
|
-
const music = new BackgroundMusicSound('/assets/music.mp3',
|
36
|
+
const music = new BackgroundMusicSound('/assets/music.mp3', {
|
37
|
+
loopStart: 10.0,
|
38
|
+
loopEnd: 45.0
|
39
|
+
});
|
37
40
|
|
38
41
|
window.liveAudio.addSound('meow', meow);
|
39
42
|
window.liveAudio.addSound('explosion', explosion);
|
@@ -147,7 +150,12 @@ The library includes a comprehensive collection of pre-built sound classes in `L
|
|
147
150
|
- `AlienSound` - Alien sound with ring modulation
|
148
151
|
|
149
152
|
### Background Music
|
150
|
-
- `BackgroundMusicSound(url,
|
153
|
+
- `BackgroundMusicSound(url, options)` - Audio file background music with optional loop configuration
|
154
|
+
- Supports common web audio formats: MP3, WAV, OGG, AAC, FLAC, and others supported by the browser
|
155
|
+
- `options.loop` - Enable/disable looping (default: true)
|
156
|
+
- `options.loopStart` - Loop start time in seconds
|
157
|
+
- `options.loopEnd` - Loop end time in seconds
|
158
|
+
- `options.volume` - Playback volume (default: 0.8)
|
151
159
|
|
152
160
|
### Usage Example
|
153
161
|
|
@@ -160,11 +168,30 @@ const controller = Audio.start();
|
|
160
168
|
// Add sounds from the library
|
161
169
|
const meow = new MeowSound();
|
162
170
|
const explosion = new ExplosionSound();
|
163
|
-
|
171
|
+
|
172
|
+
// Background music examples:
|
173
|
+
// Default: loops entire track at 80% volume
|
174
|
+
const music1 = new BackgroundMusicSound('/assets/background.mp3');
|
175
|
+
|
176
|
+
// Custom loop points
|
177
|
+
const music2 = new BackgroundMusicSound('/assets/background.mp3', {
|
178
|
+
loopStart: 10.5,
|
179
|
+
loopEnd: 45.2
|
180
|
+
});
|
181
|
+
|
182
|
+
// No looping
|
183
|
+
const music3 = new BackgroundMusicSound('/assets/background.mp3', { loop: false });
|
184
|
+
|
185
|
+
// Custom volume
|
186
|
+
const music4 = new BackgroundMusicSound('/assets/background.mp3', {
|
187
|
+
volume: 0.6,
|
188
|
+
loopStart: 5.0,
|
189
|
+
loopEnd: 30.0
|
190
|
+
});
|
164
191
|
|
165
192
|
controller.addSound('meow', meow);
|
166
193
|
controller.addSound('explosion', explosion);
|
167
|
-
controller.addSound('music',
|
194
|
+
controller.addSound('music', music1);
|
168
195
|
|
169
196
|
// Play them
|
170
197
|
controller.playSound('meow');
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|