mercury-engine 1.0.0 → 1.0.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.
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>Mercury Engine Example</title>
6
+
7
+ <script src="https://unpkg.com/mercury-engine@1.0.0/dist/mercury.min.es5.js
8
+ "></script>
9
+ </head>
10
+
11
+ <body>
12
+ <button id="b1">start</button>
13
+ <button id="b2">silence</button>
14
+
15
+ <script>
16
+ // This script loads the Mercury Engine and allows to insert code
17
+ // from a textarea in the html page
18
+
19
+ // Include the package from unpkg.com
20
+ const { Mercury } = MercuryEngine;
21
+
22
+ // Initialize a Mercury engine with callback function when loaded
23
+ const Engine = new Mercury( () => {
24
+ console.log('The engine and sounds are loaded!');
25
+ });
26
+
27
+ // Some mercury code initially created
28
+ const simpleCode = `
29
+ set tempo 110
30
+ set randomSeed 4831
31
+ set scale dorian d
32
+
33
+ list progression chordsFromNumerals([I7 IIIm7 IV7 V7])
34
+ new polySynth saw name(chrd)
35
+ set chrd note(progression 1) time(2/1) shape(1 2/1) fx(triggerFilter low 1/1 1/1 4000 100) super(0.132 3)
36
+
37
+ list melody add(repeat(flat(progression) 2) [0 12])
38
+ new polySynth saw name(lead)
39
+ set lead note(melody 2) time(1/8) shape(1 2/1) super(0.112 3) gain(0.6) fx(triggerFilter low 1 1/6 5000 100)
40
+
41
+ set all fx(squash 1) fx(reverb 0.4 7)
42
+
43
+ list drums choose(17 [hat_808 kick_808 snare_808])
44
+ new sample drums time(1/8) gain(0.7) fx(degrade 0.7) fx(delay 3/16 5/16 0.9) timediv([1 1 1 2])
45
+ `
46
+
47
+ // evaluate the code on the click of a button
48
+ let b1 = document.getElementById('b1');
49
+ b1.onclick = () => Engine.code({ file: simpleCode });
50
+
51
+ // stop the code on the click of a button
52
+ let b2 = document.getElementById('b2');
53
+ b2.onclick = () => Engine.silence();
54
+
55
+ </script>
56
+ </body>
57
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mercury-engine",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "The mercury engine generates web audio output from mercury code input",
5
5
  "main": "./dist/mercury.js",
6
6
  "scripts": {
@@ -43,6 +43,7 @@
43
43
  "@babel/preset-env": "^7.23.3",
44
44
  "brfs": "^2.0.2",
45
45
  "browserify": "^17.0.0",
46
+ "minify-inline-json": "^1.1.11",
46
47
  "terser": "^5.24.0",
47
48
  "uglifyjs": "^2.4.11",
48
49
  "watchify": "^4.0.0"