Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SleepyLGod committed Nov 2, 2022
1 parent d3d80fc commit 0c41be9
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions OmgSimplePlayer/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# ♬ OmgSimplePlayer
<h3 align="center">
<img src="https://readme-typing-svg.herokuapp.com/?font=Roboto+Mono&size=25&width=350&color=46BEA3duration=1600&lines=🎵Omg+Simple+Player🎶" height="80"/></br>
A JS applet reading standard MIDI files, emits JSON events in real time and plays them in the browser.
</h3>

**OmgSimplePlayer** is a JavaScript applet which reads standard MIDI files, emits JSON events in real time, and then converts the events and play them in the web page.
## ⚡ Getting Started
Create a new player by instantiating `MidiPlayer.Player` with an event handler to be called for every MIDI event, then you can load and play a MIDI file.

## Getting Started
Using MidiWriterJS is pretty simple.

Using MidiWriterJS is pretty simple. Create a new player by instantiating `MidiPlayer.Player` with an event handler to be called for every MIDI event. Then you can load and play a MIDI file.

```js
```javascript
const MidiPlayer = require('midi-player-js');

// Initialize player and register event handler
Expand All @@ -19,11 +21,13 @@ Player.loadFile('./test.mid');
Player.play();
```

## Player Events
## 🎼 Player Events

There are a handful of events on the `Player` object which you can subscribe to using the `Player.on()` method.

There are a handful of events on the `Player` object which you can subscribe to using the `Player.on()` method. Some events pass data as the first argument of the callback as described below:
Some events pass data as the first argument of the callback as described below:

```js
```javascript
Player.on('fileLoaded', function() {
// Do something when file is loaded
});
Expand All @@ -45,9 +49,9 @@ Player.on('endOfFile', function() {

Note that because of a common practice called "running status" many MIDI files may use `Note on` events with `0` velocity in place of `Note off` events.

## Full Documentation
## 📕 Full Documentation & Resources

[**Doc on my lark**](https://cao8drqmwu.feishu.cn/docx/AMq0djEQSoxPWNxjWM4cL6uBnOf "文档链接")
[**&#9836; Doc on my lark**](https://cao8drqmwu.feishu.cn/docx/AMq0djEQSoxPWNxjWM4cL6uBnOf "文档链接")

[Some test midi files](https://www.midishow.com/en/midi/5506.html "免费midi")

Expand Down

0 comments on commit 0c41be9

Please sign in to comment.