scribbletune 4.0.2 → 5.0.0-alpha.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.
- package/.editorconfig +14 -0
- package/.eslintignore +2 -1
- package/.eslintrc +53 -5
- package/.vscode/extensions.json +17 -0
- package/.vscode/launch.json +64 -0
- package/.vscode/settings.json +44 -0
- package/.vscode/tasks.json +78 -0
- package/README.md +1 -1
- package/browser.js +2 -1
- package/browser.js.map +1 -0
- package/dist/scribbletune.js +1 -1
- package/dist/scribbletune.js.map +1 -1
- package/examples/scale.js +1 -1
- package/index.d.ts +18 -58
- package/index.js +2 -1
- package/index.js.map +1 -0
- package/jest.config.js +7 -2
- package/max.js +2 -1
- package/max.js.map +1 -0
- package/package.json +45 -28
- package/src/arp.ts +43 -22
- package/src/browser-clip.ts +43 -205
- package/src/browser-index.ts +7 -3
- package/src/channel.ts +567 -35
- package/src/clip.ts +61 -50
- package/src/index.ts +7 -3
- package/src/max.ts +2 -2
- package/src/midi.ts +1 -1
- package/src/progression.ts +8 -6
- package/src/session.ts +46 -10
- package/src/typings.d.ts +109 -29
- package/src/utils.ts +121 -6
- package/tests/clip.spec.ts +132 -8
- package/tests/midi.spec.ts +1 -1
- package/tests/utils.spec.ts +2 -1
- package/tsconfig.json +1 -1
- package/webpack.config.js +53 -27
- package/dist/download.html +0 -26
- package/dist/index.html +0 -21
- package/dist/index_offline.html +0 -22
- package/dist/index_play_pattern.html +0 -22
- package/dist/index_test.html +0 -56
- package/dist/script.js +0 -82
- package/dist/script_offline.js +0 -37
- package/dist/script_play_pattern.js +0 -59
- package/dist/script_test.js +0 -479
- package/dist/session.html +0 -27
- package/dist/session.js +0 -89
- package/prettier.config.js +0 -5
- package/tslint.json +0 -28
package/.editorconfig
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Editor configuration, see http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
indent_size = 2
|
|
8
|
+
indent_style = space
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
max_line_length = off
|
|
14
|
+
trim_trailing_whitespace = false
|
package/.eslintignore
CHANGED
package/.eslintrc
CHANGED
|
@@ -1,20 +1,68 @@
|
|
|
1
1
|
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": [
|
|
5
|
+
"@typescript-eslint",
|
|
6
|
+
"prettier"
|
|
7
|
+
],
|
|
8
|
+
"extends": [
|
|
9
|
+
"eslint:recommended",
|
|
10
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
11
|
+
"plugin:@typescript-eslint/recommended",
|
|
12
|
+
"prettier",
|
|
13
|
+
"plugin:prettier/recommended"
|
|
14
|
+
],
|
|
2
15
|
"rules": {
|
|
16
|
+
"prettier/prettier": [
|
|
17
|
+
"error",
|
|
18
|
+
{
|
|
19
|
+
"trailingComma": "es5",
|
|
20
|
+
"singleQuote": true,
|
|
21
|
+
"printWidth": 80,
|
|
22
|
+
"arrowParens": "avoid",
|
|
23
|
+
"htmlWhitespaceSensitivity": "strict",
|
|
24
|
+
"bracketSpacing": true,
|
|
25
|
+
"proseWrap": "always",
|
|
26
|
+
"semi": true,
|
|
27
|
+
"tabWidth": 2,
|
|
28
|
+
"useTabs": false
|
|
29
|
+
}
|
|
30
|
+
],
|
|
3
31
|
"eqeqeq": 2,
|
|
4
32
|
"eol-last": 0,
|
|
5
33
|
"no-nested-ternary": 1,
|
|
6
|
-
"padded-blocks": [
|
|
7
|
-
|
|
34
|
+
"padded-blocks": [
|
|
35
|
+
1,
|
|
36
|
+
"never"
|
|
37
|
+
],
|
|
38
|
+
"space-before-blocks": [
|
|
39
|
+
1,
|
|
40
|
+
"always"
|
|
41
|
+
],
|
|
8
42
|
"spaced-comment": 2,
|
|
9
|
-
"space-infix-ops": 2
|
|
43
|
+
"space-infix-ops": 2,
|
|
44
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
10
45
|
},
|
|
11
46
|
"env": {
|
|
12
47
|
"es6": true
|
|
13
48
|
},
|
|
14
49
|
"parserOptions": {
|
|
15
50
|
"ecmaVersion": 6,
|
|
51
|
+
"sourceType": "module",
|
|
16
52
|
"ecmaFeatures": {
|
|
17
53
|
"experimentalObjectRestSpread": true
|
|
18
54
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
55
|
+
},
|
|
56
|
+
"overrides": [
|
|
57
|
+
{
|
|
58
|
+
"files": [
|
|
59
|
+
"jest.config.js",
|
|
60
|
+
"webpack.config.js",
|
|
61
|
+
"prettier.config.js"
|
|
62
|
+
],
|
|
63
|
+
"parserOptions": {
|
|
64
|
+
"sourceType": "script"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"christian-kohler.npm-intellisense",
|
|
4
|
+
"christian-kohler.path-intellisense",
|
|
5
|
+
"coenraads.bracket-pair-colorizer-2",
|
|
6
|
+
"dbaeumer.vscode-eslint",
|
|
7
|
+
"donjayamanne.githistory",
|
|
8
|
+
"eamodio.gitlens",
|
|
9
|
+
"editorconfig.editorconfig",
|
|
10
|
+
"eg2.vscode-npm-script",
|
|
11
|
+
"esbenp.prettier-vscode",
|
|
12
|
+
"gruntfuggly.todo-tree",
|
|
13
|
+
"orta.vscode-jest",
|
|
14
|
+
"pflannery.vscode-versionlens",
|
|
15
|
+
"wix.vscode-import-cost"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
"name": "vscode-jest-tests",
|
|
10
|
+
"type": "node",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
13
|
+
"windows": {
|
|
14
|
+
"name": "vscode-jest-tests",
|
|
15
|
+
"type": "node",
|
|
16
|
+
"request": "launch",
|
|
17
|
+
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
|
|
18
|
+
},
|
|
19
|
+
"args": [
|
|
20
|
+
"--runInBand",
|
|
21
|
+
"--watchAll=false"
|
|
22
|
+
],
|
|
23
|
+
"cwd": "${workspaceFolder}",
|
|
24
|
+
"console": "integratedTerminal",
|
|
25
|
+
"internalConsoleOptions": "neverOpen",
|
|
26
|
+
"disableOptimisticBPs": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "npm-jest-tests",
|
|
30
|
+
"type": "node",
|
|
31
|
+
"request": "launch",
|
|
32
|
+
"runtimeExecutable": "npm",
|
|
33
|
+
"runtimeArgs": [
|
|
34
|
+
"run",
|
|
35
|
+
"test"
|
|
36
|
+
],
|
|
37
|
+
"skipFiles": [
|
|
38
|
+
"<node_internals>/**"
|
|
39
|
+
],
|
|
40
|
+
"cwd": "${workspaceFolder}",
|
|
41
|
+
"console": "integratedTerminal",
|
|
42
|
+
"internalConsoleOptions": "neverOpen",
|
|
43
|
+
"disableOptimisticBPs": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "npm-build-browser",
|
|
47
|
+
"type": "node",
|
|
48
|
+
"request": "launch",
|
|
49
|
+
"runtimeExecutable": "npm",
|
|
50
|
+
"runtimeArgs": [
|
|
51
|
+
"run",
|
|
52
|
+
"build:browser"
|
|
53
|
+
],
|
|
54
|
+
"skipFiles": [
|
|
55
|
+
"<node_internals>/**"
|
|
56
|
+
],
|
|
57
|
+
"cwd": "${workspaceFolder}",
|
|
58
|
+
"console": "integratedTerminal",
|
|
59
|
+
"internalConsoleOptions": "neverOpen",
|
|
60
|
+
"disableOptimisticBPs": true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[javascript]": {
|
|
3
|
+
"editor.defaultFormatter": "vscode.typescript-language-features",
|
|
4
|
+
"editor.formatOnPaste": true,
|
|
5
|
+
"editor.formatOnSave": true
|
|
6
|
+
},
|
|
7
|
+
"[json]": {
|
|
8
|
+
"editor.formatOnPaste": true,
|
|
9
|
+
"editor.formatOnSave": true
|
|
10
|
+
},
|
|
11
|
+
"[typescript]": {
|
|
12
|
+
"editor.defaultFormatter": "vscode.typescript-language-features",
|
|
13
|
+
"editor.formatOnPaste": true,
|
|
14
|
+
"editor.formatOnSave": true
|
|
15
|
+
},
|
|
16
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
17
|
+
"editor.formatOnPaste": false,
|
|
18
|
+
"editor.formatOnSave": false,
|
|
19
|
+
"editor.codeActionsOnSave": {
|
|
20
|
+
"source.fixAll.eslint": true
|
|
21
|
+
},
|
|
22
|
+
"editor.bracketPairColorization.enabled": true,
|
|
23
|
+
"eslint.alwaysShowStatus": true,
|
|
24
|
+
"eslint.workingDirectories": [
|
|
25
|
+
"."
|
|
26
|
+
],
|
|
27
|
+
"eslint.lintTask.enable": true,
|
|
28
|
+
"eslint.lintTask.options": "-c .eslintrc --ignore-path .eslintignore src tests",
|
|
29
|
+
"eslint.validate": [
|
|
30
|
+
"javascript",
|
|
31
|
+
"typescript"
|
|
32
|
+
],
|
|
33
|
+
"eslint.options": {
|
|
34
|
+
"extensions": [
|
|
35
|
+
".js",
|
|
36
|
+
".ts"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"prettier.singleQuote": true,
|
|
40
|
+
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
|
|
41
|
+
"typescript.referencesCodeLens.enabled": true,
|
|
42
|
+
"typescript.implementationsCodeLens.enabled": true,
|
|
43
|
+
"jest.jestCommandLine": "npm test --"
|
|
44
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"type": "npm",
|
|
6
|
+
"script": "build",
|
|
7
|
+
"group": "build",
|
|
8
|
+
"problemMatcher": [],
|
|
9
|
+
"label": "npm:build",
|
|
10
|
+
"detail": "build all targets"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "npm",
|
|
14
|
+
"script": "watch:browser",
|
|
15
|
+
"group": "build",
|
|
16
|
+
"problemMatcher": [],
|
|
17
|
+
"label": "npm: watch:browser",
|
|
18
|
+
"detail": "continuous development for browser"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "npm",
|
|
22
|
+
"script": "lint",
|
|
23
|
+
"problemMatcher": {
|
|
24
|
+
"owner": "eslint",
|
|
25
|
+
"fileLocation": "absolute",
|
|
26
|
+
"pattern": [
|
|
27
|
+
{
|
|
28
|
+
"regexp": "^([^\\s].*)$",
|
|
29
|
+
"file": 1
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
|
|
33
|
+
"line": 1,
|
|
34
|
+
"column": 2,
|
|
35
|
+
"severity": 3,
|
|
36
|
+
"message": 4,
|
|
37
|
+
"code": 5,
|
|
38
|
+
"loop": true
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"label": "npm: lint",
|
|
43
|
+
"detail": "lint check"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "npm",
|
|
47
|
+
"script": "lint:fix",
|
|
48
|
+
"problemMatcher": [
|
|
49
|
+
"$eslint-stylish"
|
|
50
|
+
],
|
|
51
|
+
"label": "npm: lint:fix",
|
|
52
|
+
"detail": "lint fix"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "npm",
|
|
56
|
+
"script": "test:watch",
|
|
57
|
+
"group": "build",
|
|
58
|
+
"problemMatcher": [],
|
|
59
|
+
"label": "npm: test:watch",
|
|
60
|
+
"detail": "test watch"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "npm",
|
|
64
|
+
"script": "test",
|
|
65
|
+
"group": "test",
|
|
66
|
+
"problemMatcher": [],
|
|
67
|
+
"label": "npm: test",
|
|
68
|
+
"detail": "test coverage"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "npm",
|
|
72
|
+
"script": "clean",
|
|
73
|
+
"problemMatcher": [],
|
|
74
|
+
"label": "npm: clean",
|
|
75
|
+
"detail": "clean"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](http://travis-ci.com/scribbletune/scribbletune)
|
|
4
4
|
[](https://npm.runkit.com/scribbletune)
|
|
5
5
|
|
|
6
|
-
Use simple **JavaScript** `Strings` and `Arrays` to generate rhythms and musical patterns. Directly use the names of scales or chords in your code to get arrays which you can mash up using Array methods in ways you hadn't imagined before! Create clips of musical ideas and **export MIDI files** which you can import in _Ableton Live, Reason,
|
|
6
|
+
Use simple **JavaScript** `Strings` and `Arrays` to generate rhythms and musical patterns. Directly use the names of scales or chords in your code to get arrays which you can mash up using Array methods in ways you hadn't imagined before! Create clips of musical ideas and **export MIDI files** which you can import in _Ableton Live, Reason, GarageBand_ or any music creation software that accepts MIDI files.
|
|
7
7
|
|
|
8
8
|
### Install
|
|
9
9
|
|
package/browser.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
!function(e,t){for(var n in t)e[n]=t[n]}(exports,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){(()=>{"use strict";var e={413:e=>{e.exports=JSON.parse('{"5th":"100000010000","M7#5sus4":"100001001001","7#5sus4":"100001001010","sus4":"100001010000","M7sus4":"100001010001","7sus4":"100001010010","7no5":"100010000010","aug":"100010001000","M7b6":"100010001001","maj7#5":"100010001001","7#5":"100010001010","7b13":"100010001010","M":"100010010000","maj7":"100010010001","7th":"100010010010","6th":"100010010100","7add6":"100010010110","7b6":"100010011010","Mb5":"100010100000","M7b5":"100010100001","7b5":"100010100010","maj#4":"100010110001","7#11":"100010110010","M6#11":"100010110100","7#11b13":"100010111010","m#5":"100100001000","mb6M7":"100100001001","m7#5":"100100001010","m":"100100010000","m/ma7":"100100010001","m7":"100100010010","m6":"100100010100","mMaj7b6":"100100011001","dim":"100100100000","oM7":"100100100001","m7b5":"100100100010","dim7":"100100100100","o7M7":"100100100101","4th":"100101000010","madd4":"100101010000","m7add11":"100101010010","+add#9":"100110001000","7#5#9":"100110001010","7#9":"100110010010","13#9":"100110010110","7#9b13":"100110011010","maj7#9#11":"100110110001","7#9#11":"100110110010","13#9#11":"100110110110","7#9#11b13":"100110111010","sus2":"101000010000","M9#5sus4":"101001001001","sus24":"101001010000","M9sus4":"101001010001","11th":"101001010010","9sus4":"101001010010","13sus4":"101001010110","9no5":"101010000010","13no5":"101010000110","M#5add9":"101010001000","maj9#5":"101010001001","9#5":"101010001010","9b13":"101010001010","Madd9":"101010010000","maj9":"101010010001","9th":"101010010010","6/9":"101010010100","maj13":"101010010101","M7add13":"101010010101","13th":"101010010110","M9b5":"101010100001","9b5":"101010100010","13b5":"101010100110","9#5#11":"101010101010","maj9#11":"101010110001","9#11":"101010110010","69#11":"101010110100","M13#11":"101010110101","13#11":"101010110110","9#11b13":"101010111010","m9#5":"101100001010","madd9":"101100010000","mM9":"101100010001","m9":"101100010010","m69":"101100010100","m13":"101100010110","mMaj9b6":"101100011001","m9b5":"101100100010","m11A":"101101001010","m11":"101101010010","b9sus":"110001010010","11b9":"110001010010","7sus4b9b13":"110001011010","alt7":"110010000010","7#5b9":"110010001010","Maddb9":"110010010000","M7b9":"110010010001","7b9":"110010010010","13b9":"110010010110","7b9b13":"110010011010","7#5b9#11":"110010101010","7b9#11":"110010110010","13b9#11":"110010110110","7b9b13#11":"110010111010","mb6b9":"110100001000","7b9#9":"110110010010"}')},722:e=>{e.exports=JSON.parse('{"major pentatonic":"101010010100","ionian pentatonic":"100011010001","mixolydian pentatonic":"100011010010","ritusen":"101001010100","egyptian":"101001010010","neopolitan major pentatonic":"100011100010","vietnamese 1":"100101011000","pelog":"110100011000","kumoijoshi":"110001011000","hirajoshi":"101100011000","iwato":"110001100010","in-sen":"110001010010","lydian pentatonic":"100010110001","malkos raga":"100101001010","locrian pentatonic":"100101100010","minor pentatonic":"100101010010","minor six pentatonic":"100101010100","flat three pentatonic":"101100010100","flat six pentatonic":"101010011000","scriabin":"110010010100","whole tone pentatonic":"100010101010","lydian #5P pentatonic":"100010101001","lydian dominant pentatonic":"100010110010","minor #7M pentatonic":"100101010001","super locrian pentatonic":"100110100010","minor hexatonic":"101101010001","augmented":"100110011001","major blues":"101110010100","piongio":"101001010110","prometheus neopolitan":"110010100110","prometheus":"101010100110","mystery #1":"110010101010","six tone symmetric":"110011001100","whole tone":"101010101010","messiaen\'s mode #5":"110001110001","minor blues":"100101110010","locrian major":"101011101010","double harmonic lydian":"110010111001","harmonic minor":"101101011001","altered":"110110101010","locrian #2":"101101101010","mixolydian b6":"101011011010","lydian dominant":"101010110110","lydian":"101010110101","lydian augmented":"101010101101","dorian b2":"110101010110","melodic minor":"101101010101","locrian":"110101101010","ultralocrian":"110110101100","locrian 6":"110101100110","augmented heptatonic":"100111011001","romanian minor":"101100110110","dorian #4":"101100110110","lydian diminished":"101100110101","phrygian":"110101011010","leading whole tone":"101010101011","lydian minor":"101010111010","phrygian dominant":"110011011010","balinese":"110101011001","neopolitan major":"110101010101","aeolian":"101101011010","harmonic major":"101011011001","double harmonic major":"110011011001","dorian":"101101010110","hungarian minor":"101100111001","hungarian major":"100110110110","oriental":"110011100110","flamenco":"110110110010","todi raga":"110100111001","mixolydian":"101011010110","persian":"110011101001","major":"101011010101","enigmatic":"110010101011","major augmented":"101011001101","lydian #9":"100110110101","messiaen\'s mode #4":"111001111001","purvi raga":"110011111001","spanish heptatonic":"110111011010","bebop":"101011010111","bebop minor":"101111010110","bebop major":"101011011101","bebop locrian":"110101111010","minor bebop":"101101011011","diminished":"101101101101","ichikosucho":"101011110101","minor six diminished":"101101011101","half-whole diminished":"110110110110","kafi raga":"100111010111","messiaen\'s mode #6":"101011101011","composite blues":"101111110110","messiaen\'s mode #3":"101110111011","messiaen\'s mode #7":"111101111101","chromatic":"111111111111","ionian":"101011010101","minor":"101101011010"}')}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{r.r(i),r.d(i,{chord:()=>u,chords:()=>a,inlineChord:()=>o,scale:()=>c,scales:()=>s});var e=r(722),t=r(413),n=function(n){var r=n.scale,i=n.chord,o=r||i,a=r?"scale":"chord";if("string"!=typeof o)throw"".concat(o," is not a valid input for ").concat(a);var s=o.indexOf(" "),u=o.slice(s+1),c=o.slice(0,s),l=c.replace(/\d/g,""),p=+c.replace(/\D/g,"");if(isNaN(p))throw"".concat(c[0]," does not have a valid octave");if(!e[u]&&!t[u])throw"".concat(o," is not a valid ").concat(a);for(var f=function(e,t){var n=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"].map((function(e){return e+t})),r=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"].map((function(e){return e+(t+1)})),i=n.concat(r);return i.slice(i.indexOf(e+t))}(l,p),h=[],d=0,m=0,y=r?e:t;d<y[u].length;)"1"===y[u][d]&&h.push(f[m]),d++,m++;return h},o=function(e){var t,r,i="b9sus",o=4;return e.includes(i)?(r=i,t=e.slice(0,e.indexOf(i))):(t=e[0],r=e.slice(1),"b"!==e[1]&&"#"!==e[1]||(t+=e[1],r=e.slice(2))),e.includes("_")&&(o=+e.split("_")[1],r=r.slice(0,r.indexOf("_"))),n({chord:t+o+" "+r})},a=function(){return Object.keys(t)},s=function(){return Object.keys(e)},u=function(e){return n({chord:e})},c=function(e){return n({scale:e})}})();var o=t;for(var a in i)o[a]=i[a];i.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flat=t.dice=t.pickOne=t.sizzleMap=t.shuffle=t.expandStr=t.isNote=void 0,t.isNote=function(e){return/^[a-gA-G](?:#|b)?\d$/.test(e)},t.expandStr=function(e){return e=(e=(e=(e=JSON.stringify(e.split(""))).replace(/,"\[",/g,", [")).replace(/"\[",/g,"[")).replace(/,"\]"/g,"]"),JSON.parse(e)},t.shuffle=function(e){var t=e.length-1;return e.forEach((function(n,r){var i=Math.round(Math.random()*t);e[r]=e[i],e[i]=n})),e},t.sizzleMap=function(e){void 0===e&&(e=127);var t=Math.PI,n=[t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6,t],r=[0,t/6,t/4,t/3,t/2,2*t/3,3*t/4,5*t/6];return r.reverse(),n.concat(r).map((function(t){return Math.round(Math.sin(t)*e)}))},t.pickOne=function(e){return e.length>1?e[Math.round(Math.random())]:e[0]},t.dice=function(){return!!Math.round(Math.random())},t.flat=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Session=t.midi=t.arp=t.progression=t.getChordsByProgression=t.getChordDegrees=t.clip=t.chords=t.chord=t.modes=t.scales=t.mode=t.scale=void 0;var r=n(0);Object.defineProperty(t,"scales",{enumerable:!0,get:function(){return r.scales}}),Object.defineProperty(t,"modes",{enumerable:!0,get:function(){return r.scales}}),Object.defineProperty(t,"chords",{enumerable:!0,get:function(){return r.chords}}),Object.defineProperty(t,"scale",{enumerable:!0,get:function(){return r.scale}}),Object.defineProperty(t,"mode",{enumerable:!0,get:function(){return r.scale}}),Object.defineProperty(t,"chord",{enumerable:!0,get:function(){return r.chord}});var i=n(3);Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return i.clip}});var o=n(4);Object.defineProperty(t,"getChordDegrees",{enumerable:!0,get:function(){return o.getChordDegrees}}),Object.defineProperty(t,"getChordsByProgression",{enumerable:!0,get:function(){return o.getChordsByProgression}}),Object.defineProperty(t,"progression",{enumerable:!0,get:function(){return o.progression}});var a=n(5);Object.defineProperty(t,"arp",{enumerable:!0,get:function(){return a.arp}});var s=n(6);Object.defineProperty(t,"midi",{enumerable:!0,get:function(){return s.midi}});var u=n(10);Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return u.Session}})},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.clip=t.renderingDuration=t.totalPatternDuration=t.recursivelyApplyPatternToDurations=void 0;var a=n(1),s=n(0),u=function(e){if(a.isNote(e))return[e];if(Array.isArray(e))return e.forEach((function(e){if(!a.isNote(e))throw new TypeError("array must comprise valid notes")})),e;if(!Array.isArray(e)){var t=s.chord(e);if(t&&t.length)return t}throw new Error("Chord "+e+" not found")},c=function(e,t,n){return"R"===e&&t.randomNotes?t.randomNotes[(r=t.randomNotes.length-1,void 0===r&&(r=1),Math.round(Math.random()*r))]:t.notes[n%t.notes.length];var r},l=function(e,t){return e.durations?e.durations[t%e.durations.length]:e.dur||e.subdiv||"8n"},p=function(e){var t=0;return e.instrument instanceof Tone.Player?function(n,r){"x"!==r&&"R"!==r||(e.instrument.start(n),t++)}:e.instrument instanceof Tone.PolySynth||e.instrument instanceof Tone.Sampler?function(n,r){"x"!==r&&"R"!==r||(e.instrument.triggerAttackRelease(c(r,e,t),l(e,t),n),t++)}:e.instrument instanceof Tone.NoiseSynth?function(n,r){"x"!==r&&"R"!==r||(e.instrument.triggerAttackRelease(l(e,t),n),t++)}:function(n,r){"x"!==r&&"R"!==r||(e.instrument.triggerAttackRelease(c(r,e,t)[0],l(e,t),n),t++)}};t.recursivelyApplyPatternToDurations=function(e,n,r){return void 0===r&&(r=[]),e.forEach((function(e){"string"==typeof e&&("x"!==e&&"R"!==e||r.push(n),"_"===e&&r.length&&(r[r.length-1]+=n)),Array.isArray(e)&&t.recursivelyApplyPatternToDurations(e,n/e.length,r)})),r};var f=function(e,n){var r;if(n=n||Tone.getContext(),!e.pattern)throw new Error("No pattern provided!");if(!(e.player||e.instrument||e.sample||e.buffer||e.synth||e.sampler||e.samples))throw new Error("No player or instrument provided!");e.durations||e.dur||(e.durations=t.recursivelyApplyPatternToDurations(a.expandStr(e.pattern),Tone.Ticks(e.subdiv||"4n").toSeconds()));var i=[];return e.effects&&(Array.isArray(e.effects)||(e.effects=[e.effects]),i=e.effects.map((function(e){return("string"==typeof e?new Tone[e]({context:n}):e.context!==n?m(e,n):e).toDestination()})).map((function(e){return"function"==typeof e.start?e.start():e}))),e.synth&&!e.instrument&&(e.instrument=e.synth,console.warn('The "synth" parameter will be deprecated in the future. Please use the "instrument" parameter instead.')),e.instrument=e.sample||e.buffer?new Tone.Player({url:e.sample||e.buffer,context:n}):e.sampler?e.sampler:e.player?e.player:e.samples?new Tone.Sampler({url:e.samples,context:n}):"string"==typeof e.instrument?new Tone[e.instrument]({context:n}):e.instrument,e.instrument.context!==n&&(e.instrument=m(e.instrument,n)),e.volume&&(e.instrument.volume.value=e.volume),(r=e.instrument).chain.apply(r,i).toDestination(),new Tone.Sequence({callback:p(e),events:a.expandStr(e.pattern),subdivision:e.subdiv||"4n",context:n})};t.totalPatternDuration=function(e,t){return"number"==typeof t?t*a.expandStr(e).length:Tone.Ticks(t).toSeconds()*a.expandStr(e).length};t.renderingDuration=function(e,n,r,i){var o=e.split("").filter((function(e){return"x"===e})).length,a=e.split("").filter((function(e){return"R"===e})).length,s=(null==i?void 0:i.length)?o:o+a,u=r.length||1;return t.totalPatternDuration(e,n)/s*function(e,t){for(var n=e<t?[e,t]:[t,e],r=n[0],i=n[1],o=i;o%r!=0;)o+=i;return o}(u,s)};var h,d=0,m=function(e,t){if(e instanceof Tone.PolySynth)return new Tone.PolySynth(Tone[e._dummyVoice.name],r(r({},e.get()),{context:t}));if(e instanceof Tone.Player)return new Tone.Player({url:e._buffer,context:t});if(e instanceof Tone.Sampler){var n=e.get(),i={attack:n.attack,curve:n.curve,release:n.release,volume:n.volume},o={baseUrl:e._buffers.baseUrl,urls:Object.fromEntries(e._buffers._buffers.entries())};return new Tone.Sampler(r(r(r({},i),o),{context:t}))}return new Tone[e.name](r(r({},e.get()),{context:t}))};t.clip=function(e){if("string"==typeof(e=r(r({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",amp:100,accentLow:70,randomNotes:null,effects:[],offlineRendering:!1}),e||{})).notes&&(e.notes=e.notes.replace(/\s{2,}/g," "),e.notes=e.notes.split(" ")),e.notes=e.notes.map(u),/[^x\-_\[\]R]/.test(e.pattern))throw new TypeError("pattern can only comprise x - _ [ ], found "+e.pattern);return e.shuffle&&(e.notes=a.shuffle(e.notes)),e.randomNotes&&"string"==typeof e.randomNotes&&(e.randomNotes=e.randomNotes.replace(/\s{2,}/g," ").split(/\s/)),e.randomNotes&&(e.randomNotes=e.randomNotes.map(u)),e.offlineRendering?function(e,t){h||(h=Tone.getContext()),d++;var n=new Tone.Player({context:h,loop:!0});return Tone.Offline((function(t){return i(void 0,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return n=f(e,t),[4,Tone.loaded()];case 1:return r.sent(),n.start(),t.transport.start(),[2]}}))}))}),t).then((function(t){var r;n.buffer=t,0===--d&&(Tone.setContext(h),null===(r=e.offlineRenderingCallback)||void 0===r||r.call(e))})),n.toDestination(),n.sync(),n}(e,t.renderingDuration(e.pattern,e.subdiv||"4n",e.notes,e.randomNotes)):f(e,h)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.progression=t.getChordsByProgression=t.getChordDegrees=void 0;var r=n(0),i=n(1);t.getChordDegrees=function(e){var t={ionian:["I","ii","iii","IV","V","vi","vii°"],dorian:["i","ii","III","IV","v","vi°","VII"],phrygian:["i","II","III","iv","v°","VI","vii"],lydian:["I","II","iii","iv°","V","vi","vii"],mixolydian:["I","ii","iii°","IV","v","vi","VII"],aeolian:["i","ii°","III","iv","v","VI","VII"],locrian:["i°","II","iii","iv","V","VI","vii"],"melodic minor":["i","ii","III+","IV","V","vi°","vii°"],"harmonic minor":["i","ii°","III+","iv","V","VI","vii°"]};return t.major=t.ionian,t.minor=t.aeolian,t[e]||[]};var o={i:0,ii:1,iii:2,iv:3,v:4,vi:5,vii:6};t.getChordsByProgression=function(e,t){var n=e.split(" ");n[0].match(/\d/)||(n[0]+="4",e=n.join(" "));var i=r.scale(e);return t.replace(/\s*,+\s*/g," ").split(" ").map((function(e,t){var n=function(e){var t=e.replace(/\W/g,""),n="M";return t.toLowerCase()===t&&(n="m"),e.indexOf("°")>-1?n+"7b5":e.indexOf("+")>-1?n+"#5":e.indexOf("7")>-1?"M"===n?"maj7":"m7":n}(e),r=o[e.replace(/\W|\d/g,"").toLowerCase()],a=i[r],s=a.replace(/\D+/,"");return a.replace(/\d/,"")+n+"_"+s})).toString().replace(/,/g," ")};var a=function(e){var t=e.T,n=e.P,r=e.D;return function(e){void 0===e&&(e=4);var o=[];o.push(i.pickOne(t));var a=1;for(a<e-1&&(o.push(i.pickOne(n)),a++),a<e-1&&i.dice()&&(o.push(i.pickOne(n)),a++),a<e-1&&(o.push(i.pickOne(r)),a++),a<e-1&&(o.push(i.pickOne(n)),a++),a<e-1&&(o.push(i.pickOne(r)),a++),a<e-1&&i.dice()&&(o.push(i.pickOne(n)),a++);a<e;)o.push(i.pickOne(r)),a++;return o}},s=a({T:["I","vi"],P:["ii","IV"],D:["V"]}),u=a({T:["i","VI"],P:["ii","iv"],D:["V"]});t.progression=function(e,t){return void 0===t&&(t=4),"major"===e||"M"===e?s(t):"minor"===e||"m"===e?u(t):void 0}},function(e,t,n){"use strict";var r=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.arp=void 0;var i=n(0),o=function(e,t){var n=function(e){return e.replace(/\d/,"")+(+e.replace(/\D/g,"")+1)},i=e.map(n),o=i.map(n);return r(e,i,o).slice(0,t)};t.arp=function(e){var t=[],n={count:4,order:"0123",chords:""};if("string"==typeof e)n.chords=e;else{if(e.order&&e.order.match(/\D/g))throw new TypeError("Invalid value for order");if(e.count>8||e.count<2)throw new TypeError("Invalid value for count");e.count&&!e.order&&(n.order=Array.from(Array(e.count).keys()).join("")),Object.assign(n,e)}if("string"==typeof n.chords)for(var a=function(e){var a=o(i.inlineChord(e),n.count),s=n.order.split("").map((function(e){return a[e]}));t=r(t,s)},s=0,u=n.chords.split(" ");s<u.length;s++){a(u[s])}else{if(!Array.isArray(n.chords))throw new TypeError("Invalid value for chords");for(var c=function(e){var i=o(e,n.count),a=n.order.split("").map((function(e){return i[e]}));t=r(t,a)},l=0,p=n.chords;l<p.length;l++){c(p[l])}}return t}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.midi=void 0;var s=a(n(7)),u=o(n(8));t.midi=function(e,t,n){void 0===t&&(t="music.mid");var r=l(e,n).toBytes();return null===t?r:(t.endsWith(".mid")||(t+=".mid"),"undefined"!=typeof window&&window.URL&&window.URL.createObjectURL?c(r,t):(s.default.writeFileSync(t,r,"binary"),void console.log("MIDI file generated: "+t+".")))};var c=function(e,t){for(var n=new Uint8Array(e.length),r=0;r<e.length;r++){var i=e.charCodeAt(r);n[r]=i}var o=new Blob([n],{type:"audio/midi"}),a=document.createElement("a");return a.href="undefined"!=typeof window&&void 0!==window.URL&&void 0!==window.URL.createObjectURL&&window.URL.createObjectURL(o)||"",a.download=t,a.innerText="Download MIDI file",a},l=function(e,t){var n=new u.File,r=new u.Track;"number"==typeof t&&r.setTempo(t),n.addTrack(r);for(var i=0,o=e;i<o.length;i++){var a=o[i],s=a.level||127;a.note?"string"==typeof a.note?(r.noteOn(0,a.note,a.length,s),r.noteOff(0,a.note,a.length,s)):r.addChord(0,a.note,a.length,s):r.noteOff(0,"",a.length)}return n}},function(e,t){e.exports=require("fs")},function(e,t,n){(function(e){var n={};!function(e){var t=e.DEFAULT_VOLUME=90,n=(e.DEFAULT_DURATION=128,e.DEFAULT_CHANNEL=0,{midi_letter_pitches:{a:21,b:23,c:12,d:14,e:16,f:17,g:19},midiPitchFromNote:function(e){var t=/([a-g])(#+|b+)?([0-9]+)$/i.exec(e),r=t[1].toLowerCase(),i=t[2]||"";return 12*parseInt(t[3],10)+n.midi_letter_pitches[r]+("#"==i.substr(0,1)?1:-1)*i.length},ensureMidiPitch:function(e){return"number"!=typeof e&&/[^0-9]/.test(e)?n.midiPitchFromNote(e):parseInt(e,10)},midi_pitches_letter:{12:"c",13:"c#",14:"d",15:"d#",16:"e",17:"f",18:"f#",19:"g",20:"g#",21:"a",22:"a#",23:"b"},midi_flattened_notes:{"a#":"bb","c#":"db","d#":"eb","f#":"gb","g#":"ab"},noteFromMidiPitch:function(e,t){var r,i=0,o=e;t=t||!1;return e>23&&(o=e-12*(i=Math.floor(e/12)-1)),r=n.midi_pitches_letter[o],t&&r.indexOf("#")>0&&(r=n.midi_flattened_notes[r]),r+i},mpqnFromBpm:function(e){var t=Math.floor(6e7/e),n=[];do{n.unshift(255&t),t>>=8}while(t);for(;n.length<3;)n.push(0);return n},bpmFromMpqn:function(e){if(void 0!==e[0]){0;for(var t=0,n=e.length-1;n>=0;++t,--n)e[t]<<n}return Math.floor(6e7/e)},codes2Str:function(e){return String.fromCharCode.apply(null,e)},str2Bytes:function(e,t){if(t)for(;e.length/2<t;)e="0"+e;for(var n=[],r=e.length-1;r>=0;r-=2){var i=0===r?e[r]:e[r-1]+e[r];n.unshift(parseInt(i,16))}return n},translateTickTime:function(e){for(var t=127&e;e>>=7;)t<<=8,t|=127&e|128;for(var n=[];n.push(255&t),128&t;)t>>=8;return n}}),r=function(e){if(!this)return new r(e);!e||null===e.type&&void 0===e.type||null===e.channel&&void 0===e.channel||null===e.param1&&void 0===e.param1||(this.setTime(e.time),this.setType(e.type),this.setChannel(e.channel),this.setParam1(e.param1),this.setParam2(e.param2))};r.NOTE_OFF=128,r.NOTE_ON=144,r.AFTER_TOUCH=160,r.CONTROLLER=176,r.PROGRAM_CHANGE=192,r.CHANNEL_AFTERTOUCH=208,r.PITCH_BEND=224,r.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},r.prototype.setType=function(e){if(e<r.NOTE_OFF||e>r.PITCH_BEND)throw new Error("Trying to set an unknown event: "+e);this.type=e},r.prototype.setChannel=function(e){if(e<0||e>15)throw new Error("Channel is out of bounds.");this.channel=e},r.prototype.setParam1=function(e){this.param1=e},r.prototype.setParam2=function(e){this.param2=e},r.prototype.toBytes=function(){var e=[],t=this.type|15&this.channel;return e.push.apply(e,this.time),e.push(t),e.push(this.param1),void 0!==this.param2&&null!==this.param2&&e.push(this.param2),e};var i=function(e){if(!this)return new i(e);this.setTime(e.time),this.setType(e.type),this.setData(e.data)};i.SEQUENCE=0,i.TEXT=1,i.COPYRIGHT=2,i.TRACK_NAME=3,i.INSTRUMENT=4,i.LYRIC=5,i.MARKER=6,i.CUE_POINT=7,i.CHANNEL_PREFIX=32,i.END_OF_TRACK=47,i.TEMPO=81,i.SMPTE=84,i.TIME_SIG=88,i.KEY_SIG=89,i.SEQ_EVENT=127,i.prototype.setTime=function(e){this.time=n.translateTickTime(e||0)},i.prototype.setType=function(e){this.type=e},i.prototype.setData=function(e){this.data=e},i.prototype.toBytes=function(){if(!this.type)throw new Error("Type for meta-event not specified.");var e=[];if(e.push.apply(e,this.time),e.push(255,this.type),Array.isArray(this.data))e.push(this.data.length),e.push.apply(e,this.data);else if("number"==typeof this.data)e.push(1,this.data);else if(null!==this.data&&void 0!==this.data){e.push(this.data.length);var t=this.data.split("").map((function(e){return e.charCodeAt(0)}));e.push.apply(e,t)}else e.push(0);return e};var o=function(e){if(!this)return new o(e);var t=e||{};this.events=t.events||[]};o.START_BYTES=[77,84,114,107],o.END_BYTES=[0,255,47,0],o.prototype.addEvent=function(e){return this.events.push(e),this},o.prototype.addNoteOn=o.prototype.noteOn=function(e,i,o,a){return this.events.push(new r({type:r.NOTE_ON,channel:e,param1:n.ensureMidiPitch(i),param2:a||t,time:o||0})),this},o.prototype.addNoteOff=o.prototype.noteOff=function(e,i,o,a){return this.events.push(new r({type:r.NOTE_OFF,channel:e,param1:n.ensureMidiPitch(i),param2:a||t,time:o||0})),this},o.prototype.addNote=o.prototype.note=function(e,t,n,r,i){return this.noteOn(e,t,r,i),n&&this.noteOff(e,t,n,i),this},o.prototype.addChord=o.prototype.chord=function(e,t,n,r){if(!Array.isArray(t)&&!t.length)throw new Error("Chord must be an array of pitches");return t.forEach((function(t){this.noteOn(e,t,0,r)}),this),t.forEach((function(t,r){0===r?this.noteOff(e,t,n):this.noteOff(e,t)}),this),this},o.prototype.setInstrument=o.prototype.instrument=function(e,t,n){return this.events.push(new r({type:r.PROGRAM_CHANGE,channel:e,param1:t,time:n||0})),this},o.prototype.setTempo=o.prototype.tempo=function(e,t){return this.events.push(new i({type:i.TEMPO,data:n.mpqnFromBpm(e),time:t||0})),this},o.prototype.toBytes=function(){var e=0,t=[],r=o.START_BYTES,i=o.END_BYTES;this.events.forEach((function(n){var r=n.toBytes();e+=r.length,t.push.apply(t,r)})),e+=i.length;var a=n.str2Bytes(e.toString(16),4);return r.concat(a,t,i)};var a=function(e){if(!this)return new a(e);var t=e||{};if(t.ticks){if("number"!=typeof t.ticks)throw new Error("Ticks per beat must be a number!");if(t.ticks<=0||t.ticks>=32768||t.ticks%1!=0)throw new Error("Ticks per beat must be an integer between 1 and 32767!")}this.ticks=t.ticks||128,this.tracks=t.tracks||[]};a.HDR_CHUNKID="MThd",a.HDR_CHUNK_SIZE="\0\0\0",a.HDR_TYPE0="\0\0",a.HDR_TYPE1="\0",a.prototype.addTrack=function(e){return e?(this.tracks.push(e),this):(e=new o,this.tracks.push(e),e)},a.prototype.toBytes=function(){var e=this.tracks.length.toString(16),t=a.HDR_CHUNKID+a.HDR_CHUNK_SIZE;return parseInt(e,16)>1?t+=a.HDR_TYPE1:t+=a.HDR_TYPE0,t+=n.codes2Str(n.str2Bytes(e,2)),t+=String.fromCharCode(this.ticks/256,this.ticks%256),this.tracks.forEach((function(e){t+=n.codes2Str(e.toBytes())})),t},e.Util=n,e.File=a,e.Track=o,e.Event=r,e.MetaEvent=i}(n),null!==e?e.exports=n:null!==t?t=n:this.Midi=n}).call(this,n(9)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;var r=n(11),i=function(){function e(e){e=e||[],this.sessionChannels=e.map((function(e,t){return e.idx=e.idx||t,new r.Channel(e)}))}return e.prototype.createChannel=function(e){e.idx=e.idx||this.sessionChannels.length;var t=new r.Channel(e);return this.sessionChannels.push(t),t},Object.defineProperty(e.prototype,"channels",{get:function(){return this.sessionChannels},enumerable:!1,configurable:!0}),e.prototype.startRow=function(e){this.sessionChannels.forEach((function(t){t.startClip(e)}))},e.prototype.play=function(e){var t=this,n=e.channelPatterns,r=e.clipDuration||"4:0:0",i=Tone.Time(r).toSeconds(),o=function(e,t){e.forEach((function(e){return e.stop(t)}))};n.forEach((function(e){var n=e.channelIdx,r=e.pattern,a=[],s=0,u="-";r.split("").forEach((function(e){e!==u&&"_"!==e&&(o(a,s),a=function(e,n,r){return"-"===n?[]:t.channels.filter((function(t){return t.idx===e})).map((function(e){return e.clips[n].start(r)}))}(n,e,s)),u=e,s+=i})),o(a,s)}))},e}();t.Session=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=void 0;var o=n(12),a=function(){var e=Tone.Transport.position.split(":");return"0"===e[0]&&"0"===e[1]?0:+e[0]+1+":0:0"},s=function(){function e(e){var t=this;this.idx=e.idx||0,this.activePatternIdx=-1,this.channelClips=[],e.sample&&(this.player=new Tone.Player(e.sample)),e.synth&&(this.instrument=new Tone[e.synth]),e.samples&&(this.sampler=new Tone.Sampler(e.samples));e.clips,e.samples,e.sample,e.synth;var n=i(e,["clips","samples","sample","synth"]);e.clips.forEach((function(e){t.addClip(r(r({},e),n))}),this)}return Object.defineProperty(e.prototype,"clips",{get:function(){return this.channelClips},enumerable:!1,configurable:!0}),e.prototype.startClip=function(e){this.activePatternIdx>-1&&this.activePatternIdx!==e&&this.stopClip(this.activePatternIdx),this.channelClips[e]&&"started"!==this.channelClips[e].state&&(this.activePatternIdx=e,this.channelClips[e].start(a()))},e.prototype.stopClip=function(e){this.channelClips[e].stop(a())},e.prototype.addClip=function(e,t){t=t||this.channelClips.length,e.pattern?this.channelClips[t]=o.clip(r({player:this.player,instrument:this.instrument,sampler:this.sampler},e)):this.channelClips[t]=null},Object.defineProperty(e.prototype,"activeClipIdx",{get:function(){return this.activePatternIdx},enumerable:!1,configurable:!0}),e}();t.Channel=s},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.clip=void 0;var i=n(1),o=n(0),a={"1m":2048,"2m":4096,"3m":6144,"4m":8192,"1n":512,"2n":256,"4n":128,"8n":64,"16n":32},s=function(e){if(i.isNote(e))return[e];if(Array.isArray(e))return e.forEach((function(e){if(!i.isNote(e))throw new TypeError("array must comprise valid notes")})),e;if(!Array.isArray(e)){var t=o.inlineChord(e);if(t&&t.length)return t}throw new Error("Chord "+e+" not found")};t.clip=function(e){if("string"==typeof(e=r(r({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",amp:100,accentLow:70,randomNotes:null,effects:[],offlineRendering:!1}),e||{})).notes&&(e.notes=e.notes.replace(/\s{2,}/g," "),e.notes=e.notes.split(" ")),e.notes=e.notes.map(s),/[^x\-_\[\]R]/.test(e.pattern))throw new TypeError("pattern can only comprise x - _ [ ], found "+e.pattern);e.shuffle&&(e.notes=i.shuffle(e.notes)),e.randomNotes&&"string"==typeof e.randomNotes&&(e.randomNotes=e.randomNotes.replace(/\s{2,}/g," ").split(/\s/)),e.randomNotes&&(e.randomNotes=e.randomNotes.map(s));var t=[],n=0,o=function(r,i){r.forEach((function(r){if("string"==typeof r){var a=e.notes[n];"R"===r&&(Math.round(Math.random())||e.randomNotes)&&(a=e.randomNotes?e.randomNotes[Math.round(Math.random()*(e.randomNotes.length-1))]:e.notes[n]),"x"!==r&&"R"!==r||n++,"x"!==r&&"-"!==r&&"R"!==r||t.push({note:a,length:i,level:"R"!==r||e.randomNotes?e.amp:e.accentLow}),"_"===r&&t.length&&(t[t.length-1].length+=i),n===e.notes.length&&(n=0)}Array.isArray(r)&&o(r,i/r.length)}))};if(o(i.expandStr(e.pattern),a[e.subdiv]||a["4n"]),e.sizzle){var u=[],c=!0===e.sizzle?"sin":e.sizzle,l=t.length,p=e.amp,f=e.sizzleReps,h=p/(l/f);if("sin"===c||"cos"===c)for(var d=0;d<l;d++){var m=Math[c](d*Math.PI/(l/f))*p;u.push(Math.round(Math.abs(m)))}if("rampUp"===c)for(m=0,d=0;d<l;d++)d%(l/f)==0?m=0:m+=h,u.push(Math.round(Math.abs(m)));if("rampDown"===c)for(m=p,d=0;d<l;d++)d%(l/f)==0?m=p:m-=h,u.push(Math.round(Math.abs(m)));for(d=0;d<u.length;d++)t[d].level=u[d]?u[d]:1}if(e.accent){if(/[^x\-]/.test(e.accent))throw new TypeError("Accent can only have x and - characters");for(var y=0,v=0,b=t;v<b.length;v++){var g=b[v];m="x"===e.accent[y]?e.amp:e.accentLow;e.sizzle&&(m=(g.level+m)/2),g.level=Math.round(m),(y+=1)===e.accent.length&&(y=0)}}return t}}]));
|
|
1
|
+
(()=>{var t={397:(t,e)=>{(()=>{"use strict";var t={413:t=>{t.exports=JSON.parse('{"5th":"100000010000","M7#5sus4":"100001001001","7#5sus4":"100001001010","sus4":"100001010000","M7sus4":"100001010001","7sus4":"100001010010","7no5":"100010000010","aug":"100010001000","M7b6":"100010001001","maj7#5":"100010001001","7#5":"100010001010","7b13":"100010001010","M":"100010010000","maj7":"100010010001","7th":"100010010010","6th":"100010010100","7add6":"100010010110","7b6":"100010011010","Mb5":"100010100000","M7b5":"100010100001","7b5":"100010100010","maj#4":"100010110001","7#11":"100010110010","M6#11":"100010110100","7#11b13":"100010111010","m#5":"100100001000","mb6M7":"100100001001","m7#5":"100100001010","m":"100100010000","m/ma7":"100100010001","m7":"100100010010","m6":"100100010100","mMaj7b6":"100100011001","dim":"100100100000","oM7":"100100100001","m7b5":"100100100010","dim7":"100100100100","o7M7":"100100100101","4th":"100101000010","madd4":"100101010000","m7add11":"100101010010","+add#9":"100110001000","7#5#9":"100110001010","7#9":"100110010010","13#9":"100110010110","7#9b13":"100110011010","maj7#9#11":"100110110001","7#9#11":"100110110010","13#9#11":"100110110110","7#9#11b13":"100110111010","sus2":"101000010000","M9#5sus4":"101001001001","sus24":"101001010000","M9sus4":"101001010001","11th":"101001010010","9sus4":"101001010010","13sus4":"101001010110","9no5":"101010000010","13no5":"101010000110","M#5add9":"101010001000","maj9#5":"101010001001","9#5":"101010001010","9b13":"101010001010","Madd9":"101010010000","maj9":"101010010001","9th":"101010010010","6/9":"101010010100","maj13":"101010010101","M7add13":"101010010101","13th":"101010010110","M9b5":"101010100001","9b5":"101010100010","13b5":"101010100110","9#5#11":"101010101010","maj9#11":"101010110001","9#11":"101010110010","69#11":"101010110100","M13#11":"101010110101","13#11":"101010110110","9#11b13":"101010111010","m9#5":"101100001010","madd9":"101100010000","mM9":"101100010001","m9":"101100010010","m69":"101100010100","m13":"101100010110","mMaj9b6":"101100011001","m9b5":"101100100010","m11A":"101101001010","m11":"101101010010","b9sus":"110001010010","11b9":"110001010010","7sus4b9b13":"110001011010","alt7":"110010000010","7#5b9":"110010001010","Maddb9":"110010010000","M7b9":"110010010001","7b9":"110010010010","13b9":"110010010110","7b9b13":"110010011010","7#5b9#11":"110010101010","7b9#11":"110010110010","13b9#11":"110010110110","7b9b13#11":"110010111010","mb6b9":"110100001000","7b9#9":"110110010010"}')},722:t=>{t.exports=JSON.parse('{"major pentatonic":"101010010100","ionian pentatonic":"100011010001","mixolydian pentatonic":"100011010010","ritusen":"101001010100","egyptian":"101001010010","neopolitan major pentatonic":"100011100010","vietnamese 1":"100101011000","pelog":"110100011000","kumoijoshi":"110001011000","hirajoshi":"101100011000","iwato":"110001100010","in-sen":"110001010010","lydian pentatonic":"100010110001","malkos raga":"100101001010","locrian pentatonic":"100101100010","minor pentatonic":"100101010010","minor six pentatonic":"100101010100","flat three pentatonic":"101100010100","flat six pentatonic":"101010011000","scriabin":"110010010100","whole tone pentatonic":"100010101010","lydian #5P pentatonic":"100010101001","lydian dominant pentatonic":"100010110010","minor #7M pentatonic":"100101010001","super locrian pentatonic":"100110100010","minor hexatonic":"101101010001","augmented":"100110011001","major blues":"101110010100","piongio":"101001010110","prometheus neopolitan":"110010100110","prometheus":"101010100110","mystery #1":"110010101010","six tone symmetric":"110011001100","whole tone":"101010101010","messiaen\'s mode #5":"110001110001","minor blues":"100101110010","locrian major":"101011101010","double harmonic lydian":"110010111001","harmonic minor":"101101011001","altered":"110110101010","locrian #2":"101101101010","mixolydian b6":"101011011010","lydian dominant":"101010110110","lydian":"101010110101","lydian augmented":"101010101101","dorian b2":"110101010110","melodic minor":"101101010101","locrian":"110101101010","ultralocrian":"110110101100","locrian 6":"110101100110","augmented heptatonic":"100111011001","romanian minor":"101100110110","dorian #4":"101100110110","lydian diminished":"101100110101","phrygian":"110101011010","leading whole tone":"101010101011","lydian minor":"101010111010","phrygian dominant":"110011011010","balinese":"110101011001","neopolitan major":"110101010101","aeolian":"101101011010","harmonic major":"101011011001","double harmonic major":"110011011001","dorian":"101101010110","hungarian minor":"101100111001","hungarian major":"100110110110","oriental":"110011100110","flamenco":"110110110010","todi raga":"110100111001","mixolydian":"101011010110","persian":"110011101001","major":"101011010101","enigmatic":"110010101011","major augmented":"101011001101","lydian #9":"100110110101","messiaen\'s mode #4":"111001111001","purvi raga":"110011111001","spanish heptatonic":"110111011010","bebop":"101011010111","bebop minor":"101111010110","bebop major":"101011011101","bebop locrian":"110101111010","minor bebop":"101101011011","diminished":"101101101101","ichikosucho":"101011110101","minor six diminished":"101101011101","half-whole diminished":"110110110110","kafi raga":"100111010111","messiaen\'s mode #6":"101011101011","composite blues":"101111110110","messiaen\'s mode #3":"101110111011","messiaen\'s mode #7":"111101111101","chromatic":"111111111111","ionian":"101011010101","minor":"101101011010"}')}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{r.r(o),r.d(o,{chord:()=>c,chords:()=>a,inlineChord:()=>i,scale:()=>u,scales:()=>s});var t=r(722),e=r(413),n=function(n){var r=n.scale,o=n.chord,i=r||o,a=r?"scale":"chord";if("string"!=typeof i)throw new Error("".concat(i," is not a valid input for ").concat(a));var s,c,u=i.indexOf(" ");-1===u?(s=i.slice(1),c=i[0],"b"!==i[1]&&"#"!==i[1]||(s=i.slice(2),c+=i[1])):(s=i.slice(-1===u?1:u+1),c=i.slice(0,u));var l=function(t){return{"C#":"Db","D#":"Eb","F#":"Gb","G#":"Ab","A#":"Bb"}[t.toUpperCase()]||t.charAt(0).toUpperCase()+t.slice(1)}(c.replace(/\d/g,"")),p=""!==c.replace(/\D/g,"")?+c.replace(/\D/g,""):4;if(isNaN(p))throw new Error("".concat(c[0]," does not have a valid octave"));if(!t[s]&&!e[s])throw new Error("".concat(i," is not a valid ").concat(a));for(var f=function(t,e){var n=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],r=n.map((function(t){return t+e})),o=n.map((function(t){return t+(e+1)})),i=r.concat(o);return i.slice(i.indexOf(t+e))}(l,p),h=[],d=0,m=0,v=r?t:e;d<v[s].length;)"1"===v[s][d]&&h.push(f[m]),d++,m++;return h},i=function(t){var e,r,o="b9sus",i=4;return t.includes(o)?(r=o,e=t.slice(0,t.indexOf(o))):(e=t[0],r=t.slice(1),"b"!==t[1]&&"#"!==t[1]||(e+=t[1],r=t.slice(2))),t.includes("_")&&(i=+t.split("_")[1],r=r.slice(0,r.indexOf("_"))),n({chord:e+i+" "+r})},a=function(){return Object.keys(e)},s=function(){return Object.keys(t)},c=function(t){return n({chord:t})},u=function(t){return n({scale:t})}})();var i=e;for(var a in o)i[a]=o[a];o.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})()},126:function(t,e,n){t=n.nmd(t);var r={};!function(t){var e=t.DEFAULT_VOLUME=90,n=(t.DEFAULT_DURATION=128,t.DEFAULT_CHANNEL=0,{midi_letter_pitches:{a:21,b:23,c:12,d:14,e:16,f:17,g:19},midiPitchFromNote:function(t){var e=/([a-g])(#+|b+)?([0-9]+)$/i.exec(t),r=e[1].toLowerCase(),o=e[2]||"";return 12*parseInt(e[3],10)+n.midi_letter_pitches[r]+("#"==o.substr(0,1)?1:-1)*o.length},ensureMidiPitch:function(t){return"number"!=typeof t&&/[^0-9]/.test(t)?n.midiPitchFromNote(t):parseInt(t,10)},midi_pitches_letter:{12:"c",13:"c#",14:"d",15:"d#",16:"e",17:"f",18:"f#",19:"g",20:"g#",21:"a",22:"a#",23:"b"},midi_flattened_notes:{"a#":"bb","c#":"db","d#":"eb","f#":"gb","g#":"ab"},noteFromMidiPitch:function(t,e){var r,o=0,i=t;return e=e||!1,t>23&&(i=t-12*(o=Math.floor(t/12)-1)),r=n.midi_pitches_letter[i],e&&r.indexOf("#")>0&&(r=n.midi_flattened_notes[r]),r+o},mpqnFromBpm:function(t){var e=Math.floor(6e7/t),n=[];do{n.unshift(255&e),e>>=8}while(e);for(;n.length<3;)n.push(0);return n},bpmFromMpqn:function(t){if(void 0!==t[0])for(var e=0,n=t.length-1;n>=0;++e,--n)t[e];return Math.floor(6e7/t)},codes2Str:function(t){return String.fromCharCode.apply(null,t)},str2Bytes:function(t,e){if(e)for(;t.length/2<e;)t="0"+t;for(var n=[],r=t.length-1;r>=0;r-=2){var o=0===r?t[r]:t[r-1]+t[r];n.unshift(parseInt(o,16))}return n},translateTickTime:function(t){for(var e=127&t;t>>=7;)e<<=8,e|=127&t|128;for(var n=[];n.push(255&e),128&e;)e>>=8;return n}}),r=function(t){if(!this)return new r(t);!t||null===t.type&&void 0===t.type||null===t.channel&&void 0===t.channel||null===t.param1&&void 0===t.param1||(this.setTime(t.time),this.setType(t.type),this.setChannel(t.channel),this.setParam1(t.param1),this.setParam2(t.param2))};r.NOTE_OFF=128,r.NOTE_ON=144,r.AFTER_TOUCH=160,r.CONTROLLER=176,r.PROGRAM_CHANGE=192,r.CHANNEL_AFTERTOUCH=208,r.PITCH_BEND=224,r.prototype.setTime=function(t){this.time=n.translateTickTime(t||0)},r.prototype.setType=function(t){if(t<r.NOTE_OFF||t>r.PITCH_BEND)throw new Error("Trying to set an unknown event: "+t);this.type=t},r.prototype.setChannel=function(t){if(t<0||t>15)throw new Error("Channel is out of bounds.");this.channel=t},r.prototype.setParam1=function(t){this.param1=t},r.prototype.setParam2=function(t){this.param2=t},r.prototype.toBytes=function(){var t=[],e=this.type|15&this.channel;return t.push.apply(t,this.time),t.push(e),t.push(this.param1),void 0!==this.param2&&null!==this.param2&&t.push(this.param2),t};var o=function(t){if(!this)return new o(t);this.setTime(t.time),this.setType(t.type),this.setData(t.data)};o.SEQUENCE=0,o.TEXT=1,o.COPYRIGHT=2,o.TRACK_NAME=3,o.INSTRUMENT=4,o.LYRIC=5,o.MARKER=6,o.CUE_POINT=7,o.CHANNEL_PREFIX=32,o.END_OF_TRACK=47,o.TEMPO=81,o.SMPTE=84,o.TIME_SIG=88,o.KEY_SIG=89,o.SEQ_EVENT=127,o.prototype.setTime=function(t){this.time=n.translateTickTime(t||0)},o.prototype.setType=function(t){this.type=t},o.prototype.setData=function(t){this.data=t},o.prototype.toBytes=function(){if(!this.type)throw new Error("Type for meta-event not specified.");var t=[];if(t.push.apply(t,this.time),t.push(255,this.type),Array.isArray(this.data))t.push(this.data.length),t.push.apply(t,this.data);else if("number"==typeof this.data)t.push(1,this.data);else if(null!==this.data&&void 0!==this.data){t.push(this.data.length);var e=this.data.split("").map((function(t){return t.charCodeAt(0)}));t.push.apply(t,e)}else t.push(0);return t};var i=function(t){if(!this)return new i(t);var e=t||{};this.events=e.events||[]};i.START_BYTES=[77,84,114,107],i.END_BYTES=[0,255,47,0],i.prototype.addEvent=function(t){return this.events.push(t),this},i.prototype.addNoteOn=i.prototype.noteOn=function(t,o,i,a){return this.events.push(new r({type:r.NOTE_ON,channel:t,param1:n.ensureMidiPitch(o),param2:a||e,time:i||0})),this},i.prototype.addNoteOff=i.prototype.noteOff=function(t,o,i,a){return this.events.push(new r({type:r.NOTE_OFF,channel:t,param1:n.ensureMidiPitch(o),param2:a||e,time:i||0})),this},i.prototype.addNote=i.prototype.note=function(t,e,n,r,o){return this.noteOn(t,e,r,o),n&&this.noteOff(t,e,n,o),this},i.prototype.addChord=i.prototype.chord=function(t,e,n,r){if(!Array.isArray(e)&&!e.length)throw new Error("Chord must be an array of pitches");return e.forEach((function(e){this.noteOn(t,e,0,r)}),this),e.forEach((function(e,r){0===r?this.noteOff(t,e,n):this.noteOff(t,e)}),this),this},i.prototype.setInstrument=i.prototype.instrument=function(t,e,n){return this.events.push(new r({type:r.PROGRAM_CHANGE,channel:t,param1:e,time:n||0})),this},i.prototype.setTempo=i.prototype.tempo=function(t,e){return this.events.push(new o({type:o.TEMPO,data:n.mpqnFromBpm(t),time:e||0})),this},i.prototype.toBytes=function(){var t=0,e=[],r=i.START_BYTES,o=i.END_BYTES;this.events.forEach((function(n){var r=n.toBytes();t+=r.length,e.push.apply(e,r)})),t+=o.length;var a=n.str2Bytes(t.toString(16),4);return r.concat(a,e,o)};var a=function(t){if(!this)return new a(t);var e=t||{};if(e.ticks){if("number"!=typeof e.ticks)throw new Error("Ticks per beat must be a number!");if(e.ticks<=0||e.ticks>=32768||e.ticks%1!=0)throw new Error("Ticks per beat must be an integer between 1 and 32767!")}this.ticks=e.ticks||128,this.tracks=e.tracks||[]};a.HDR_CHUNKID="MThd",a.HDR_CHUNK_SIZE="\0\0\0",a.HDR_TYPE0="\0\0",a.HDR_TYPE1="\0",a.prototype.addTrack=function(t){return t?(this.tracks.push(t),this):(t=new i,this.tracks.push(t),t)},a.prototype.toBytes=function(){var t=this.tracks.length.toString(16),e=a.HDR_CHUNKID+a.HDR_CHUNK_SIZE;return parseInt(t,16)>1?e+=a.HDR_TYPE1:e+=a.HDR_TYPE0,e+=n.codes2Str(n.str2Bytes(t,2)),e+=String.fromCharCode(this.ticks/256,this.ticks%256),this.tracks.forEach((function(t){e+=n.codes2Str(t.toBytes())})),e},t.Util=n,t.File=a,t.Track=i,t.Event=r,t.MetaEvent=o}(r),null!==t?t.exports=r:null!==e?e=r:this.Midi=r},148:function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.arp=void 0;var o=n(397),i=n(604),a=function(t,e){var n=function(t){if(!t)throw new Error("Empty element");var e=t.replace(/\d/,""),n=t.replace(/\D/g,"")||4;if(!e)throw new Error("Incorrect note");return e+(+n+1)},o=t.map(n),i=o.map(n);return r(r(r([],t,!0),o,!0),i,!0).slice(0,e)};e.arp=function(t){var e=[],n={count:4,order:"0123",chords:""};if("string"==typeof t)n.chords=t;else{if(t.order&&t.order.match(/\D/g))throw new TypeError("Invalid value for order");if(t.count>8||t.count<2)throw new TypeError("Invalid value for count");t.count&&!t.order&&(n.order=Array.from(Array(t.count).keys()).join("")),Object.assign(n,t)}if("string"==typeof n.chords)n.chords.split(" ").forEach((function(t,i){try{var s=a((0,o.inlineChord)(t),n.count),c=n.order.split("").map((function(t){return s[t]}));e=r(r([],e,!0),c,!0)}catch(e){throw new Error("Cannot decode chord ".concat(i+1,' "').concat(t,'" in given "').concat(n.chords,'"'))}}));else{if(!Array.isArray(n.chords))throw new TypeError("Invalid value for chords");n.chords.forEach((function(t,o){try{var s=a(t,n.count),c=n.order.split("").map((function(t){return s[t]}));e=r(r([],e,!0),c,!0)}catch(e){throw new Error("".concat((0,i.errorHasMessage)(e)?e.message:e," in chord ").concat(o+1,' "').concat(t,'"'))}}))}return e}},378:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.clip=e.renderingDuration=e.totalPatternDuration=e.recursivelyApplyPatternToDurations=e.getDuration=e.getNote=void 0;var a=n(604),s="4n";e.getNote=function(t,e,n){return"R"===t&&e.randomNotes&&e.randomNotes.length>0?e.randomNotes[(0,a.randomInt)(e.randomNotes.length-1)]:e.notes?e.notes[n%(e.notes.length||1)]:""},e.getDuration=function(t,e){return t.durations?t.durations[e%t.durations.length]:t.dur||t.subdiv||"8n"},e.recursivelyApplyPatternToDurations=function(t,n,r){return void 0===r&&(r=[]),t.forEach((function(t){"string"==typeof t&&("x"!==t&&"R"!==t||r.push(n),"_"===t&&r.length&&(r[r.length-1]+=n)),Array.isArray(t)&&(0,e.recursivelyApplyPatternToDurations)(t,n/t.length,r)})),r};var c=function(t,n,r){if(r=r||Tone.getContext(),!t.pattern)throw new Error("No pattern provided!");return t.durations||t.dur||(t.durations=(0,e.recursivelyApplyPatternToDurations)((0,a.expandStr)(t.pattern),Tone.Ticks(t.subdiv||s).toSeconds())),new Tone.Sequence({callback:n.getSeqFn(t),events:(0,a.expandStr)(t.pattern),subdivision:t.subdiv||s,context:r})};e.totalPatternDuration=function(t,e){return"number"==typeof e?e*(0,a.expandStr)(t).length:Tone.Ticks(e).toSeconds()*(0,a.expandStr)(t).length},e.renderingDuration=function(t,n,r,o){var i=t.split("").filter((function(t){return"x"===t})).length,a=t.split("").filter((function(t){return"R"===t})).length,s=(null==o?void 0:o.length)?i:i+a,c=r.length||1;return(0,e.totalPatternDuration)(t,n)/s*function(t,e){for(var n=t<e?[t,e]:[e,t],r=n[0],o=n[1],i=o;i%r!=0;)i+=o;return i}(c,s)};var u,l=0;e.clip=function(t,n){if("string"==typeof(t=r(r({},{notes:["C4"],pattern:"x",shuffle:!1,sizzle:!1,sizzleReps:1,arpegiate:!1,subdiv:"4n",align:"1m",alignOffset:"0",amp:100,accentLow:70,randomNotes:null,offlineRendering:!1}),t||{})).notes&&(t.notes=t.notes.replace(/\s{2,}/g," "),t.notes=t.notes.split(" ")),t.notes=t.notes?t.notes.map(a.convertChordsToNotes):[],/[^x\-_[\]R]/.test(t.pattern))throw new TypeError("pattern can only comprise x - _ [ ] R, found ".concat(t.pattern));return t.shuffle&&(t.notes=(0,a.shuffle)(t.notes)),t.randomNotes&&"string"==typeof t.randomNotes&&(t.randomNotes=t.randomNotes.replace(/\s{2,}/g," ").split(/\s/)),t.randomNotes&&(t.randomNotes=t.randomNotes.map(a.convertChordsToNotes)),t.offlineRendering?function(t,e){u||(u=Tone.getContext()),l++;var n=new Tone.Player({context:u,loop:!0});return Tone.Offline((function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n=c(t,e),[4,Tone.loaded()];case 1:return r.sent(),n.start(),e.transport.start(),[2]}}))}))}),e).then((function(e){var r;n.buffer=e,0==--l&&(Tone.setContext(u),null===(r=t.offlineRenderingCallback)||void 0===r||r.call(t))})),n.toDestination(),n.sync(),n}(t,(0,e.renderingDuration)(t.pattern,t.subdiv||s,t.notes,t.randomNotes)):c(t,n,u)}},594:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.Channel=void 0;var i=n(378),a=n(604),s=function(t){var e=Tone.Transport.position.split(":");if("0"===e[0]&&"0"===e[1])return 0;var n=Tone.Transport.ticks,r=(null==t?void 0:t.align)||"1m",o=(null==t?void 0:t.alignOffset)||"0",i=Tone.Ticks(r).toTicks(),a=Tone.Ticks(o).toTicks();return Tone.Ticks(Math.floor(n/i+1)*i+a)},c=function(){function t(t){var e=this;this.idx=t.idx||0,this.name=t.name||"ch "+t.idx,this.activePatternIdx=-1,this.channelClips=[],this.clipNoteCount=0,t.clips,t.samples,t.sample,t.synth;var n=o(t,["clips","samples","sample","synth"]),i=(n.external,n.sampler,n.buffer,o(n,["external","sampler","buffer"])),s=(i.player,i.instrument,i.volume,o(i,["player","instrument","volume"])),c=s.eventCb,u=s.playerCb,l=(s.effects,o(s,["eventCb","playerCb","effects"])),p=l.context,f=void 0===p?Tone.getContext():p,h=o(l,["context"]);this.eventCbFn=c,this.playerCbFn=u,this.hasLoaded=!1,this.hasFailed=!1,this.initializerTask=this.initOutputProducer(f,t).then((function(){return e.initInstrument(f,t).then((function(){return e.adjustInstrument(f,t).then((function(){return e.initEffects(f,t)}))}))}));var d=!1;try{t.clips.forEach((function(t,n){try{e.addClip(r(r({},t),h))}catch(t){throw new Error("".concat((0,a.errorHasMessage)(t)?t.message:t," in clip ").concat(n+1))}}),this)}catch(t){d=t}this.initializerTask.then((function(){if(d)throw d;e.hasLoaded=!0,e.eventCb("loaded",{})})).catch((function(t){e.hasFailed=t,e.eventCb("error",{e:t})}))}return t.setTransportTempo=function(t){Tone.Transport.bpm.value=t},t.startTransport=function(){Tone.start(),Tone.Transport.start()},t.stopTransport=function(t){void 0===t&&(t=!0),Tone.Transport.stop(),t&&Tone.Transport.cancel()},t.prototype.setVolume=function(t){var e,n;this.instrument&&(this.instrument.volume.value=t),this.external&&(null===(n=(e=this.external).setVolume)||void 0===n||n.call(e,t))},t.prototype.startClip=function(t,e){var n=this,r=this.channelClips[t];e=e||(0===e?0:s(r)),this.activePatternIdx>-1&&this.activePatternIdx!==t&&this.stopClip(this.activePatternIdx,e),r&&"started"!==r.state&&(this.counterResetTask=Tone.Transport.scheduleOnce((function(){n.clipNoteCount=0}),e),this.activePatternIdx=t,null==r||r.start(e))},t.prototype.stopClip=function(t,e){var n=this.channelClips[t];e=e||(0===e?0:s(n)),null==n||n.stop(e),t===this.activePatternIdx&&(this.activePatternIdx=-1)},t.prototype.addClip=function(t,e){var n=this;e=e||this.channelClips.length,t.pattern?(this.channelClips[e]=(0,i.clip)(r({},t),this),["align","alignOffset"].forEach((function(r){t[r]&&(n.channelClips[e][r]=t[r])}))):this.channelClips[e]=null},t.prototype.getSeqFn=function(t){var e=this;return this.external?function(n,r){var o,a;if("x"===r||"R"===r){var s=e.clipNoteCount;if(e.hasLoaded){var c=(0,i.getNote)(r,t,s)[0],u=(0,i.getDuration)(t,s),l=Tone.Time(u).toSeconds();e.playerCb({note:c,duration:u,time:n,counter:s});try{null===(a=(o=e.external).triggerAttackRelease)||void 0===a||a.call(o,c,l,n)}catch(t){e.eventCb("error",{e:t})}}e.clipNoteCount++}}:this.instrument instanceof Tone.Player?function(t,n){if("x"===n||"R"===n){var r=e.clipNoteCount;if(e.hasLoaded){e.playerCb({note:"",duration:"",time:t,counter:r});try{e.instrument.start(t)}catch(t){e.eventCb("error",{e:t})}}e.clipNoteCount++}}:this.instrument instanceof Tone.PolySynth||this.instrument instanceof Tone.Sampler?function(n,r){if("x"===r||"R"===r){var o=e.clipNoteCount;if(e.hasLoaded){var a=(0,i.getNote)(r,t,o),s=(0,i.getDuration)(t,o);e.playerCb({note:a,duration:s,time:n,counter:o});try{e.instrument.triggerAttackRelease(a,s,n)}catch(t){e.eventCb("error",{e:t})}}e.clipNoteCount++}}:this.instrument instanceof Tone.NoiseSynth?function(n,r){if("x"===r||"R"===r){var o=e.clipNoteCount;if(e.hasLoaded){var a=(0,i.getDuration)(t,o);e.playerCb({note:"",duration:a,time:n,counter:o});try{e.instrument.triggerAttackRelease(a,n)}catch(t){e.eventCb("error",{e:t})}}e.clipNoteCount++}}:function(n,r){if("x"===r||"R"===r){var o=e.clipNoteCount;if(e.hasLoaded){var a=(0,i.getNote)(r,t,o)[0],s=(0,i.getDuration)(t,o);e.playerCb({note:a,duration:s,time:n,counter:o});try{e.instrument.triggerAttackRelease(a,s,n)}catch(t){e.eventCb("error",{e:t})}}e.clipNoteCount++}}},t.prototype.eventCb=function(t,e){"function"==typeof this.eventCbFn&&(e.channel=this,this.eventCbFn(t,e))},t.prototype.playerCb=function(t){"function"==typeof this.playerCbFn&&(t.channel=this,this.playerCbFn(t))},t.prototype.checkToneObjLoaded=function(t,e){var n=this,r=t instanceof Tone.Sampler;if("loaded"in t){if(t.loaded)return void e();if(r)return;var o=!1;if(["buffer","_buffer","_buffers"].forEach((function(r){r in t&&(n.checkToneObjLoaded(t[r],e),o=!0)})),o)return}if(t instanceof Tone.ToneAudioBuffer||t instanceof Tone.ToneBufferSource||"loaded"in t&&"onload"in t){var i=t.onload;t.onload=function(){i&&"function"==typeof i&&(t.onload=i,i()),e()}}else e()},t.prototype.recreateToneObjectInContext=function(t,e){var n=this;return e=e||Tone.getContext(),new Promise((function(o,i){if(t instanceof Tone.PolySynth){var a=Tone.PolySynth(Tone[t._dummyVoice.name],r(r({},t.get()),{context:e}));n.checkToneObjLoaded(a,(function(){return o(a)}))}else if(t instanceof Tone.Player)var s=Tone.Player({url:t._buffer,context:e,onload:function(){return n.checkToneObjLoaded(s,(function(){return o(s)}))}});else if(t instanceof Tone.Sampler)var c=t.get(),u={attack:c.attack,curve:c.curve,release:c.release,volume:c.volume},l={baseUrl:t._buffers.baseUrl,urls:Object.fromEntries(t._buffers._buffers.entries())},p=Tone.Sampler(r(r(r({},u),l),{context:e,onload:function(){return n.checkToneObjLoaded(p,(function(){return o(p)}))}}));else{var f=Tone[t.name](r(r({},t.get()),{context:e,onload:function(){return n.checkToneObjLoaded(f,(function(){return o(f)}))}}));n.checkToneObjLoaded(f,(function(){return o(f)}))}}))},t.prototype.initOutputProducer=function(t,e){var n=this;return t=t||Tone.getContext(),new Promise((function(o,i){if(e.synth){if(e.instrument)throw new Error("Either synth or instrument can be provided, but not both.");if(e.synth.synth){var a=e.synth.synth,s=e.synth.preset||{};n.instrument=new Tone[a](r(r({},s),{context:t,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}})),n.checkToneObjLoaded(n.instrument,o)}else n.instrument=e.synth,console.warn('The "synth" parameter with instrument will be deprecated in the future. Please use the "instrument" parameter instead.'),n.checkToneObjLoaded(n.instrument,o)}else if("string"==typeof e.instrument)n.instrument=new Tone[e.instrument]({context:t}),n.checkToneObjLoaded(n.instrument,o);else if(e.instrument)n.instrument=e.instrument,n.checkToneObjLoaded(n.instrument,o);else if(e.sample||e.buffer)n.instrument=new Tone.Player({url:e.sample||e.buffer,context:t,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(e.samples)n.instrument=new Tone.Sampler({urls:e.samples,context:t,onload:function(){return n.checkToneObjLoaded(n.instrument,o)}});else if(e.sampler)n.instrument=e.sampler,n.checkToneObjLoaded(n.instrument,o);else if(e.player)n.instrument=e.player,n.checkToneObjLoaded(n.instrument,o);else{if(!e.external)throw new Error("One of required synth|instrument|sample|sampler|samples|buffer|player|external is not provided!");if(n.external=r({},e.external),n.instrument={context:t,volume:{value:0}},e.external.init)return e.external.init(t.rawContext).then((function(){o()})).catch((function(t){var e;i(new Error("".concat(t.message," loading external output module of channel idx ").concat(n.idx,", ").concat(null!==(e=n.name)&&void 0!==e?e:"(no name)")))}));o()}if(!n.instrument)throw new Error("Failed instantiating instrument from given params.")}))},t.prototype.initInstrument=function(t,e){var n,r=this;return t=t||Tone.getContext(),e.external||(null===(n=this.instrument)||void 0===n?void 0:n.context)===t?new Promise((function(t,e){t()})):this.recreateToneObjectInContext(this.instrument,t).then((function(t){r.instrument=t}))},t.prototype.adjustInstrument=function(t,e){var n=this;return t=t||Tone.getContext(),new Promise((function(t,r){e.volume&&n.setVolume(e.volume),t()}))},t.prototype.initEffects=function(t,e){var n=this;t=t||Tone.getContext();var r,o=function(t){return"function"==typeof t.start?t.start():t},i=(r=e.effects)?Array.isArray(r)?r:[r]:[];if(e.external){if(0!==i.length)throw new Error("Effects cannot be used with external output");return Promise.resolve()}return Promise.all(i.map((function(e){return new Promise((function(r,o){if("string"==typeof e)r(new Tone[e]({context:t}));else{if(e.context!==t)return n.recreateToneObjectInContext(e,t);r(e)}})).then((function(t){return t.toDestination()}))}))).then((function(t){return t.map(o)})).then((function(t){var e;(e=n.instrument).chain.apply(e,t).toDestination()}))},Object.defineProperty(t.prototype,"clips",{get:function(){return this.channelClips},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeClipIdx",{get:function(){return this.activePatternIdx},enumerable:!1,configurable:!0}),t}();e.Channel=c},267:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.midi=void 0;var s=a(n(231)),c=i(n(126));e.midi=function(t,e,n){void 0===e&&(e="music.mid");var r=l(t,n).toBytes();return null===e?r:(e.endsWith(".mid")||(e+=".mid"),"undefined"!=typeof window&&window.URL&&window.URL.createObjectURL?u(r,e):(s.default.writeFileSync(e,r,"binary"),void console.log("MIDI file generated: ".concat(e,"."))))};var u=function(t,e){for(var n=new Uint8Array(t.length),r=0;r<t.length;r++){var o=t.charCodeAt(r);n[r]=o}var i=new Blob([n],{type:"audio/midi"}),a=document.createElement("a");return a.href="undefined"!=typeof window&&void 0!==window.URL&&void 0!==window.URL.createObjectURL&&window.URL.createObjectURL(i)||"",a.download=e,a.innerText="Download MIDI file",a},l=function(t,e){var n=new c.File,r=new c.Track;"number"==typeof e&&r.setTempo(e),n.addTrack(r);for(var o=0,i=t;o<i.length;o++){var a=i[o],s=a.level||127;a.note?"string"==typeof a.note?(r.noteOn(0,a.note,a.length,s),r.noteOff(0,a.note,a.length,s)):r.addChord(0,a.note,a.length,s):r.noteOff(0,"",a.length)}return n}},668:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.progression=e.getChordsByProgression=e.getChordDegrees=void 0;var r=n(397),o=n(604);e.getChordDegrees=function(t){var e={ionian:["I","ii","iii","IV","V","vi","vii°"],dorian:["i","ii","III","IV","v","vi°","VII"],phrygian:["i","II","III","iv","v°","VI","vii"],lydian:["I","II","iii","iv°","V","vi","vii"],mixolydian:["I","ii","iii°","IV","v","vi","VII"],aeolian:["i","ii°","III","iv","v","VI","VII"],locrian:["i°","II","iii","iv","V","VI","vii"],"melodic minor":["i","ii","III+","IV","V","vi°","vii°"],"harmonic minor":["i","ii°","III+","iv","V","VI","vii°"]};return e.major=e.ionian,e.minor=e.aeolian,e[t]||[]};var i={i:0,ii:1,iii:2,iv:3,v:4,vi:5,vii:6};e.getChordsByProgression=function(t,e){var n=t.split(" ");n[0].match(/\d/)||(n[0]+="4",t=n.join(" "));var o=(0,r.scale)(t);return e.replace(/\s*,+\s*/g," ").split(" ").map((function(t){var e=function(t){var e=t.replace(/\W/g,""),n="M";return e.toLowerCase()===e&&(n="m"),t.indexOf("°")>-1?n+"7b5":t.indexOf("+")>-1?n+"#5":t.indexOf("7")>-1?"M"===n?"maj7":"m7":n}(t),n=i[t.replace(/\W|\d/g,"").toLowerCase()],r=o[n],a=r.replace(/\D+/,"");return r.replace(/\d/,"")+e+"_"+a})).toString().replace(/,/g," ")};var a=function(t){var e=t.T,n=t.P,r=t.D;return function(t){void 0===t&&(t=4);var i=[];i.push((0,o.pickOne)(e));var a=1;for(a<t-1&&(i.push((0,o.pickOne)(n)),a++),a<t-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++),a<t-1&&(i.push((0,o.pickOne)(r)),a++),a<t-1&&(i.push((0,o.pickOne)(n)),a++),a<t-1&&(i.push((0,o.pickOne)(r)),a++),a<t-1&&(0,o.dice)()&&(i.push((0,o.pickOne)(n)),a++);a<t;)i.push((0,o.pickOne)(r)),a++;return i}},s=a({T:["I","vi"],P:["ii","IV"],D:["V"]}),c=a({T:["i","VI"],P:["ii","iv"],D:["V"]});e.progression=function(t,e){return void 0===e&&(e=4),"major"===t||"M"===t?s(e):"minor"===t||"m"===t?c(e):[]}},484:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;var r=n(594),o=function(){function t(t){var e=this;t=t||[],this.sessionChannels=t.map((function(t,n){return t.idx=t.idx||n,t.idx=e.uniqueIdx(e.sessionChannels,t.idx),new r.Channel(t)}))}return t.prototype.uniqueIdx=function(t,e){if(!t)return e||0;var n=t.reduce((function(t,e){return!t.find((function(t){return t===e.idx}))&&t.concat(e.idx)||t}),[]);if(!e||n.find((function(t){return t===e}))){for(var r=t.length;n.find((function(t){return t===r}));)r+=1;return r}return e},t.prototype.createChannel=function(t){t.idx=this.uniqueIdx(this.sessionChannels,t.idx);var e=new r.Channel(t);return this.sessionChannels.push(e),e},Object.defineProperty(t.prototype,"channels",{get:function(){return this.sessionChannels},enumerable:!1,configurable:!0}),t.prototype.setTransportTempo=function(t){r.Channel.setTransportTempo(t)},t.prototype.startTransport=function(){r.Channel.startTransport()},t.prototype.stopTransport=function(t){void 0===t&&(t=!0),r.Channel.stopTransport(t)},t.prototype.startRow=function(t){this.sessionChannels.forEach((function(e){e.startClip(t)}))},t.prototype.play=function(t){var e=this,n=t.channelPatterns,r=t.clipDuration||"4:0:0",o=Tone.Time(r).toSeconds(),i=function(t,e){t.forEach((function(t){return t.stop(e)}))};n.forEach((function(t){var n=t.channelIdx,r=t.pattern,a=[],s=0,c="-";r.split("").forEach((function(t){t!==c&&"_"!==t&&(i(a,s),a=function(t,n,r){return"-"===n?[]:e.channels.filter((function(e){return e.idx===t})).map((function(t){var e;return null===(e=t.clips[n])||void 0===e?void 0:e.start(r)}))}(n,t,s)),c=t,s+=o})),i(a,s)}))},t}();e.Session=o},604:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomInt=e.convertChordsToNotes=e.convertChordToNotes=e.errorHasMessage=e.flat=e.dice=e.pickOne=e.sizzleMap=e.shuffle=e.expandStr=e.isNote=void 0;var r=n(397);e.isNote=function(t){return/^[a-gA-G](?:#|b)?\d$/.test(t)},e.expandStr=function(t){return t=(t=(t=(t=JSON.stringify(t.split(""))).replace(/,"\[",/g,", [")).replace(/"\[",/g,"[")).replace(/,"\]"/g,"]"),JSON.parse(t)},e.shuffle=function(t,e){void 0===e&&(e=!0);var n=t.length-1;return t.forEach((function(r,o){if(!(o>=n)){var i=e?Math.floor(Math.random()*(n-o))+1+o:Math.floor(Math.random()*(n+1-o))+o;t[o]=t[i],t[i]=r}})),t},e.sizzleMap=function(t){void 0===t&&(t=127);var e=Math.PI,n=[e/6,e/4,e/3,e/2,2*e/3,3*e/4,5*e/6,e],r=[0,e/6,e/4,e/3,e/2,2*e/3,3*e/4,5*e/6];return r.reverse(),n.concat(r).map((function(e){return Math.round(Math.sin(e)*t)}))},e.pickOne=function(t){return t.length>1?t[Math.round(Math.random())]:t[0]},e.dice=function(){return!!Math.round(Math.random())},e.flat=function(t){return t.reduce((function(t,e){return t.concat(e)}),[])},e.errorHasMessage=function(t){return"string"==typeof t.message},e.convertChordToNotes=function(t){var e,n,o,i;try{e=(0,r.inlineChord)(t)}catch(t){o=t}try{n=(0,r.chord)(t.replace(/_/g," "))}catch(t){i=t}if(!o&&!i){if(e.toString()!==n.toString())throw new Error("Chord ".concat(t," cannot decode, guessing ").concat(e," or ").concat(n));return e}return o?i?(0,r.chord)(t):n:e},e.convertChordsToNotes=function(t){if("string"==typeof t&&(0,e.isNote)(t))return[t];if(Array.isArray(t))return t.forEach((function(t){if(Array.isArray(t))t.forEach((function(t){if("string"!=typeof t||!(0,e.isNote)(t))throw new TypeError("array of arrays must comprise valid notes")}));else if("string"!=typeof t||!(0,e.isNote)(t))throw new TypeError("array must comprise valid notes")})),t;if(!Array.isArray(t)){var n=(0,e.convertChordToNotes)(t);if(n&&n.length)return n}throw new Error("Chord ".concat(t," not found"))},e.randomInt=function(t){return void 0===t&&(t=1),Math.round(Math.random()*t)}},231:t=>{"use strict";t.exports=require("fs")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};(()=>{"use strict";var t=r;Object.defineProperty(t,"__esModule",{value:!0});var e=n(397),o=n(378),i=n(668),a=n(148),s=n(267),c=n(484),u=e.scale,l=e.scales,p={scale:e.scale,mode:u,scales:e.scales,modes:l,chord:e.chord,chords:e.chords,clip:o.clip,getChordDegrees:i.getChordDegrees,getChordsByProgression:i.getChordsByProgression,progression:i.progression,arp:a.arp,midi:s.midi,Session:c.Session};t.default=p})();var o=exports;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
2
|
+
//# sourceMappingURL=browser.js.map
|