builds successfully, still messy around module import. bandaid fix

This commit is contained in:
Mikayla Dobson
2022-05-11 11:22:57 -05:00
parent 6fa7760d0f
commit e28b2176ee
6 changed files with 23 additions and 8 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

8
app.ts
View File

@@ -1,9 +1,11 @@
import * as Tone from 'tone';
// initialize four synth voices // initialize four synth voices
// @ts-expect-error: namespace, Tone, for all of the following "expect-error calls"
const soprano = new Tone.Synth().toDestination(); const soprano = new Tone.Synth().toDestination();
// @ts-expect-error
const alto = new Tone.Synth().toDestination(); const alto = new Tone.Synth().toDestination();
// @ts-expect-error
const tenor = new Tone.Synth().toDestination(); const tenor = new Tone.Synth().toDestination();
// @ts-expect-error
const bass = new Tone.Synth().toDestination(); const bass = new Tone.Synth().toDestination();
// test function for audio is armed // test function for audio is armed
@@ -26,6 +28,7 @@ export const soundChord = (pitches: string[]) => {
// set up transport // set up transport
const transportStart = document.getElementById('transport-start'); const transportStart = document.getElementById('transport-start');
// @ts-expect-error
const loop = new Tone.Loop((time) => { const loop = new Tone.Loop((time) => {
audioTest(); audioTest();
}, "8n").start(0); }, "8n").start(0);
@@ -33,5 +36,6 @@ const loop = new Tone.Loop((time) => {
loop.probability = 0.8; loop.probability = 0.8;
transportStart.onclick = () => { transportStart.onclick = () => {
// @ts-expect-error
Tone.Transport.start(); Tone.Transport.start();
} }

View File

@@ -119,5 +119,12 @@
<script type="module" src="https://unpkg.com/tone@14.7.77/build/Tone.js"></script> <script type="module" src="https://unpkg.com/tone@14.7.77/build/Tone.js"></script>
<!-- internal scripts --> <!-- internal scripts -->
<script type="module" src="./built/app.js"></script> <script type="module" src="./built/app.js"></script>
<script type="module" src="./built/src/audioUtils.js"></script>
<script type="module" src="./built/src/harmonyUtil.js"></script>
<script type="module" src="./built/src/inputHandling.js"></script>
<script type="module" src="./built/src/styleUtils.js"></script>
<script type="module" src="./built/src/vector_logic/evaluateVector.js"></script>
<script type="module" src="./built/src/vector_logic/extractPitchset.js"></script>
<script type="module" src="./built/src/vector_logic/findVector.js"></script>
</body> </body>
</html> </html>

View File

@@ -1,5 +1,3 @@
import * as Tone from 'tone';
export const startButton = document.getElementById("start-tone"); export const startButton = document.getElementById("start-tone");
export const synthButton = document.getElementById("synth-button"); export const synthButton = document.getElementById("synth-button");
@@ -26,6 +24,7 @@ showMore.onclick = () => {
} }
startButton.onclick = async () => { startButton.onclick = async () => {
// @ts-expect-error - namespace again, failed import from Tone
await Tone.start() await Tone.start()
.then(() => { .then(() => {
appReady = true; appReady = true;

View File

@@ -1,4 +1,4 @@
import { musicalPitches } from "../harmonyUtil"; import { musicalPitches } from "../harmonyUtil.js";
export const extractPitchset = (pitches: string[]) => { export const extractPitchset = (pitches: string[]) => {
// 1) determine pitch set from given array of pitches // 1) determine pitch set from given array of pitches

View File

@@ -2,9 +2,14 @@
"compilerOptions": { "compilerOptions": {
"outDir": "./built", "outDir": "./built",
"allowJs": true, "allowJs": true,
"target": "es2017", "target": "es2018",
"module": "CommonJS", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "node",
}, },
"include": ["./src/**/*", "./app"] "include": [
"./src/**/*", "./app"
],
"exclude": [
"/_tone"
]
} }