Updating zifferjs
This commit is contained in:
33
package-lock.json
generated
33
package-lock.json
generated
@ -21,7 +21,7 @@
|
|||||||
"postcss": "^8.4.27",
|
"postcss": "^8.4.27",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"tone": "^14.8.49",
|
"tone": "^14.8.49",
|
||||||
"zifferjs": "github:amiika/zifferjs",
|
"zifferjs": "file:../zifferjs",
|
||||||
"zzfx": "^1.2.0"
|
"zzfx": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -31,6 +31,22 @@
|
|||||||
"vite": "^4.4.5"
|
"vite": "^4.4.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../zifferjs": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/seedrandom": "^3.0.5",
|
||||||
|
"lru-cache": "^10.0.0",
|
||||||
|
"seedrandom": "^3.0.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitest/ui": "^0.34.1",
|
||||||
|
"peggy": "^3.0.2",
|
||||||
|
"ts-pegjs": "^4.2.1",
|
||||||
|
"typescript": "^5.0.2",
|
||||||
|
"vite": "^4.4.5",
|
||||||
|
"vitest": "^0.34.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@alloc/quick-lru": {
|
"node_modules/@alloc/quick-lru": {
|
||||||
"version": "5.2.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
|
||||||
@ -1438,14 +1454,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
||||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
|
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
|
||||||
},
|
},
|
||||||
"node_modules/lru-cache": {
|
|
||||||
"version": "10.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz",
|
|
||||||
"integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==",
|
|
||||||
"engines": {
|
|
||||||
"node": "14 || >=16.14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/merge2": {
|
"node_modules/merge2": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||||
@ -2099,11 +2107,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/zifferjs": {
|
"node_modules/zifferjs": {
|
||||||
"version": "0.0.0",
|
"resolved": "../zifferjs",
|
||||||
"resolved": "git+ssh://git@github.com/amiika/zifferjs.git#022a8297313c37402434ad728db38641442e4659",
|
"link": true
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^10.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/zzfx": {
|
"node_modules/zzfx": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
"postcss": "^8.4.27",
|
"postcss": "^8.4.27",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"tone": "^14.8.49",
|
"tone": "^14.8.49",
|
||||||
"zifferjs": "github:amiika/zifferjs",
|
"zifferjs": "file:../zifferjs",
|
||||||
"zzfx": "^1.2.0"
|
"zzfx": "^1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
src/API.ts
20
src/API.ts
@ -2,7 +2,7 @@ import { Editor } from "./main";
|
|||||||
import { scale } from './Scales';
|
import { scale } from './Scales';
|
||||||
import { tryEvaluate } from "./Evaluator";
|
import { tryEvaluate } from "./Evaluator";
|
||||||
import { MidiConnection } from "./IO/MidiConnection";
|
import { MidiConnection } from "./IO/MidiConnection";
|
||||||
import { next } from "zifferjs";
|
import { next, Pitch, Chord, Rest } from "zifferjs";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { webaudioOutput, samples } from '@strudel.cycles/webaudio';
|
import { webaudioOutput, samples } from '@strudel.cycles/webaudio';
|
||||||
@ -225,13 +225,23 @@ export class UserAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public zn(input: string, options: {[key: string]: any} = {}): void {
|
public zn(input: string, options: {[key: string]: any} = {}): void {
|
||||||
const node = next(input, options);
|
const node = next(input, options) as any;
|
||||||
const channel = options.channel ? options.channel : 0;
|
const channel = options.channel ? options.channel : 0;
|
||||||
const velocity = options.velocity ? options.velocity : 100;
|
const velocity = options.velocity ? options.velocity : 100;
|
||||||
const sustain = options.sustain ? options.sustain : 0.5;
|
const sustain = options.sustain ? options.sustain : 0.5;
|
||||||
if(node.bend) this.MidiConnection.sendPitchBend(node.bend, channel);
|
if(node instanceof Pitch) {
|
||||||
this.MidiConnection.sendMidiNote(node.note!, channel, velocity, sustain);
|
if(node.bend) this.MidiConnection.sendPitchBend(node.bend, channel);
|
||||||
if(node.bend) this.MidiConnection.sendPitchBend(8192, channel);
|
this.MidiConnection.sendMidiNote(node.note!, channel, velocity, sustain);
|
||||||
|
if(node.bend) this.MidiConnection.sendPitchBend(8192, channel);
|
||||||
|
} else if(node instanceof Chord) {
|
||||||
|
node.pitches.forEach(pitch => {
|
||||||
|
if(pitch.bend) this.MidiConnection.sendPitchBend(pitch.bend, channel);
|
||||||
|
this.MidiConnection.sendMidiNote(pitch.note!, channel, velocity, sustain);
|
||||||
|
if(pitch.bend) this.MidiConnection.sendPitchBend(8192, channel);
|
||||||
|
});
|
||||||
|
} else if(node instanceof Rest) {
|
||||||
|
// do nothing for now ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sysex(data: Array<number>): void {
|
public sysex(data: Array<number>): void {
|
||||||
|
|||||||
11
yarn.lock
11
yarn.lock
@ -634,11 +634,6 @@ lines-and-columns@^1.1.6:
|
|||||||
resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz"
|
resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz"
|
||||||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||||
|
|
||||||
lru-cache@^10.0.0:
|
|
||||||
version "10.0.1"
|
|
||||||
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz"
|
|
||||||
integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==
|
|
||||||
|
|
||||||
merge2@^1.3.0:
|
merge2@^1.3.0:
|
||||||
version "1.4.1"
|
version "1.4.1"
|
||||||
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz"
|
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz"
|
||||||
@ -993,11 +988,13 @@ yaml@^2.1.1:
|
|||||||
resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz"
|
resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz"
|
||||||
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
|
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
|
||||||
|
|
||||||
"zifferjs@github:amiika/zifferjs":
|
"zifferjs@file:../zifferjs":
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
resolved "git+ssh://git@github.com/amiika/zifferjs.git#022a8297313c37402434ad728db38641442e4659"
|
resolved "file:../zifferjs"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@types/seedrandom" "^3.0.5"
|
||||||
lru-cache "^10.0.0"
|
lru-cache "^10.0.0"
|
||||||
|
seedrandom "^3.0.5"
|
||||||
|
|
||||||
zzfx@^1.2.0:
|
zzfx@^1.2.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user