# midi-json-parser
**This module is parsing midi files into a human-readable JSON object.**
[![tests](https://img.shields.io/travis/chrisguttandin/midi-json-parser/master.svg?style=flat-square)](https://travis-ci.org/chrisguttandin/midi-json-parser)
[![dependencies](https://img.shields.io/david/chrisguttandin/midi-json-parser.svg?style=flat-square)](https://www.npmjs.com/package/midi-json-parser)
[![version](https://img.shields.io/npm/v/midi-json-parser.svg?style=flat-square)](https://www.npmjs.com/package/midi-json-parser)
This module parses a binary MIDI file and turns it into a JSON representation. This JSON
representation can then be used to pass it on to the
[midi-player](https://github.com/chrisguttandin/midi-player). It can of course also be modified
to be encoded as binary MIDI file at some point again by using the
[json-midi-encoder](https://github.com/chrisguttandin/json-midi-encoder).
## Usage
This module is available on [npm](https://www.npmjs.com/package/midi-json-parser) and can be
installed by running the following command:
```shell
npm install midi-json-parser
```
Once the module is installed you can use its one and only function as shown in the example below:
```js
import { parseArrayBuffer } from 'midi-json-parser';
// Let's assume there is an ArrayBuffer called arrayBuffer which contains the binary content of a
// MIDI file.
parseArrayBuffer(arrayBuffer)
.then((json) => {
// json is the JSON representation of the MIDI file.
});
```
In case you are comfortable with TypeScript, this is the interface which describes the JSON
representation:
```typescript
interface IMidiFile {
division: number;
format: number;
tracks: TMidiEvent[][];
}
```
The type
[`TMidiEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/types/midi-event.ts)
is a union of all possible MIDI events. Here is the complete list of all MIDI events this module can handle:
- [`IMidiChannelPrefixEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-channel-prefix-event.ts)
- [`IMidiChannelPressureEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-channel-pressure-event.ts)
- [`IMidiControlChangeEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-control-change-event.ts)
- [`IMidiCopyrightNoticeEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-copyright-notice-event.ts)
- [`IMidiDeviceNameEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-device-name-event.ts)
- [`IMidiEndOfTrackEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-end-of-track-event.ts)
- [`IMidiInstrumentNameEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-instrument-name-event.ts)
- [`IMidiKeyPressureEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-key-pressure-event.ts)
- [`IMidiKeySignatureEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-key-signature-event.ts)
- [`IMidiLyricEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-lyric-event.ts)
- [`IMidiMarkerEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-marker-event.ts)
- [`IMidiMidiPortEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-midi-port-event.ts)
- [`IMidiNoteOffEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-note-off-event.ts)
- [`IMidiNoteOnEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-note-on-event.ts)
- [`IMidiPitchBendEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-pitch-bend-event.ts)
- [`IMidiProgramChangeEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-program-change-event.ts)
- [`IMidiProgramNameEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-program-name-event.ts)
- [`IMidiSequencerSpecificEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-sequencer-specific-event.ts)
- [`IMidiSetTempoEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-set-tempo-event.ts)
- [`IMidiSmpteOffsetEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-smpte-offset-event.ts)
- [`IMidiSysexEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-sysex-event.ts)
- [`IMidiTextEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-text-event.ts)
- [`IMidiTimeSignatureEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-time-signature-event.ts)
- [`IMidiTrackNameEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-track-name-event.ts)
- [`IMidiUnknownTextEvent`](https://github.com/chrisguttandin/midi-json-parser-worker/blob/master/src/interfaces/midi-unknown-text-event.ts)
## Acknowledgement
Developing this module wouldn't have been possible without all the great resources out there. The
following list tries to mention a few of them:
- A detailed specification of the MIDI file format as HTML: [Standard MIDI-File Format Spec. 1.1, updated](http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html) and PDF: [Standard MIDI-File Format Spec. 1.1, updated](http://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf)
- A brief description of the MIDI file format: [Outline of the Standard MIDI File Structure](http://www.ccarh.org/courses/253/handout/smf/)
- A blog post about the timing information in MIDI files: [Timing in MIDI files](http://sites.uci.edu/camp2014/2014/05/19/timing-in-midi-files/)
- An explanation of the concept called running status: [Running Status](http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/midispec/run.htm)
- Actually a documentation for a Python library, but it also contains extensive information on MIDI messages itself: [Mido - MIDI Objects for Python](http://mido.readthedocs.org/en/latest/index.html)
- Very detailed information on meta messages, but also on many other non MIDI related audio topics as well: [RecordingBlogs.com Wiki](http://www.recordingblogs.com/sa/tabid/88/Default.aspx?topic=MIDI+meta+messages)
- A JavaScript MIDI parser and synthesiser: [jasmid - A Javascript MIDI file reader and synthesiser](https://github.com/gasman/jasmid) and its excluded parser: [midi-file-parser](https://github.com/NHQ/midi-file-parser)
- A complete MIDI app which also contains a parser: [MIDI.js](https://github.com/mudcube/MIDI.js)
- A very similar parser but for Node.js only [MIDI Converter](https://github.com/mobyvb/midi-converter)
- A parser for converting MIDI into a JavaScript object which can also turn it back into a binary MIDI file again: [MIDIFile](https://github.com/nfroidure/MIDIFile)
没有合适的资源?快使用搜索试试~ 我知道了~
midi-json-parser:该模块将Midi文件解析为人类可读的JSON对象
共58个文件
json:23个
mid:15个
js:12个
5星 · 超过95%的资源 需积分: 31 6 下载量 106 浏览量
2021-04-18
23:58:17
上传
评论 1
收藏 682KB ZIP 举报
温馨提示
midi-json-parser 该模块将midi文件解析为人类可读的JSON对象。 此模块解析二进制MIDI文件,并将其转换为JSON表示形式。 然后可以使用此JSON表示将其传递给 。 当然,也可以通过使用将其修改为再次编码为二进制MIDI文件。 用法 该模块在上可用,可以通过运行以下命令进行安装: npm install midi-json-parser 一旦安装了模块,就可以使用其唯一功能,如下例所示: import { parseArrayBuffer } from 'midi-json-parser' ; // Let's assume there is an ArrayBuffer called arrayBuffer which contains the binary content of a // MIDI file. parseArrayBuffer ( ar
资源详情
资源评论
资源推荐
收起资源包目录
midi-json-parser-master.zip (58个子文件)
midi-json-parser-master
.travis.yml 2KB
gruntfile.js 222B
config
rollup
bundle.js 2KB
prettier
config.json 160B
karma
config-unit.js 3KB
eslint
src.json 90B
test.json 346B
config.json 176B
grunt
aliases.js 211B
webpack.js 2KB
clean.js 45B
sh.js 974B
replace.js 640B
tslint
src.json 46B
webpack
config.js 1KB
worker.js 34B
package.json 3KB
.github
workflows
test.yml 1KB
test
unit
module.js 3KB
helper
load-fixture.js 261B
fixtures
scale.json 36KB
MIDIOkFormat2.json 6KB
minute_waltz.json 719KB
98137.mid 48KB
TheEntertainer.json 1.03MB
MIDIOkFormat2.mid 270B
SubTractor 2.mid 2KB
TheEntertainer.mid 16KB
californication.mid 52KB
test.json 1011KB
rachmaninov3.json 9.03MB
californication.json 1.27MB
A_F_NO7_01.mid 3KB
minute_waltz.mid 17KB
MorozovS07.mid 14KB
rachmaninov3.mid 149KB
because.json 718KB
MorozovS07.json 315KB
scale.mid 845B
test8bars.mid 958B
because.mid 16KB
SubTractor 1.json 79KB
SubTractor 1.mid 2KB
98137.json 2.16MB
A_F_NO7_01.json 167KB
MIDIOkFormat1-lyrics.mid 131B
test.mid 15KB
SubTractor 2.json 78KB
MIDIOkFormat1-lyrics.json 3KB
test8bars.json 44KB
LICENSE 1KB
package-lock.json 568KB
src
worker
worker.ts 10KB
3rdpartylicenses.txt 144B
module.ts 602B
tsconfig.json 126B
.gitignore 32B
README.md 7KB
共 58 条
- 1
KingstonChang
- 粉丝: 42
- 资源: 4658
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1