midi-audio-player 1.0.3 → 1.1.1
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/README.md +19 -12
- package/dist/index.js +1610 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +7 -0
- package/dist/midi-audio-player.js +1607 -0
- package/dist/midi-audio-player.js.map +7 -0
- package/dist/midi-audio-player.min.js +18 -0
- package/dist/midi-audio-player.min.js.map +7 -0
- package/index.js +6 -1
- package/package.json +43 -9
- package/src/midiaudioplayer.js +18 -18
- package/src/webaudiofontplayer.js +31 -32
- /package/src/{defaultinstrument.json → presets/defaultpreset.json} +0 -0
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ A lightweight JavaScript MIDI audio player built on top of the Web Audio API usi
|
|
|
6
6
|
|
|
7
7
|
* MIDI file playback in modern browsers
|
|
8
8
|
* Built on the Web Audio API
|
|
9
|
-
* Uses WebAudioFont for
|
|
9
|
+
* Uses WebAudioFont for preset rendering
|
|
10
10
|
* Lightweight and dependency-minimal
|
|
11
11
|
* Simple programmatic API
|
|
12
|
-
* CLI tool for
|
|
12
|
+
* CLI tool for preset/font handling
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -24,13 +24,16 @@ npm install midi-audio-player
|
|
|
24
24
|
```js
|
|
25
25
|
import MidiAudioPlayer from 'midi-audio-player';
|
|
26
26
|
|
|
27
|
+
const response = await fetch('/examples/data/iwillsurvive.mid');
|
|
28
|
+
const buffer = await response.arrayBuffer();
|
|
29
|
+
|
|
27
30
|
const player = new MidiAudioPlayer({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
preset: presetData,
|
|
32
|
+
volume: 0.02,
|
|
33
|
+
onEndFile: async () => await this.playNextSong()
|
|
31
34
|
});
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
player.play(buffer);
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
### Control Playback
|
|
@@ -43,17 +46,17 @@ player.stop();
|
|
|
43
46
|
|
|
44
47
|
### Working with AudioContext
|
|
45
48
|
|
|
46
|
-
Due to browser autoplay restrictions, you should ensure that your AudioContext is resumed after a user interaction
|
|
49
|
+
Due to browser autoplay restrictions, you should ensure that your AudioContext is resumed after a user interaction.
|
|
47
50
|
|
|
48
51
|
## CLI
|
|
49
52
|
|
|
50
|
-
This package provides a CLI tool for downloading and converting WebAudioFont assets. You need to provide a WebAudioFont ID
|
|
53
|
+
This package provides a CLI tool for downloading and converting WebAudioFont assets. You need to provide a WebAudioFont ID and the json file for the destination.
|
|
51
54
|
|
|
52
55
|
```bash
|
|
53
|
-
webaudiofont 0000_Chaos_sf2_file dest/
|
|
56
|
+
webaudiofont 0000_Chaos_sf2_file dest/preset.json
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
You can find
|
|
59
|
+
You can find presets here: [WebAudioFont](https://github.com/surikov/webaudiofont#catalog-of-instruments)
|
|
57
60
|
|
|
58
61
|
## Browser Compatibility
|
|
59
62
|
|
|
@@ -81,6 +84,10 @@ Maxime Larrivée-Roy
|
|
|
81
84
|
|
|
82
85
|
[https://github.com/ZmotriN/midi-audio-player](https://github.com/ZmotriN/midi-audio-player)
|
|
83
86
|
|
|
84
|
-
---
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
## Changelog
|
|
89
|
+
|
|
90
|
+
### Version 1.1.0
|
|
91
|
+
* Complete refactor
|
|
92
|
+
* Optimized WebAudioFont handling
|
|
93
|
+
* Change instrument option to preset
|