start packaging
This commit is contained in:
parent
a19d789145
commit
6f60a3a1d5
98 changed files with 11162 additions and 11122 deletions
603
packages/tone/package-lock.json
generated
Normal file
603
packages/tone/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,603 @@
|
|||
{
|
||||
"name": "@strudel/tone",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@strudel/tone",
|
||||
"version": "0.0.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@tonejs/piano": "^0.2.1",
|
||||
"chord-voicings": "^0.0.1",
|
||||
"tone": "^14.7.77"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.17.8",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.8.tgz",
|
||||
"integrity": "sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/abc-notation": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/abc-notation/-/abc-notation-4.6.5.tgz",
|
||||
"integrity": "sha512-1S0Jnx0NfDLgyhkQOMEHqOacELL6RUdPcWWUP+nAnsOsb9owvB9RKYLSzp5odd16FVUR7U8c/JLc2yxIRvSeJw==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/array": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/array/-/array-4.6.5.tgz",
|
||||
"integrity": "sha512-7A3DbBQ+qIQ134FqE518b4tJ8V2a15Sn303JjHzgnqZqKrNh/s3wqwkL60F7LKcd09tcp+vIKQP/MYt4xMcRAA==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/chord": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord/-/chord-4.6.5.tgz",
|
||||
"integrity": "sha512-Pjdel4aDVv4kcx9PW6Qozt5BB9nAt13AOExfzKztpgPmlBSy0SKHse7Jp1cA4MGAuLHU8dzVssTFYpCskEFw3w==",
|
||||
"dependencies": {
|
||||
"@tonaljs/chord-detect": "^4.6.5",
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/chord-detect": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord-detect/-/chord-detect-4.6.5.tgz",
|
||||
"integrity": "sha512-4xu53UP4kNTfdTNpAAVijhXcQ+ypJqmeMnsST08ZXSjoYfJUhmf5rWDWfz36KOTtNdCA6AbYgdtTYV/Xw0nd/w==",
|
||||
"dependencies": {
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/chord-type": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord-type/-/chord-type-4.6.5.tgz",
|
||||
"integrity": "sha512-Ol4DDopqpZCF9odosO2i8I+plud3Ul7VWJGNvL+PPCf4Qnwuz87q3aJQDLNoRUz4VyW0u66mq3LyVh6A8kb6Ug==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/collection": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/collection/-/collection-4.6.2.tgz",
|
||||
"integrity": "sha512-bfPCotLJNB/tG1NrdbsQPLDKZB5jlMs7uPQ6RYKiNkaena3345ZKkbCGl5pj6YTXeDm/oblXiSbFAn7SlLRZdQ=="
|
||||
},
|
||||
"node_modules/@tonaljs/core": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/core/-/core-4.6.5.tgz",
|
||||
"integrity": "sha512-t7Vx0+L3j/ubQj2AhI1H45D/K745np4DwJjJjXNi5FlGD+TL2wyw50dCwkHKGHsrLDqup1qqP6yN7LBpC6UwNg=="
|
||||
},
|
||||
"node_modules/@tonaljs/duration-value": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/duration-value/-/duration-value-4.6.2.tgz",
|
||||
"integrity": "sha512-zrXT0L/qsDQ6251Mlqz54vcUbYUB9xb6uJhlxUzc6VauXOt8UOfrdTULubRTXTaBwWt1h8J5n9pXTQmNGzNI9A=="
|
||||
},
|
||||
"node_modules/@tonaljs/interval": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/interval/-/interval-4.6.5.tgz",
|
||||
"integrity": "sha512-7EDWhqZ7Nnh9oD4ahRYJHLc799ACGxYL4hDHwMKD16B2MgXqPvDeDvwQ31qUuO0ruGz8tMb3FDlgg0Hplowcbw==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/key": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/key/-/key-4.6.5.tgz",
|
||||
"integrity": "sha512-ZdZWb5IStx6CLRmdEjawR66CqNpoW3EVUua2nVZBMdgnNebWxt4nvgH/ZNvGlCQGFZkUZzRhCfTwqsS6e3OmSA==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/midi": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/midi/-/midi-4.6.5.tgz",
|
||||
"integrity": "sha512-fJEZtNvV3M6yW1w+Tep60Rbv5PvuKszQcQzaJS1Loq5mHOKAzdmRfuJSpEpZBiaKEZ1WAMh1QKXYyOd+imyGQg==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/mode": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/mode/-/mode-4.6.5.tgz",
|
||||
"integrity": "sha512-54iaON1rJ6q8fV5iuei8RGDxYhKBGGxZz3rjAxGSqdTUwBRVOdPqtzOkofThf9gRGYOMhzPp1BMbxbV+UCAPsA==",
|
||||
"dependencies": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/interval": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/note": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/note/-/note-4.6.5.tgz",
|
||||
"integrity": "sha512-Y0/eTzcReXzfcSLLG4k/dLLayqbvh/XYIkybG/QMDyR0BREuJq0Sw+NavbzhTtO0dadIQb/qfe0GFq4k2xS+NQ==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/midi": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/pcset": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/pcset/-/pcset-4.6.5.tgz",
|
||||
"integrity": "sha512-oWAKflP3cREnUfScqsBzg2LLKNevxSnpDtrq8CPtwOAsrAa8PjQG07NQfhqIiFMjPUdgkDiER3qVA1n8dDwAJA==",
|
||||
"dependencies": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/progression": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/progression/-/progression-4.6.5.tgz",
|
||||
"integrity": "sha512-ijYEgMFQG4izHYUw5cRtBRNBuoYzmpGvb/tRiykhJNI6XIjekZEMiMsOMfb1u5q+EGvnVNXRmrluMRDIz2rmRw==",
|
||||
"dependencies": {
|
||||
"@tonaljs/chord": "^4.6.5",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/range": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/range/-/range-4.6.5.tgz",
|
||||
"integrity": "sha512-99cOvVJ3l4X0UJuTSa6qE87JriREnnWIsi3xo1/n7RoqFxnfi8YPh4SfJJyysvHcT18X4EfcTNde9ancMBVu6A==",
|
||||
"dependencies": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/midi": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/roman-numeral": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/roman-numeral/-/roman-numeral-4.6.5.tgz",
|
||||
"integrity": "sha512-bWYQNZWKmYDDcmbQQNwcWAHfTWanpzmvI0wplrMnGd4x0op5etwUEv+Yzjg0B1ef+E+zcU02Sl0WwRJhaDK3hg==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/scale": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/scale/-/scale-4.6.5.tgz",
|
||||
"integrity": "sha512-isYDamelOBtcd5bEnJ8QV0Js7jKRwZ0FlFVE/+bUN3wsyo9u6KLL5gMyfH9RKdx74m8lE13JXYTXgKqe+AOa4A==",
|
||||
"dependencies": {
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/scale-type": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/scale-type/-/scale-type-4.6.5.tgz",
|
||||
"integrity": "sha512-rwcDOYf2UifjLJhmuQ8f8bJSeOCMDQJ1lB7lzlqdFxes03OeQhdOEfrT0nPtW8BhBEvq4GMM2NA6CLxX8MTwOQ==",
|
||||
"dependencies": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonaljs/time-signature": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/time-signature/-/time-signature-4.6.2.tgz",
|
||||
"integrity": "sha512-OlZY4gdLd21WpMeAI1nS9E9zWcYU6oAzh6ptAUndqmVnFIrIWIWKCkWapdFx8dWdqrX8jqya3m4T33wmeo7w5Q=="
|
||||
},
|
||||
"node_modules/@tonaljs/tonal": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/tonal/-/tonal-4.6.5.tgz",
|
||||
"integrity": "sha512-lmsWinI9dy7nQyzCEgDVeVAwJtsk4ey05cJZd6oa4QVuSFD+CR8ebaEiwT4/Na+W0kHrKicT3h0uYc2PJIvx5Q==",
|
||||
"dependencies": {
|
||||
"@tonaljs/abc-notation": "^4.6.5",
|
||||
"@tonaljs/array": "^4.6.5",
|
||||
"@tonaljs/chord": "^4.6.5",
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/duration-value": "^4.6.2",
|
||||
"@tonaljs/interval": "^4.6.5",
|
||||
"@tonaljs/key": "^4.6.5",
|
||||
"@tonaljs/midi": "^4.6.5",
|
||||
"@tonaljs/mode": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/progression": "^4.6.5",
|
||||
"@tonaljs/range": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5",
|
||||
"@tonaljs/scale": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5",
|
||||
"@tonaljs/time-signature": "^4.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tonejs/piano": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@tonejs/piano/-/piano-0.2.1.tgz",
|
||||
"integrity": "sha512-JIwZ91RSFR7Rt16o7cA7O7G30wenFl0lY5yhTsuwZmn48MO9KV+X7kyXE98Bqvs/dCBVg9PoAJ1GKMabPOW4yQ==",
|
||||
"dependencies": {
|
||||
"tslib": "^1.11.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tone": "^14.6.1",
|
||||
"webmidi": "^2.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/automation-events": {
|
||||
"version": "4.0.14",
|
||||
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.14.tgz",
|
||||
"integrity": "sha512-CB2Me0yW8sz7gSGwMiSfgfs1Oqlgs53k+eVESN6axvRyMAD3zlSp2nqndD2TQAtW3yOtSEJWNGsw0r48+f1wtw==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.1"
|
||||
}
|
||||
},
|
||||
"node_modules/automation-events/node_modules/tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/chord-voicings": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chord-voicings/-/chord-voicings-0.0.1.tgz",
|
||||
"integrity": "sha512-SutgB/4ynkkuiK6qdQ/k3QvCFcH0Vj8Ch4t6LbRyRQbVzP/TOztiCk3kvXd516UZ6fqk7ijDRELEFcKN+6V8sA==",
|
||||
"dependencies": {
|
||||
"@tonaljs/tonal": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"node_modules/standardized-audio-context": {
|
||||
"version": "25.3.21",
|
||||
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.21.tgz",
|
||||
"integrity": "sha512-CZEnayJJjNefeU+z1QGDhaid1LAAYxWYa2ipNk75ropwec9rq6fmclyhXb1wGtDsZ402irX3HLt1U/PwP9+1fA==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"automation-events": "^4.0.14",
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/standardized-audio-context/node_modules/tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/tone": {
|
||||
"version": "14.7.77",
|
||||
"resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz",
|
||||
"integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==",
|
||||
"dependencies": {
|
||||
"standardized-audio-context": "^25.1.8",
|
||||
"tslib": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/tone/node_modules/tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
|
||||
},
|
||||
"node_modules/webmidi": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/webmidi/-/webmidi-2.5.3.tgz",
|
||||
"integrity": "sha512-PyMGvKcDGpvbQUfnmBORQJciyG3VAZ4aHlGy1iRZ3uEs4kG4HCvI7KRthUpM1vuHDPL98lidRIUaoRomkJtWtg==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">0.6.x"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.17.8",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.8.tgz",
|
||||
"integrity": "sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
},
|
||||
"@tonaljs/abc-notation": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/abc-notation/-/abc-notation-4.6.5.tgz",
|
||||
"integrity": "sha512-1S0Jnx0NfDLgyhkQOMEHqOacELL6RUdPcWWUP+nAnsOsb9owvB9RKYLSzp5odd16FVUR7U8c/JLc2yxIRvSeJw==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/array": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/array/-/array-4.6.5.tgz",
|
||||
"integrity": "sha512-7A3DbBQ+qIQ134FqE518b4tJ8V2a15Sn303JjHzgnqZqKrNh/s3wqwkL60F7LKcd09tcp+vIKQP/MYt4xMcRAA==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/chord": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord/-/chord-4.6.5.tgz",
|
||||
"integrity": "sha512-Pjdel4aDVv4kcx9PW6Qozt5BB9nAt13AOExfzKztpgPmlBSy0SKHse7Jp1cA4MGAuLHU8dzVssTFYpCskEFw3w==",
|
||||
"requires": {
|
||||
"@tonaljs/chord-detect": "^4.6.5",
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/chord-detect": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord-detect/-/chord-detect-4.6.5.tgz",
|
||||
"integrity": "sha512-4xu53UP4kNTfdTNpAAVijhXcQ+ypJqmeMnsST08ZXSjoYfJUhmf5rWDWfz36KOTtNdCA6AbYgdtTYV/Xw0nd/w==",
|
||||
"requires": {
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/chord-type": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/chord-type/-/chord-type-4.6.5.tgz",
|
||||
"integrity": "sha512-Ol4DDopqpZCF9odosO2i8I+plud3Ul7VWJGNvL+PPCf4Qnwuz87q3aJQDLNoRUz4VyW0u66mq3LyVh6A8kb6Ug==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/collection": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/collection/-/collection-4.6.2.tgz",
|
||||
"integrity": "sha512-bfPCotLJNB/tG1NrdbsQPLDKZB5jlMs7uPQ6RYKiNkaena3345ZKkbCGl5pj6YTXeDm/oblXiSbFAn7SlLRZdQ=="
|
||||
},
|
||||
"@tonaljs/core": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/core/-/core-4.6.5.tgz",
|
||||
"integrity": "sha512-t7Vx0+L3j/ubQj2AhI1H45D/K745np4DwJjJjXNi5FlGD+TL2wyw50dCwkHKGHsrLDqup1qqP6yN7LBpC6UwNg=="
|
||||
},
|
||||
"@tonaljs/duration-value": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/duration-value/-/duration-value-4.6.2.tgz",
|
||||
"integrity": "sha512-zrXT0L/qsDQ6251Mlqz54vcUbYUB9xb6uJhlxUzc6VauXOt8UOfrdTULubRTXTaBwWt1h8J5n9pXTQmNGzNI9A=="
|
||||
},
|
||||
"@tonaljs/interval": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/interval/-/interval-4.6.5.tgz",
|
||||
"integrity": "sha512-7EDWhqZ7Nnh9oD4ahRYJHLc799ACGxYL4hDHwMKD16B2MgXqPvDeDvwQ31qUuO0ruGz8tMb3FDlgg0Hplowcbw==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/key": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/key/-/key-4.6.5.tgz",
|
||||
"integrity": "sha512-ZdZWb5IStx6CLRmdEjawR66CqNpoW3EVUua2nVZBMdgnNebWxt4nvgH/ZNvGlCQGFZkUZzRhCfTwqsS6e3OmSA==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/midi": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/midi/-/midi-4.6.5.tgz",
|
||||
"integrity": "sha512-fJEZtNvV3M6yW1w+Tep60Rbv5PvuKszQcQzaJS1Loq5mHOKAzdmRfuJSpEpZBiaKEZ1WAMh1QKXYyOd+imyGQg==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/mode": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/mode/-/mode-4.6.5.tgz",
|
||||
"integrity": "sha512-54iaON1rJ6q8fV5iuei8RGDxYhKBGGxZz3rjAxGSqdTUwBRVOdPqtzOkofThf9gRGYOMhzPp1BMbxbV+UCAPsA==",
|
||||
"requires": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/interval": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/note": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/note/-/note-4.6.5.tgz",
|
||||
"integrity": "sha512-Y0/eTzcReXzfcSLLG4k/dLLayqbvh/XYIkybG/QMDyR0BREuJq0Sw+NavbzhTtO0dadIQb/qfe0GFq4k2xS+NQ==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/midi": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/pcset": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/pcset/-/pcset-4.6.5.tgz",
|
||||
"integrity": "sha512-oWAKflP3cREnUfScqsBzg2LLKNevxSnpDtrq8CPtwOAsrAa8PjQG07NQfhqIiFMjPUdgkDiER3qVA1n8dDwAJA==",
|
||||
"requires": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/progression": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/progression/-/progression-4.6.5.tgz",
|
||||
"integrity": "sha512-ijYEgMFQG4izHYUw5cRtBRNBuoYzmpGvb/tRiykhJNI6XIjekZEMiMsOMfb1u5q+EGvnVNXRmrluMRDIz2rmRw==",
|
||||
"requires": {
|
||||
"@tonaljs/chord": "^4.6.5",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/range": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/range/-/range-4.6.5.tgz",
|
||||
"integrity": "sha512-99cOvVJ3l4X0UJuTSa6qE87JriREnnWIsi3xo1/n7RoqFxnfi8YPh4SfJJyysvHcT18X4EfcTNde9ancMBVu6A==",
|
||||
"requires": {
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/midi": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/roman-numeral": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/roman-numeral/-/roman-numeral-4.6.5.tgz",
|
||||
"integrity": "sha512-bWYQNZWKmYDDcmbQQNwcWAHfTWanpzmvI0wplrMnGd4x0op5etwUEv+Yzjg0B1ef+E+zcU02Sl0WwRJhaDK3hg==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/scale": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/scale/-/scale-4.6.5.tgz",
|
||||
"integrity": "sha512-isYDamelOBtcd5bEnJ8QV0Js7jKRwZ0FlFVE/+bUN3wsyo9u6KLL5gMyfH9RKdx74m8lE13JXYTXgKqe+AOa4A==",
|
||||
"requires": {
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/scale-type": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/scale-type/-/scale-type-4.6.5.tgz",
|
||||
"integrity": "sha512-rwcDOYf2UifjLJhmuQ8f8bJSeOCMDQJ1lB7lzlqdFxes03OeQhdOEfrT0nPtW8BhBEvq4GMM2NA6CLxX8MTwOQ==",
|
||||
"requires": {
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"@tonaljs/time-signature": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/time-signature/-/time-signature-4.6.2.tgz",
|
||||
"integrity": "sha512-OlZY4gdLd21WpMeAI1nS9E9zWcYU6oAzh6ptAUndqmVnFIrIWIWKCkWapdFx8dWdqrX8jqya3m4T33wmeo7w5Q=="
|
||||
},
|
||||
"@tonaljs/tonal": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@tonaljs/tonal/-/tonal-4.6.5.tgz",
|
||||
"integrity": "sha512-lmsWinI9dy7nQyzCEgDVeVAwJtsk4ey05cJZd6oa4QVuSFD+CR8ebaEiwT4/Na+W0kHrKicT3h0uYc2PJIvx5Q==",
|
||||
"requires": {
|
||||
"@tonaljs/abc-notation": "^4.6.5",
|
||||
"@tonaljs/array": "^4.6.5",
|
||||
"@tonaljs/chord": "^4.6.5",
|
||||
"@tonaljs/chord-type": "^4.6.5",
|
||||
"@tonaljs/collection": "^4.6.2",
|
||||
"@tonaljs/core": "^4.6.5",
|
||||
"@tonaljs/duration-value": "^4.6.2",
|
||||
"@tonaljs/interval": "^4.6.5",
|
||||
"@tonaljs/key": "^4.6.5",
|
||||
"@tonaljs/midi": "^4.6.5",
|
||||
"@tonaljs/mode": "^4.6.5",
|
||||
"@tonaljs/note": "^4.6.5",
|
||||
"@tonaljs/pcset": "^4.6.5",
|
||||
"@tonaljs/progression": "^4.6.5",
|
||||
"@tonaljs/range": "^4.6.5",
|
||||
"@tonaljs/roman-numeral": "^4.6.5",
|
||||
"@tonaljs/scale": "^4.6.5",
|
||||
"@tonaljs/scale-type": "^4.6.5",
|
||||
"@tonaljs/time-signature": "^4.6.2"
|
||||
}
|
||||
},
|
||||
"@tonejs/piano": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@tonejs/piano/-/piano-0.2.1.tgz",
|
||||
"integrity": "sha512-JIwZ91RSFR7Rt16o7cA7O7G30wenFl0lY5yhTsuwZmn48MO9KV+X7kyXE98Bqvs/dCBVg9PoAJ1GKMabPOW4yQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.11.1"
|
||||
}
|
||||
},
|
||||
"automation-events": {
|
||||
"version": "4.0.14",
|
||||
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.14.tgz",
|
||||
"integrity": "sha512-CB2Me0yW8sz7gSGwMiSfgfs1Oqlgs53k+eVESN6axvRyMAD3zlSp2nqndD2TQAtW3yOtSEJWNGsw0r48+f1wtw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"chord-voicings": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chord-voicings/-/chord-voicings-0.0.1.tgz",
|
||||
"integrity": "sha512-SutgB/4ynkkuiK6qdQ/k3QvCFcH0Vj8Ch4t6LbRyRQbVzP/TOztiCk3kvXd516UZ6fqk7ijDRELEFcKN+6V8sA==",
|
||||
"requires": {
|
||||
"@tonaljs/tonal": "^4.6.5"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"standardized-audio-context": {
|
||||
"version": "25.3.21",
|
||||
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.21.tgz",
|
||||
"integrity": "sha512-CZEnayJJjNefeU+z1QGDhaid1LAAYxWYa2ipNk75ropwec9rq6fmclyhXb1wGtDsZ402irX3HLt1U/PwP9+1fA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"automation-events": "^4.0.14",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"tone": {
|
||||
"version": "14.7.77",
|
||||
"resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz",
|
||||
"integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==",
|
||||
"requires": {
|
||||
"standardized-audio-context": "^25.1.8",
|
||||
"tslib": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
|
||||
},
|
||||
"webmidi": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/webmidi/-/webmidi-2.5.3.tgz",
|
||||
"integrity": "sha512-PyMGvKcDGpvbQUfnmBORQJciyG3VAZ4aHlGy1iRZ3uEs4kG4HCvI7KRthUpM1vuHDPL98lidRIUaoRomkJtWtg==",
|
||||
"peer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
32
packages/tone/package.json
Normal file
32
packages/tone/package.json
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "@strudel/tone",
|
||||
"version": "0.0.1",
|
||||
"description": "Tone.js API for strudel",
|
||||
"main": "tone.mjs",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "mocha --colors"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tidalcycles/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
"algorave"
|
||||
],
|
||||
"author": "Felix Roos <flix91@gmail.com>",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||
},
|
||||
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
||||
"dependencies": {
|
||||
"@tonejs/piano": "^0.2.1",
|
||||
"chord-voicings": "^0.0.1",
|
||||
"tone": "^14.7.77"
|
||||
}
|
||||
}
|
||||
12
packages/tone/test/tone.test.mjs
Normal file
12
packages/tone/test/tone.test.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { strict as assert } from 'assert';
|
||||
import '../tone.mjs';
|
||||
import { pure } from '../../core/strudel.mjs';
|
||||
import Tone from 'tone';
|
||||
|
||||
describe('tone', () => {
|
||||
it('Should have working tone function', () => {
|
||||
const s = synth().chain(out());
|
||||
assert.deepStrictEqual(s, new Tone.Synth().chain(out()));
|
||||
assert.deepStrictEqual(pure('c3').tone(s)._firstCycleValues, ['c3']);
|
||||
});
|
||||
});
|
||||
275
packages/tone/tone.mjs
Normal file
275
packages/tone/tone.mjs
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
import { Pattern as _Pattern } from '../core/strudel.mjs';
|
||||
import Tone from 'tone';
|
||||
const {
|
||||
AutoFilter,
|
||||
Destination,
|
||||
Filter,
|
||||
Gain,
|
||||
isNote,
|
||||
Synth,
|
||||
PolySynth,
|
||||
MembraneSynth,
|
||||
MetalSynth,
|
||||
MonoSynth,
|
||||
AMSynth,
|
||||
DuoSynth,
|
||||
FMSynth,
|
||||
NoiseSynth,
|
||||
PluckSynth,
|
||||
Sampler,
|
||||
getDestination,
|
||||
Players,
|
||||
} = Tone;
|
||||
/* import tonePiano from '@tonejs/piano';
|
||||
const { Piano } = tonePiano; */
|
||||
import { getPlayableNoteValue } from '../../packages/core/util.mjs';
|
||||
|
||||
// "balanced" | "interactive" | "playback";
|
||||
// Tone.setContext(new Tone.Context({ latencyHint: 'playback', lookAhead: 1 }));
|
||||
export const defaultSynth = new PolySynth().chain(new Gain(0.5), getDestination());
|
||||
defaultSynth.set({
|
||||
oscillator: { type: 'triangle' },
|
||||
envelope: {
|
||||
release: 0.01,
|
||||
},
|
||||
});
|
||||
|
||||
// what about
|
||||
// https://www.charlie-roberts.com/gibberish/playground/
|
||||
|
||||
const Pattern = _Pattern;
|
||||
|
||||
// with this function, you can play the pattern with any tone synth
|
||||
Pattern.prototype.tone = function (instrument) {
|
||||
// instrument.toDestination();
|
||||
return this._withEvent((event) => {
|
||||
const onTrigger = (time, event) => {
|
||||
let note;
|
||||
let velocity = event.context?.velocity ?? 0.75;
|
||||
switch (instrument.constructor.name) {
|
||||
case 'PluckSynth':
|
||||
note = getPlayableNoteValue(event);
|
||||
instrument.triggerAttack(note, time);
|
||||
break;
|
||||
case 'NoiseSynth':
|
||||
instrument.triggerAttackRelease(event.duration, time); // noise has no value
|
||||
break;
|
||||
case 'Piano':
|
||||
note = getPlayableNoteValue(event);
|
||||
instrument.keyDown({ note, time, velocity });
|
||||
instrument.keyUp({ note, time: time + event.duration, velocity });
|
||||
break;
|
||||
case 'Sampler':
|
||||
note = getPlayableNoteValue(event);
|
||||
instrument.triggerAttackRelease(note, event.duration, time, velocity);
|
||||
break;
|
||||
case 'Players':
|
||||
if (!instrument.has(event.value)) {
|
||||
throw new Error(`name "${event.value}" not defined for players`);
|
||||
}
|
||||
const player = instrument.player(event.value);
|
||||
// velocity ?
|
||||
player.start(time);
|
||||
player.stop(time + event.duration);
|
||||
break;
|
||||
default:
|
||||
note = getPlayableNoteValue(event);
|
||||
instrument.triggerAttackRelease(note, event.duration, time, velocity);
|
||||
}
|
||||
};
|
||||
return event.setContext({ ...event.context, instrument, onTrigger });
|
||||
});
|
||||
};
|
||||
|
||||
Pattern.prototype.define('tone', (type, pat) => pat.tone(type), { composable: true, patternified: false });
|
||||
|
||||
// synth helpers
|
||||
export const amsynth = (options) => new AMSynth(options);
|
||||
export const duosynth = (options) => new DuoSynth(options);
|
||||
export const fmsynth = (options) => new FMSynth(options);
|
||||
export const membrane = (options) => new MembraneSynth(options);
|
||||
export const metal = (options) => new MetalSynth(options);
|
||||
export const monosynth = (options) => new MonoSynth(options);
|
||||
export const noise = (options) => new NoiseSynth(options);
|
||||
export const pluck = (options) => new PluckSynth(options);
|
||||
export const polysynth = (options) => new PolySynth(options);
|
||||
export const sampler = (options, baseUrl) =>
|
||||
new Promise((resolve) => {
|
||||
const s = new Sampler(options, () => resolve(s), baseUrl);
|
||||
});
|
||||
export const players = (options, baseUrl = '') => {
|
||||
options = !baseUrl
|
||||
? options
|
||||
: Object.fromEntries(Object.entries(options).map(([key, value]) => [key, baseUrl + value]));
|
||||
return new Promise((resolve) => {
|
||||
const s = new Players(options, () => resolve(s));
|
||||
});
|
||||
};
|
||||
export const synth = (options) => new Synth(options);
|
||||
/* export const piano = async (options = { velocities: 1 }) => {
|
||||
const p = new Piano(options);
|
||||
await p.load();
|
||||
return p;
|
||||
}; */
|
||||
|
||||
// effect helpers
|
||||
export const vol = (v) => new Gain(v);
|
||||
export const lowpass = (v) => new Filter(v, 'lowpass');
|
||||
export const highpass = (v) => new Filter(v, 'highpass');
|
||||
export const adsr = (a, d = 0.1, s = 0.4, r = 0.01) => ({ envelope: { attack: a, decay: d, sustain: s, release: r } });
|
||||
export const osc = (type) => ({ oscillator: { type } });
|
||||
export const out = () => getDestination();
|
||||
|
||||
/*
|
||||
|
||||
You are entering experimental zone
|
||||
|
||||
*/
|
||||
|
||||
// the following code is an attempt to minimize tonejs code.. it is still an experiment
|
||||
|
||||
const chainable = function (instr) {
|
||||
const _chain = instr.chain.bind(instr);
|
||||
let chained = [];
|
||||
instr.chain = (...args) => {
|
||||
chained = chained.concat(args);
|
||||
instr.disconnect(); // disconnect from destination / previous chain
|
||||
return _chain(...chained, getDestination());
|
||||
};
|
||||
// shortcuts: chaining multiple won't work forn now.. like filter(1000).gain(0.5). use chain + native Tone calls instead
|
||||
// instr.filter = (freq = 1000, type: BiquadFilterType = 'lowpass') =>
|
||||
instr.filter = (freq = 1000, type = 'lowpass') =>
|
||||
instr.chain(
|
||||
new Filter(freq, type), // .Q.setValueAtTime(q, time);
|
||||
);
|
||||
instr.gain = (gain = 0.9) => instr.chain(new Gain(gain));
|
||||
return instr;
|
||||
};
|
||||
|
||||
// helpers
|
||||
export const poly = (type) => {
|
||||
const s = new PolySynth(Synth, { oscillator: { type } }).toDestination();
|
||||
return chainable(s);
|
||||
};
|
||||
|
||||
Pattern.prototype._poly = function (type = 'triangle') {
|
||||
const instrumentConfig = {
|
||||
oscillator: { type },
|
||||
envelope: { attack: 0.01, decay: 0.01, sustain: 0.6, release: 0.01 },
|
||||
};
|
||||
if (!this.instrument) {
|
||||
// create only once to keep the js heap happy
|
||||
// this.instrument = new PolySynth(Synth, instrumentConfig).toDestination();
|
||||
this.instrument = poly(type);
|
||||
}
|
||||
return this._withEvent((event) => {
|
||||
const onTrigger = (time, event) => {
|
||||
this.instrument.set(instrumentConfig);
|
||||
this.instrument.triggerAttackRelease(event.value, event.duration, time);
|
||||
};
|
||||
return event.setContext({ ...event.context, instrumentConfig, onTrigger });
|
||||
});
|
||||
};
|
||||
|
||||
Pattern.prototype.define('poly', (type, pat) => pat.poly(type), { composable: true, patternified: true });
|
||||
|
||||
/*
|
||||
|
||||
You are entering danger zone
|
||||
|
||||
*/
|
||||
|
||||
// everything below is nice in theory, but not healthy for the JS heap, as nodes get recreated on every call
|
||||
|
||||
const getTrigger = (getChain, value) => (time, event) => {
|
||||
const chain = getChain(); // make sure this returns a node that is connected toDestination // time
|
||||
if (!isNote(value)) {
|
||||
throw new Error('not a note: ' + value);
|
||||
}
|
||||
chain.triggerAttackRelease(value, event.duration, time);
|
||||
setTimeout(() => {
|
||||
// setTimeout is a little bit better compared to Transport.scheduleOnce
|
||||
chain.dispose(); // mark for garbage collection
|
||||
}, event.duration * 2000);
|
||||
};
|
||||
|
||||
Pattern.prototype._synth = function (type = 'triangle') {
|
||||
return this._withEvent((event) => {
|
||||
const instrumentConfig = {
|
||||
oscillator: { type },
|
||||
envelope: { attack: 0.01, decay: 0.01, sustain: 0.6, release: 0.01 },
|
||||
};
|
||||
const getInstrument = () => {
|
||||
const instrument = new Synth();
|
||||
instrument.set(instrumentConfig);
|
||||
return instrument;
|
||||
};
|
||||
const onTrigger = getTrigger(() => getInstrument().toDestination(), event.value);
|
||||
return event.setContext({ ...event.context, getInstrument, instrumentConfig, onTrigger });
|
||||
});
|
||||
};
|
||||
|
||||
Pattern.prototype.adsr = function (attack = 0.01, decay = 0.01, sustain = 0.6, release = 0.01) {
|
||||
return this._withEvent((event) => {
|
||||
if (!event.context.getInstrument) {
|
||||
throw new Error('cannot chain adsr: need instrument first (like synth)');
|
||||
}
|
||||
const instrumentConfig = { ...event.context.instrumentConfig, envelope: { attack, decay, sustain, release } };
|
||||
const getInstrument = () => {
|
||||
const instrument = event.context.getInstrument();
|
||||
instrument.set(instrumentConfig);
|
||||
return instrument;
|
||||
};
|
||||
const onTrigger = getTrigger(() => getInstrument().toDestination(), event.value);
|
||||
return event.setContext({ ...event.context, getInstrument, instrumentConfig, onTrigger });
|
||||
});
|
||||
};
|
||||
|
||||
Pattern.prototype.chain = function (...effectGetters) {
|
||||
return this._withEvent((event) => {
|
||||
if (!event.context?.getInstrument) {
|
||||
throw new Error('cannot chain: need instrument first (like synth)');
|
||||
}
|
||||
const chain = (event.context.chain || []).concat(effectGetters);
|
||||
const getChain = () => {
|
||||
const effects = chain.map((getEffect) => getEffect());
|
||||
return event.context.getInstrument().chain(...effects, getDestination());
|
||||
};
|
||||
const onTrigger = getTrigger(getChain, event.value);
|
||||
return event.setContext({ ...event.context, getChain, onTrigger, chain });
|
||||
});
|
||||
};
|
||||
|
||||
export const autofilter =
|
||||
(freq = 1) =>
|
||||
() =>
|
||||
new AutoFilter(freq).start();
|
||||
|
||||
export const filter =
|
||||
// (freq = 1, q = 1, type: BiquadFilterType = 'lowpass') =>
|
||||
|
||||
|
||||
(freq = 1, q = 1, type = 'lowpass') =>
|
||||
() =>
|
||||
new Filter(freq, type); // .Q.setValueAtTime(q, time);
|
||||
|
||||
export const gain =
|
||||
(gain = 0.9) =>
|
||||
() =>
|
||||
new Gain(gain);
|
||||
|
||||
Pattern.prototype._gain = function (g) {
|
||||
return this.chain(gain(g));
|
||||
};
|
||||
// Pattern.prototype._filter = function (freq: number, q: number, type: BiquadFilterType = 'lowpass') {
|
||||
Pattern.prototype._filter = function (freq, q, type = 'lowpass') {
|
||||
return this.chain(filter(freq, q, type));
|
||||
};
|
||||
Pattern.prototype._autofilter = function (g) {
|
||||
return this.chain(autofilter(g));
|
||||
};
|
||||
|
||||
Pattern.prototype.define('synth', (type, pat) => pat.synth(type), { composable: true, patternified: true });
|
||||
Pattern.prototype.define('gain', (gain, pat) => pat.synth(gain), { composable: true, patternified: true });
|
||||
Pattern.prototype.define('filter', (cutoff, pat) => pat.filter(cutoff), { composable: true, patternified: true });
|
||||
Pattern.prototype.define('autofilter', (cutoff, pat) => pat.filter(cutoff), { composable: true, patternified: true });
|
||||
Loading…
Add table
Add a link
Reference in a new issue