@werckmeister/components 1.1.3 → 1.1.6-101
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/IMidiEvent.d.ts +18 -0
- package/README.md +9 -5
- package/index.d.ts +60 -0
- package/index.js +492 -0
- package/libfluidsynth-2.0.2.js +5925 -0
- package/package.json +10 -9
- package/sfcompose.js +21 -0
- package/sfcompose.wasm +0 -0
- package/werckmeister-auxiliaries.json +1 -1
- package/werckmeister-components.js +47 -40
- package/werckmeister.js +1 -1
- package/werckmeister.wasm +0 -0
package/IMidiEvent.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const MidiEventTypes: {
|
|
2
|
+
NoteOn: number;
|
|
3
|
+
NoteOff: number;
|
|
4
|
+
Pc: number;
|
|
5
|
+
Cc: number;
|
|
6
|
+
PitchBend: number;
|
|
7
|
+
};
|
|
8
|
+
export interface IMidiEvent {
|
|
9
|
+
type: number;
|
|
10
|
+
noteName?: string;
|
|
11
|
+
channel: number;
|
|
12
|
+
track: number;
|
|
13
|
+
param1: number;
|
|
14
|
+
param2?: number;
|
|
15
|
+
playTime: number;
|
|
16
|
+
pitchbendValue?: number;
|
|
17
|
+
absPositionTicks?: number;
|
|
18
|
+
}
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A [web component](https://en.wikipedia.org/wiki/Web_Components) which allows you
|
|
|
7
7
|
* include the javascript file
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
|
-
<script src="https://unpkg.com/
|
|
10
|
+
<script src="https://unpkg.com/@werckmeister/components@1.1.6-41/werckmeister-components.js"></script>
|
|
11
11
|
```
|
|
12
12
|
* embed your snippet
|
|
13
13
|
|
|
@@ -29,7 +29,8 @@ instrument: lead;
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Demo
|
|
32
|
-
https://jsfiddle.net/
|
|
32
|
+
https://jsfiddle.net/z8qv5b7j/
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
## Options
|
|
35
36
|
|
|
@@ -37,14 +38,17 @@ https://jsfiddle.net/o8tq4ghp/
|
|
|
37
38
|
can be either `default` or `single`. `single` means that the input is treated as one singe voice line such as `c d e f g`.
|
|
38
39
|
In `default`mode the input has to be a valid `werckmeister` source.
|
|
39
40
|
|
|
40
|
-
https://jsfiddle.net/
|
|
41
|
+
https://jsfiddle.net/bh4ugc5q/
|
|
41
42
|
|
|
42
43
|
### `wm-tempo`
|
|
43
44
|
Set the tempo of an snippet.
|
|
44
45
|
### `wm-style`
|
|
45
46
|
Inline css rules to set up the apperance of the snippet.
|
|
46
|
-
https://jsfiddle.net/
|
|
47
|
+
https://jsfiddle.net/zxhgyv2p/
|
|
47
48
|
|
|
48
49
|
### `wm-css-url`
|
|
49
50
|
Set an url of an css file, to override the default css of the snippet.
|
|
50
|
-
https://jsfiddle.net/
|
|
51
|
+
https://jsfiddle.net/m01bzg3f/
|
|
52
|
+
|
|
53
|
+
### `wm-soundfont-url`
|
|
54
|
+
Set the repo url. See [Soundfont Server](https://github.com/werckme/soundfont-server).
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IMidiEvent } from "./IMidiEvent";
|
|
2
|
+
import { ISoundFont } from './SfCompose';
|
|
3
|
+
export declare enum PlayerState {
|
|
4
|
+
Stopped = 0,
|
|
5
|
+
Preparing = 1,
|
|
6
|
+
Playing = 2,
|
|
7
|
+
Stopping = 3
|
|
8
|
+
}
|
|
9
|
+
export interface Task {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TaskVisitor {
|
|
14
|
+
newTasks(tasks: Task[]): any;
|
|
15
|
+
done(task: Task): any;
|
|
16
|
+
}
|
|
17
|
+
export declare class WerckmeisterMidiPlayer {
|
|
18
|
+
private static instaces;
|
|
19
|
+
private instanceId;
|
|
20
|
+
private _playerState;
|
|
21
|
+
playedTime: number;
|
|
22
|
+
midifile: any;
|
|
23
|
+
private audioContext;
|
|
24
|
+
private events;
|
|
25
|
+
onPlayerStateChanged: (oldState: PlayerState, newState: PlayerState) => void;
|
|
26
|
+
onMidiEvent: (event: IMidiEvent) => void;
|
|
27
|
+
private sfComposer;
|
|
28
|
+
private _sfRepository;
|
|
29
|
+
private neededInstruments;
|
|
30
|
+
private midiBuffer;
|
|
31
|
+
soundFont: ISoundFont;
|
|
32
|
+
private soundFontHash;
|
|
33
|
+
private repoUrl;
|
|
34
|
+
private audioNodes;
|
|
35
|
+
rendererBufferSeconds: number;
|
|
36
|
+
gain: number;
|
|
37
|
+
constructor();
|
|
38
|
+
get ppq(): number;
|
|
39
|
+
private getSfRepository;
|
|
40
|
+
get playerState(): PlayerState;
|
|
41
|
+
set playerState(newState: PlayerState);
|
|
42
|
+
initAudioEnvironment(event: Event): Promise<void>;
|
|
43
|
+
private convertEvent;
|
|
44
|
+
private preprocessEvents;
|
|
45
|
+
private instrumentHash;
|
|
46
|
+
private instrumentsHash;
|
|
47
|
+
private getSoundfont;
|
|
48
|
+
private currentTaskVisitor;
|
|
49
|
+
load(base64MidiFileData: string, taskVisitor?: TaskVisitor | undefined): Promise<void>;
|
|
50
|
+
private sleepAsync;
|
|
51
|
+
play(): Promise<void>;
|
|
52
|
+
stop(): void;
|
|
53
|
+
private postWebworker;
|
|
54
|
+
private startPlayback;
|
|
55
|
+
setRepoUrl(url: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* fires the midi events parallel to the playback
|
|
58
|
+
*/
|
|
59
|
+
private startEventNotification;
|
|
60
|
+
}
|