mercury-engine 1.1.0 → 1.2.1
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.
- package/README.md +30 -0
- package/dist/mercury.js +32 -2
- package/dist/mercury.min.es5.js +1 -1
- package/dist/mercury.min.js +1 -1
- package/examples/hydra/index.html +83 -0
- package/examples/interface/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,6 +180,36 @@ Stop the recording and download the file `myRecording.webm`
|
|
|
180
180
|
Engine.record(false, 'myRecording');
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
### Meter
|
|
184
|
+
|
|
185
|
+
You can add a meter to the main audio output and poll for the amplitude value from the meter to for example create audio-reactive visuals in other programming languages such as Hydra or P5.js.
|
|
186
|
+
|
|
187
|
+
First add the meter, optionally with a smoothing factor (default=0.7)
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
Engine.addMeter();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Get the meter value as floating-point between 0-1
|
|
194
|
+
|
|
195
|
+
```js
|
|
196
|
+
Engine.getMeter();
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Store the meters amplitude value in a global variable for usage in other places and update regularly with a setInterval at a defined interval in milliseconds.
|
|
200
|
+
|
|
201
|
+
```js
|
|
202
|
+
let amp;
|
|
203
|
+
|
|
204
|
+
setInterval(() => amp = Engine.getMeter(), 100);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
For example control some visual parameter in [Hydra](https://hydra.ojack.xyz)
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
osc(10, 0.2, () => amp * 20).out();
|
|
211
|
+
```
|
|
212
|
+
|
|
183
213
|
### MIDI
|
|
184
214
|
|
|
185
215
|
WebMIDI is included and started if the browser is compatible with it. If not, an error will be printed to the console. You can provide a callback function `onmidi` to execute some code when the WebMIDI enabling was succesful.
|
package/dist/mercury.js
CHANGED
|
@@ -17000,6 +17000,11 @@ function atodb(a=0){
|
|
|
17000
17000
|
return 20 * Math.log(a);
|
|
17001
17001
|
}
|
|
17002
17002
|
|
|
17003
|
+
// convert dbFS to amplitude
|
|
17004
|
+
function dbtoa(db=0){
|
|
17005
|
+
return 10 ** (db/20);
|
|
17006
|
+
}
|
|
17007
|
+
|
|
17003
17008
|
// clip a value between a specified range
|
|
17004
17009
|
function clip(v, l, h){
|
|
17005
17010
|
return Math.max(l, Math.min(h, v));
|
|
@@ -17198,7 +17203,7 @@ function log(msg){
|
|
|
17198
17203
|
}
|
|
17199
17204
|
}
|
|
17200
17205
|
|
|
17201
|
-
module.exports = { mapDefaults, atodb, clip, assureNum, lookup, randLookup, isRandom, getParam, toArray, msToS, formatRatio, divToS, divToF, toMidi, mtof, noteToMidi, noteToFreq, assureWave, log }
|
|
17206
|
+
module.exports = { mapDefaults, atodb, dbtoa, clip, assureNum, lookup, randLookup, isRandom, getParam, toArray, msToS, formatRatio, divToS, divToF, toMidi, mtof, noteToMidi, noteToFreq, assureWave, log }
|
|
17202
17207
|
},{"total-serialism":47}],67:[function(require,module,exports){
|
|
17203
17208
|
module.exports={
|
|
17204
17209
|
"uptempo" : 10,
|
|
@@ -17573,7 +17578,7 @@ class Mercury extends MercuryInterpreter {
|
|
|
17573
17578
|
super({ hydra, p5canvas });
|
|
17574
17579
|
|
|
17575
17580
|
// store sample files in buffers
|
|
17576
|
-
this.samples = JSON.parse("{\n \"_base\": \"https://raw.githubusercontent.com/tmhglnd/mercury-playground/main/public/assets/samples/\",\n \"noise_a\": \"noise/noise_a.wav\",\n \"drone_cymbal\": \"ambient/cymbal/drone_cymbal.wav\",\n \"drone_cymbal_01\": \"ambient/cymbal/drone_cymbal_01.wav\",\n \"clap_808\": \"drums/clap/clap_808.wav\",\n \"clap_808_short\": \"drums/clap/clap_808_short.wav\",\n \"clap_909\": \"drums/clap/clap_909.wav\",\n \"clap_min\": \"drums/clap/clap_min.wav\",\n \"hat_808\": \"drums/hat/hat_808.wav\",\n \"hat_808_open\": \"drums/hat/hat_808_open.wav\",\n \"hat_808_semi\": \"drums/hat/hat_808_semi.wav\",\n \"hat_909\": \"drums/hat/hat_909.wav\",\n \"hat_909_open\": \"drums/hat/hat_909_open.wav\",\n \"hat_909_open_short\": \"drums/hat/hat_909_open_short.wav\",\n \"hat_909_short\": \"drums/hat/hat_909_short.wav\",\n \"hat_click\": \"drums/hat/hat_click.wav\",\n \"hat_dub\": \"drums/hat/hat_dub.wav\",\n \"hat_min\": \"drums/hat/hat_min.wav\",\n \"hat_min_open\": \"drums/hat/hat_min_open.wav\",\n \"kick_808\": \"drums/kick/kick_808.wav\",\n \"kick_808_dist\": \"drums/kick/kick_808_dist.wav\",\n \"kick_909\": \"drums/kick/kick_909.wav\",\n \"kick_909_dist\": \"drums/kick/kick_909_dist.wav\",\n \"kick_909_dist_long\": \"drums/kick/kick_909_dist_long.wav\",\n \"kick_909_long\": \"drums/kick/kick_909_long.wav\",\n \"kick_deep\": \"drums/kick/kick_deep.wav\",\n \"kick_dub\": \"drums/kick/kick_dub.wav\",\n \"kick_house\": \"drums/kick/kick_house.wav\",\n \"kick_min\": \"drums/kick/kick_min.wav\",\n \"kick_sub\": \"drums/kick/kick_sub.wav\",\n \"kick_ua\": \"drums/kick/kick_ua.wav\",\n \"kick_vintage\": \"drums/kick/kick_vintage.wav\",\n \"block\": \"drums/perc/block.wav\",\n \"block_lo\": \"drums/perc/block_lo.wav\",\n \"bongo\": \"drums/perc/bongo.wav\",\n \"bongo_lo\": \"drums/perc/bongo_lo.wav\",\n \"clave_808\": \"drums/perc/clave_808.wav\",\n \"cowbell_808\": \"drums/perc/cowbell_808.wav\",\n \"cymbal_808\": \"drums/perc/cymbal_808.wav\",\n \"maracas_808\": \"drums/perc/maracas_808.wav\",\n \"snare_808\": \"drums/snare/snare_808.wav\",\n \"snare_909\": \"drums/snare/snare_909.wav\",\n \"snare_909_short\": \"drums/snare/snare_909_short.wav\",\n \"snare_ac\": \"drums/snare/snare_ac.wav\",\n \"snare_dnb\": \"drums/snare/snare_dnb.wav\",\n \"snare_dub\": \"drums/snare/snare_dub.wav\",\n \"snare_fat\": \"drums/snare/snare_fat.wav\",\n \"snare_hvy\": \"drums/snare/snare_hvy.wav\",\n \"snare_min\": \"drums/snare/snare_min.wav\",\n \"snare_rock\": \"drums/snare/snare_rock.wav\",\n \"snare_step\": \"drums/snare/snare_step.wav\",\n \"tabla_01\": \"drums/tabla/tabla_01.wav\",\n \"tabla_02\": \"drums/tabla/tabla_02.wav\",\n \"tabla_03\": \"drums/tabla/tabla_03.wav\",\n \"tabla_hi\": \"drums/tabla/tabla_hi.wav\",\n \"tabla_hi_long\": \"drums/tabla/tabla_hi_long.wav\",\n \"tabla_hi_short\": \"drums/tabla/tabla_hi_short.wav\",\n \"tabla_lo\": \"drums/tabla/tabla_lo.wav\",\n \"tabla_lo_long\": \"drums/tabla/tabla_lo_long.wav\",\n \"tabla_lo_short\": \"drums/tabla/tabla_lo_short.wav\",\n \"tabla_mid\": \"drums/tabla/tabla_mid.wav\",\n \"tabla_mid_long\": \"drums/tabla/tabla_mid_long.wav\",\n \"tabla_mid_short\": \"drums/tabla/tabla_mid_short.wav\",\n \"tom_808\": \"drums/tom/tom_808.wav\",\n \"tom_hi\": \"drums/tom/tom_hi.wav\",\n \"tom_lo\": \"drums/tom/tom_lo.wav\",\n \"tom_mid\": \"drums/tom/tom_mid.wav\",\n \"tongue\": \"foley/body/tongue.wav\",\n \"tongue_lo\": \"foley/body/tongue_lo.wav\",\n \"shatter\": \"foley/glass/shatter.wav\",\n \"metal\": \"foley/metal/metal.wav\",\n \"metal_lo\": \"foley/metal/metal_lo.wav\",\n \"wobble\": \"foley/plastic/wobble.wav\",\n \"wobble_02\": \"foley/plastic/wobble_02.wav\",\n \"door\": \"foley/wood/door.wav\",\n \"scrape\": \"foley/wood/scrape.wav\",\n \"scrape_01\": \"foley/wood/scrape_01.wav\",\n \"wood_hit\": \"foley/wood/wood_hit.wav\",\n \"wood_metal\": \"foley/wood/wood_metal.wav\",\n \"wood_plate\": \"foley/wood/wood_plate.wav\",\n \"bell\": \"idiophone/bell/bell.wav\",\n \"chimes\": \"idiophone/chimes/chimes.wav\",\n \"chimes_chord\": \"idiophone/chimes/chimes_chord.wav\",\n \"chimes_chord_01\": \"idiophone/chimes/chimes_chord_01.wav\",\n \"chimes_chord_02\": \"idiophone/chimes/chimes_chord_02.wav\",\n \"chimes_hi\": \"idiophone/chimes/chimes_hi.wav\",\n \"gong_hi\": \"idiophone/gong/gong_hi.wav\",\n \"gong_lo\": \"idiophone/gong/gong_lo.wav\",\n \"kalimba_a\": \"idiophone/kalimba/kalimba_a.wav\",\n \"kalimba_ab\": \"idiophone/kalimba/kalimba_ab.wav\",\n \"kalimba_cis\": \"idiophone/kalimba/kalimba_cis.wav\",\n \"kalimba_e\": \"idiophone/kalimba/kalimba_e.wav\",\n \"kalimba_g\": \"idiophone/kalimba/kalimba_g.wav\",\n \"bamboo_a\": \"idiophone/marimba-bamboo/bamboo_a.wav\",\n \"bamboo_c\": \"idiophone/marimba-bamboo/bamboo_c.wav\",\n \"bamboo_f\": \"idiophone/marimba-bamboo/bamboo_f.wav\",\n \"bamboo_g\": \"idiophone/marimba-bamboo/bamboo_g.wav\",\n \"bowl_hi\": \"idiophone/singing-bowl/bowl_hi.wav\",\n \"bowl_lo\": \"idiophone/singing-bowl/bowl_lo.wav\",\n \"bowl_mid\": \"idiophone/singing-bowl/bowl_mid.wav\",\n \"rhodes_8bit\": \"keys/pad/rhodes_8bit.wav\",\n \"piano_a\": \"keys/piano/piano_a.wav\",\n \"piano_b\": \"keys/piano/piano_b.wav\",\n \"piano_c\": \"keys/piano/piano_c.wav\",\n \"piano_d\": \"keys/piano/piano_d.wav\",\n \"piano_e\": \"keys/piano/piano_e.wav\",\n \"piano_f\": \"keys/piano/piano_f.wav\",\n \"piano_g\": \"keys/piano/piano_g.wav\",\n \"amen\": \"loops/breaks/amen.wav\",\n \"amen_alt\": \"loops/breaks/amen_alt.wav\",\n \"amen_break\": \"loops/breaks/amen_break.wav\",\n \"amen_fill\": \"loops/breaks/amen_fill.wav\",\n \"house\": \"loops/breaks/house.wav\",\n \"chimes_l\": \"loops/chimes/chimes_l.wav\",\n \"noise_c\": \"loops/noise/noise_c.wav\",\n \"noise_e\": \"loops/noise/noise_e.wav\",\n \"noise_e_01\": \"loops/noise/noise_e_01.wav\",\n \"noise_mw\": \"loops/noise/noise_mw.wav\",\n \"noise_p\": \"loops/noise/noise_p.wav\",\n \"noise_r\": \"loops/noise/noise_r.wav\",\n \"choir_01\": \"vocal/choir/choir_01.wav\",\n \"choir_02\": \"vocal/choir/choir_02.wav\",\n \"choir_03\": \"vocal/choir/choir_03.wav\",\n \"choir_o\": \"vocal/choir/choir_o.wav\",\n \"wiper\": \"loops/foley/car/wiper.wav\",\n \"wiper_out\": \"loops/foley/car/wiper_out.wav\",\n \"wood_l\": \"loops/foley/wood/wood_l.wav\",\n \"wood_l_01\": \"loops/foley/wood/wood_l_01.wav\",\n \"violin_a\": \"string/bowed/violin/violin_a.wav\",\n \"violin_b\": \"string/bowed/violin/violin_b.wav\",\n \"violin_c\": \"string/bowed/violin/violin_c.wav\",\n \"violin_d\": \"string/bowed/violin/violin_d.wav\",\n \"violin_e\": \"string/bowed/violin/violin_e.wav\",\n \"violin_f\": \"string/bowed/violin/violin_f.wav\",\n \"violin_g\": \"string/bowed/violin/violin_g.wav\",\n \"harp_down\": \"string/plucked/harp/harp_down.wav\",\n \"harp_up\": \"string/plucked/harp/harp_up.wav\",\n \"pluck_a\": \"string/plucked/violin/pluck_a.wav\",\n \"pluck_b\": \"string/plucked/violin/pluck_b.wav\",\n \"pluck_c\": \"string/plucked/violin/pluck_c.wav\",\n \"pluck_d\": \"string/plucked/violin/pluck_d.wav\",\n \"pluck_e\": \"string/plucked/violin/pluck_e.wav\",\n \"pluck_f\": \"string/plucked/violin/pluck_f.wav\",\n \"pluck_g\": \"string/plucked/violin/pluck_g.wav\"\n}\n");
|
|
17581
|
+
this.samples = JSON.parse("{\n \"_base\": \"https://raw.githubusercontent.com/tmhglnd/mercury-playground/main/public/assets/samples/\",\n \"noise_a\": \"noise/noise_a.wav\",\n \"drone_cymbal\": \"ambient/cymbal/drone_cymbal.wav\",\n \"drone_cymbal_01\": \"ambient/cymbal/drone_cymbal_01.wav\",\n \"clap_808\": \"drums/clap/clap_808.wav\",\n \"clap_808_short\": \"drums/clap/clap_808_short.wav\",\n \"clap_909\": \"drums/clap/clap_909.wav\",\n \"clap_min\": \"drums/clap/clap_min.wav\",\n \"clap_nord\": \"drums/clap/clap_nord.wav\",\n \"hat_808\": \"drums/hat/hat_808.wav\",\n \"hat_808_half\": \"drums/hat/hat_808_half.wav\",\n \"hat_808_open\": \"drums/hat/hat_808_open.wav\",\n \"hat_909\": \"drums/hat/hat_909.wav\",\n \"hat_909_half\": \"drums/hat/hat_909_half.wav\",\n \"hat_909_open\": \"drums/hat/hat_909_open.wav\",\n \"hat_909_short\": \"drums/hat/hat_909_short.wav\",\n \"hat_click\": \"drums/hat/hat_click.wav\",\n \"hat_dub\": \"drums/hat/hat_dub.wav\",\n \"hat_min\": \"drums/hat/hat_min.wav\",\n \"hat_min_open\": \"drums/hat/hat_min_open.wav\",\n \"hat_nord\": \"drums/hat/hat_nord.wav\",\n \"hat_nord_open\": \"drums/hat/hat_nord_open.wav\",\n \"kick_808\": \"drums/kick/kick_808.wav\",\n \"kick_808_dist\": \"drums/kick/kick_808_dist.wav\",\n \"kick_909\": \"drums/kick/kick_909.wav\",\n \"kick_909_dist\": \"drums/kick/kick_909_dist.wav\",\n \"kick_909_dist_long\": \"drums/kick/kick_909_dist_long.wav\",\n \"kick_909_long\": \"drums/kick/kick_909_long.wav\",\n \"kick_deep\": \"drums/kick/kick_deep.wav\",\n \"kick_dub\": \"drums/kick/kick_dub.wav\",\n \"kick_house\": \"drums/kick/kick_house.wav\",\n \"kick_min\": \"drums/kick/kick_min.wav\",\n \"kick_nord\": \"drums/kick/kick_nord.wav\",\n \"kick_nord_long\": \"drums/kick/kick_nord_long.wav\",\n \"kick_sub\": \"drums/kick/kick_sub.wav\",\n \"kick_ua\": \"drums/kick/kick_ua.wav\",\n \"kick_vintage\": \"drums/kick/kick_vintage.wav\",\n \"block\": \"drums/perc/block.wav\",\n \"block_lo\": \"drums/perc/block_lo.wav\",\n \"bongo\": \"drums/perc/bongo.wav\",\n \"bongo_lo\": \"drums/perc/bongo_lo.wav\",\n \"clave_808\": \"drums/perc/clave_808.wav\",\n \"cowbell_808\": \"drums/perc/cowbell_808.wav\",\n \"cymbal_808\": \"drums/perc/cymbal_808.wav\",\n \"maracas_808\": \"drums/perc/maracas_808.wav\",\n \"wood_nord_hi\": \"drums/perc/wood_nord_hi.wav\",\n \"wood_nord_lo\": \"drums/perc/wood_nord_lo.wav\",\n \"wood_nord_mid\": \"drums/perc/wood_nord_mid.wav\",\n \"snare_808\": \"drums/snare/snare_808.wav\",\n \"snare_909\": \"drums/snare/snare_909.wav\",\n \"snare_909_short\": \"drums/snare/snare_909_short.wav\",\n \"snare_ac\": \"drums/snare/snare_ac.wav\",\n \"snare_dnb\": \"drums/snare/snare_dnb.wav\",\n \"snare_dub\": \"drums/snare/snare_dub.wav\",\n \"snare_fat\": \"drums/snare/snare_fat.wav\",\n \"snare_hvy\": \"drums/snare/snare_hvy.wav\",\n \"snare_min\": \"drums/snare/snare_min.wav\",\n \"snare_nord\": \"drums/snare/snare_nord.wav\",\n \"snare_nord_hi\": \"drums/snare/snare_nord_hi.wav\",\n \"snare_rock\": \"drums/snare/snare_rock.wav\",\n \"snare_step\": \"drums/snare/snare_step.wav\",\n \"tabla_01\": \"drums/tabla/tabla_01.wav\",\n \"tabla_02\": \"drums/tabla/tabla_02.wav\",\n \"tabla_03\": \"drums/tabla/tabla_03.wav\",\n \"tabla_hi\": \"drums/tabla/tabla_hi.wav\",\n \"tabla_hi_long\": \"drums/tabla/tabla_hi_long.wav\",\n \"tabla_hi_short\": \"drums/tabla/tabla_hi_short.wav\",\n \"tabla_lo\": \"drums/tabla/tabla_lo.wav\",\n \"tabla_lo_long\": \"drums/tabla/tabla_lo_long.wav\",\n \"tabla_lo_short\": \"drums/tabla/tabla_lo_short.wav\",\n \"tabla_mid\": \"drums/tabla/tabla_mid.wav\",\n \"tabla_mid_long\": \"drums/tabla/tabla_mid_long.wav\",\n \"tabla_mid_short\": \"drums/tabla/tabla_mid_short.wav\",\n \"tom_808\": \"drums/tom/tom_808.wav\",\n \"tom_hi\": \"drums/tom/tom_hi.wav\",\n \"tom_lo\": \"drums/tom/tom_lo.wav\",\n \"tom_mid\": \"drums/tom/tom_mid.wav\",\n \"tom_nord_hi\": \"drums/tom/tom_nord_hi.wav\",\n \"tom_nord_lo\": \"drums/tom/tom_nord_lo.wav\",\n \"tongue\": \"foley/body/tongue.wav\",\n \"tongue_lo\": \"foley/body/tongue_lo.wav\",\n \"shatter\": \"foley/glass/shatter.wav\",\n \"metal\": \"foley/metal/metal.wav\",\n \"metal_lo\": \"foley/metal/metal_lo.wav\",\n \"wobble\": \"foley/plastic/wobble.wav\",\n \"wobble_02\": \"foley/plastic/wobble_02.wav\",\n \"door\": \"foley/wood/door.wav\",\n \"scrape\": \"foley/wood/scrape.wav\",\n \"scrape_01\": \"foley/wood/scrape_01.wav\",\n \"wood_hit\": \"foley/wood/wood_hit.wav\",\n \"wood_metal\": \"foley/wood/wood_metal.wav\",\n \"wood_plate\": \"foley/wood/wood_plate.wav\",\n \"bell\": \"idiophone/bell/bell.wav\",\n \"chimes\": \"idiophone/chimes/chimes.wav\",\n \"chimes_chord\": \"idiophone/chimes/chimes_chord.wav\",\n \"chimes_chord_01\": \"idiophone/chimes/chimes_chord_01.wav\",\n \"chimes_chord_02\": \"idiophone/chimes/chimes_chord_02.wav\",\n \"chimes_hi\": \"idiophone/chimes/chimes_hi.wav\",\n \"glock_c5\": \"idiophone/glockenspiel/glock_c5.wav\",\n \"glock_c6\": \"idiophone/glockenspiel/glock_c6.wav\",\n \"glock_g4\": \"idiophone/glockenspiel/glock_g4.wav\",\n \"glock_g5\": \"idiophone/glockenspiel/glock_g5.wav\",\n \"gong_hi\": \"idiophone/gong/gong_hi.wav\",\n \"gong_lo\": \"idiophone/gong/gong_lo.wav\",\n \"kalimba_a\": \"idiophone/kalimba/kalimba_a.wav\",\n \"kalimba_ab\": \"idiophone/kalimba/kalimba_ab.wav\",\n \"kalimba_cis\": \"idiophone/kalimba/kalimba_cis.wav\",\n \"kalimba_e\": \"idiophone/kalimba/kalimba_e.wav\",\n \"kalimba_g\": \"idiophone/kalimba/kalimba_g.wav\",\n \"marimba_b2\": \"idiophone/marimba/marimba_b2.wav\",\n \"marimba_c2\": \"idiophone/marimba/marimba_c2.wav\",\n \"marimba_c4\": \"idiophone/marimba/marimba_c4.wav\",\n \"marimba_f3\": \"idiophone/marimba/marimba_f3.wav\",\n \"marimba_g2\": \"idiophone/marimba/marimba_g2.wav\",\n \"marimba_g4\": \"idiophone/marimba/marimba_g4.wav\",\n \"bamboo_a\": \"idiophone/marimba-bamboo/bamboo_a.wav\",\n \"bamboo_c\": \"idiophone/marimba-bamboo/bamboo_c.wav\",\n \"bamboo_f\": \"idiophone/marimba-bamboo/bamboo_f.wav\",\n \"bamboo_g\": \"idiophone/marimba-bamboo/bamboo_g.wav\",\n \"box_a4\": \"idiophone/musicbox/box_a4.wav\",\n \"box_b4\": \"idiophone/musicbox/box_b4.wav\",\n \"box_b5\": \"idiophone/musicbox/box_b5.wav\",\n \"box_c5\": \"idiophone/musicbox/box_c5.wav\",\n \"box_d5\": \"idiophone/musicbox/box_d5.wav\",\n \"box_d6\": \"idiophone/musicbox/box_d6.wav\",\n \"box_g3\": \"idiophone/musicbox/box_g3.wav\",\n \"box_g5\": \"idiophone/musicbox/box_g5.wav\",\n \"bowl_hi\": \"idiophone/singing-bowl/bowl_hi.wav\",\n \"bowl_lo\": \"idiophone/singing-bowl/bowl_lo.wav\",\n \"bowl_mid\": \"idiophone/singing-bowl/bowl_mid.wav\",\n \"xylo_c4\": \"idiophone/xylophone/xylo_c4.wav\",\n \"xylo_c5\": \"idiophone/xylophone/xylo_c5.wav\",\n \"xylo_c6\": \"idiophone/xylophone/xylo_c6.wav\",\n \"xylo_g3\": \"idiophone/xylophone/xylo_g3.wav\",\n \"xylo_g4\": \"idiophone/xylophone/xylo_g4.wav\",\n \"xylo_g5\": \"idiophone/xylophone/xylo_g5.wav\",\n \"rhodes_8bit\": \"keys/pad/rhodes_8bit.wav\",\n \"piano_a\": \"keys/piano/piano_a.wav\",\n \"piano_b\": \"keys/piano/piano_b.wav\",\n \"piano_c\": \"keys/piano/piano_c.wav\",\n \"piano_d\": \"keys/piano/piano_d.wav\",\n \"piano_e\": \"keys/piano/piano_e.wav\",\n \"piano_f\": \"keys/piano/piano_f.wav\",\n \"piano_g\": \"keys/piano/piano_g.wav\",\n \"amen\": \"loops/breaks/amen.wav\",\n \"amen_alt\": \"loops/breaks/amen_alt.wav\",\n \"amen_break\": \"loops/breaks/amen_break.wav\",\n \"amen_fill\": \"loops/breaks/amen_fill.wav\",\n \"house\": \"loops/breaks/house.wav\",\n \"chimes_l\": \"loops/chimes/chimes_l.wav\",\n \"noise_c\": \"loops/noise/noise_c.wav\",\n \"noise_e\": \"loops/noise/noise_e.wav\",\n \"noise_e_01\": \"loops/noise/noise_e_01.wav\",\n \"noise_mw\": \"loops/noise/noise_mw.wav\",\n \"noise_p\": \"loops/noise/noise_p.wav\",\n \"noise_r\": \"loops/noise/noise_r.wav\",\n \"choir_01\": \"vocal/choir/choir_01.wav\",\n \"choir_02\": \"vocal/choir/choir_02.wav\",\n \"choir_03\": \"vocal/choir/choir_03.wav\",\n \"choir_o\": \"vocal/choir/choir_o.wav\",\n \"bell_c4\": \"woodwinds-flutes/bell/bell_c4.wav\",\n \"bell_c5\": \"woodwinds-flutes/bell/bell_c5.wav\",\n \"bell_f5\": \"woodwinds-flutes/bell/bell_f5.wav\",\n \"bell_g4\": \"woodwinds-flutes/bell/bell_g4.wav\",\n \"clarinet_a2\": \"woodwinds-flutes/clarinet/clarinet_a2.wav\",\n \"clarinet_a3\": \"woodwinds-flutes/clarinet/clarinet_a3.wav\",\n \"clarinet_d2\": \"woodwinds-flutes/clarinet/clarinet_d2.wav\",\n \"clarinet_d3\": \"woodwinds-flutes/clarinet/clarinet_d3.wav\",\n \"clarinet_f2\": \"woodwinds-flutes/clarinet/clarinet_f2.wav\",\n \"clarinet_f3\": \"woodwinds-flutes/clarinet/clarinet_f3.wav\",\n \"flute_a3\": \"woodwinds-flutes/flute/flute_a3.wav\",\n \"flute_a4\": \"woodwinds-flutes/flute/flute_a4.wav\",\n \"flute_c3\": \"woodwinds-flutes/flute/flute_c3.wav\",\n \"flute_c4\": \"woodwinds-flutes/flute/flute_c4.wav\",\n \"flute_c5\": \"woodwinds-flutes/flute/flute_c5.wav\",\n \"flute_e3\": \"woodwinds-flutes/flute/flute_e3.wav\",\n \"flute_e4\": \"woodwinds-flutes/flute/flute_e4.wav\",\n \"oboe_a2\": \"woodwinds-flutes/oboe/oboe_a2.wav\",\n \"oboe_a3\": \"woodwinds-flutes/oboe/oboe_a3.wav\",\n \"oboe_d3\": \"woodwinds-flutes/oboe/oboe_d3.wav\",\n \"oboe_d4\": \"woodwinds-flutes/oboe/oboe_d4.wav\",\n \"oboe_f3\": \"woodwinds-flutes/oboe/oboe_f3.wav\",\n \"oboe_f4\": \"woodwinds-flutes/oboe/oboe_f4.wav\",\n \"wiper\": \"loops/foley/car/wiper.wav\",\n \"wiper_out\": \"loops/foley/car/wiper_out.wav\",\n \"wood_l\": \"loops/foley/wood/wood_l.wav\",\n \"wood_l_01\": \"loops/foley/wood/wood_l_01.wav\",\n \"violin_a\": \"string/bowed/violin/violin_a.wav\",\n \"violin_b\": \"string/bowed/violin/violin_b.wav\",\n \"violin_c\": \"string/bowed/violin/violin_c.wav\",\n \"violin_d\": \"string/bowed/violin/violin_d.wav\",\n \"violin_e\": \"string/bowed/violin/violin_e.wav\",\n \"violin_f\": \"string/bowed/violin/violin_f.wav\",\n \"violin_g\": \"string/bowed/violin/violin_g.wav\",\n \"harp_a2\": \"string/plucked/harp/harp_a2.wav\",\n \"harp_a4\": \"string/plucked/harp/harp_a4.wav\",\n \"harp_b3\": \"string/plucked/harp/harp_b3.wav\",\n \"harp_b5\": \"string/plucked/harp/harp_b5.wav\",\n \"harp_c3\": \"string/plucked/harp/harp_c3.wav\",\n \"harp_c5\": \"string/plucked/harp/harp_c5.wav\",\n \"harp_d4\": \"string/plucked/harp/harp_d4.wav\",\n \"harp_down\": \"string/plucked/harp/harp_down.wav\",\n \"harp_e3\": \"string/plucked/harp/harp_e3.wav\",\n \"harp_e5\": \"string/plucked/harp/harp_e5.wav\",\n \"harp_f4\": \"string/plucked/harp/harp_f4.wav\",\n \"harp_g3\": \"string/plucked/harp/harp_g3.wav\",\n \"harp_g5\": \"string/plucked/harp/harp_g5.wav\",\n \"harp_up\": \"string/plucked/harp/harp_up.wav\",\n \"pluck_a\": \"string/plucked/violin/pluck_a.wav\",\n \"pluck_b\": \"string/plucked/violin/pluck_b.wav\",\n \"pluck_c\": \"string/plucked/violin/pluck_c.wav\",\n \"pluck_d\": \"string/plucked/violin/pluck_d.wav\",\n \"pluck_e\": \"string/plucked/violin/pluck_e.wav\",\n \"pluck_f\": \"string/plucked/violin/pluck_f.wav\",\n \"pluck_g\": \"string/plucked/violin/pluck_g.wav\"\n}\n");
|
|
17577
17582
|
|
|
17578
17583
|
// this.buffers = new Tone.ToneAudioBuffers();
|
|
17579
17584
|
// add the buffers via function
|
|
@@ -17591,6 +17596,9 @@ class Mercury extends MercuryInterpreter {
|
|
|
17591
17596
|
this.highPassF = new Tone.Filter(5, 'highpass');
|
|
17592
17597
|
Tone.Destination.chain(this.lowPassF, this.highPassF, this.gain);
|
|
17593
17598
|
|
|
17599
|
+
// an RMS meter for reactive visuals
|
|
17600
|
+
this.meter;
|
|
17601
|
+
|
|
17594
17602
|
// a recorder for the sound
|
|
17595
17603
|
this.recorder = new Tone.Recorder({ mimeType: 'audio/webm' });
|
|
17596
17604
|
this.gain.connect(this.recorder);
|
|
@@ -17870,6 +17878,28 @@ class Mercury extends MercuryInterpreter {
|
|
|
17870
17878
|
isRecording(){
|
|
17871
17879
|
return this.recorder.state;
|
|
17872
17880
|
}
|
|
17881
|
+
|
|
17882
|
+
// add a Tone RMS meter to use for signal analysis
|
|
17883
|
+
addMeter(smooth=0.7){
|
|
17884
|
+
this.meter = new Tone.Meter(smooth);
|
|
17885
|
+
this.meter.normalRange = true;
|
|
17886
|
+
this.gain.connect(this.meter);
|
|
17887
|
+
}
|
|
17888
|
+
|
|
17889
|
+
// return the meter value as float betwee 0-1
|
|
17890
|
+
getMeter(){
|
|
17891
|
+
return this.meter.getValue();
|
|
17892
|
+
}
|
|
17893
|
+
|
|
17894
|
+
// get the webaudio context Mercury is producing sound on
|
|
17895
|
+
// getContext(){
|
|
17896
|
+
// return Tone.getContext();
|
|
17897
|
+
// }
|
|
17898
|
+
|
|
17899
|
+
// get the destination output Mercury is sending sound to
|
|
17900
|
+
// getDestination(){
|
|
17901
|
+
// return Tone.getDestination();
|
|
17902
|
+
// }
|
|
17873
17903
|
}
|
|
17874
17904
|
module.exports = { Mercury };
|
|
17875
17905
|
},{"./core/Util.js":66,"./interpreter":68,"tone":44,"webmidi":55}]},{},[69])(69)
|