Comparing version 0.1.3 to 0.1.4-dev.573785e
{ | ||
"name": "dittytoy", | ||
"version": "0.1.3", | ||
"version": "0.1.4-dev.573785e", | ||
"description": "", | ||
"keywords": [ | ||
"Web Audio", | ||
"Web Audio API", | ||
"Synthesis", | ||
"Playback", | ||
"Instrument", | ||
"Music", | ||
"DSP", | ||
"Signal Processing", | ||
"Generative Music", | ||
"Dittytoy", | ||
"music", | ||
"generative", | ||
"DSP", | ||
"audio", | ||
"Sonic Pi", | ||
"javascript", | ||
"Web Audio API" | ||
"Sonic Pi" | ||
], | ||
@@ -15,0 +18,0 @@ "repository": "git@github.com:reindernijhoff/dittytoy-package.git", |
# Dittytoy | ||
The dittytoy package is a powerful package that allows you to compile and play ditties | ||
from [Dittytoy.net](https://dittytoy.net), an online platform that allows you to create generative music using a | ||
minimalistic javascript API. | ||
Compile and play code (ditties) from [Dittytoy.net](https://dittytoy.net), an online platform that allows you to create generative music using a minimalistic javascript API. | ||
@@ -51,3 +49,3 @@ The API syntax of Dittytoy is loosely based on the syntax of [Sonic Pi](https://sonic-pi.net/tutorial.html). You can find the | ||
Note: most browsers only allow audio to be played after a user interaction. You should use the `play` method to start the | ||
Note: Most browsers only allow audio after a user interacts with it. You should use the `play` method to start the | ||
audio after a user interaction. | ||
@@ -68,6 +66,6 @@ | ||
Dittytoy emits events that you can listen to by subscribing to the `addEventListener` method. | ||
Dittytoy emits events you can listen to by subscribing to the `addEventListener` method. | ||
```ts | ||
dittytoy.addEventListener(MSG_PLAY, () => { | ||
dittytoy.addListener(MSG_PLAY, () => { | ||
console.log('Dittytoy starts playing'); | ||
@@ -82,7 +80,7 @@ }); | ||
```ts | ||
dittytoy.addEventListener(MSG_LOG, (data: any) => { | ||
dittytoy.addListener(MSG_LOG, (data: any) => { | ||
console.log(data.message); | ||
}); | ||
dittytoy.addEventListener(MSG_ERROR, (data: any) => { | ||
dittytoy.addListener(MSG_ERROR, (data: any) => { | ||
console.error(data.message); | ||
@@ -95,3 +93,3 @@ }); | ||
```ts | ||
dittytoy.addEventListener(MSG_INIT, (data:any) => { | ||
dittytoy.addListener(MSG_INIT, (data:any) => { | ||
console.log('Dittytoy is initialized, ready to play'); | ||
@@ -106,3 +104,3 @@ console.log('Structure of compiled ditty:', data.structure); | ||
```ts | ||
dittytoy.addEventListener(MSG_NOTE_PLAYED, (data:any) => { | ||
dittytoy.addListener(MSG_NOTE_PLAYED, (data:any) => { | ||
console.log(`♪ tick: ${data.tick.toFixed(3)}, note: ${data.note} (${data.loop}.${data.synth})`); | ||
@@ -122,12 +120,12 @@ }); | ||
```ts | ||
dittytoy.addEventListener(MSG_PLAY, () => { | ||
dittytoy.addListener(MSG_PLAY, () => { | ||
console.log('play'); | ||
}); | ||
dittytoy.addEventListener(MSG_PAUSE, () => { | ||
dittytoy.addListener(MSG_PAUSE, () => { | ||
console.log('pause'); | ||
}); | ||
dittytoy.addEventListener(MSG_STOP, () => { | ||
dittytoy.addListener(MSG_STOP, () => { | ||
console.log('stop'); | ||
}); | ||
dittytoy.addEventListener(MSG_RESUME, () => { | ||
dittytoy.addListener(MSG_RESUME, () => { | ||
console.log('resume'); | ||
@@ -134,0 +132,0 @@ }); |
161212
157