Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jazz-soft/jzz-midi-sty

Yamaha-PSR styles
https://github.com/jazz-soft/jzz-midi-sty

midi style yamaha

Last synced: about 1 month ago
JSON representation

Yamaha-PSR styles

Awesome Lists containing this project

README

        

# JZZ-midi-STY
Yamaha-PSR styles

[![npm](https://img.shields.io/npm/v/jzz-midi-sty.svg)](https://www.npmjs.com/package/jzz-midi-sty)
[![npm](https://img.shields.io/npm/dt/jzz-midi-sty.svg)](https://www.npmjs.com/package/jzz-midi-sty)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/jzz-midi-sty/badge)](https://www.jsdelivr.com/package/npm/jzz-midi-sty)
[![build](https://github.com/jazz-soft/JZZ-midi-STY/actions/workflows/build.yml/badge.svg)](https://github.com/jazz-soft/JZZ-midi-STY/actions)
[![Coverage Status](https://coveralls.io/repos/github/jazz-soft/JZZ-midi-STY/badge.svg?branch=main)](https://coveralls.io/github/jazz-soft/JZZ-midi-STY?branch=main)

[Work-in-progress demo](https://jazz-soft.github.io/modules/sty/index.html)

## Install

`npm install jzz-midi-sty --save`
or `yarn add jzz-midi-sty`
or get the full development version and minified scripts from [**GitHub**](https://github.com/jazz-soft/JZZ-midi-STY)

## Usage

##### Plain HTML

```html

//...
```

##### CDN (jsdelivr)

```html

//...
```

##### CDN (unpkg)

```html

//...
```

##### CommonJS

```js
var JZZ = require('jzz');
require('jzz-midi-smf')(JZZ);
require('jzz-midi-sty')(JZZ);
//...
```

##### TypeScript / ES6

```ts
import { JZZ } from 'jzz';
import { SMF } from 'jzz-midi-smf';
import { STY } from 'jzz-midi-sty';
SMF(JZZ);
STY(JZZ);
//...
```

##### AMD

```js
require(['JZZ', 'JZZ.midi.SMF', 'JZZ.midi.STY'], function(JZZ, dummy1, dummy2) {
// ...
});
```

## Style files

##### Reading file

```js
var fs = require('fs');
var data = fs.readFileSync('my-style.sty', 'binary');
// data can be String, Buffer, ArrayBuffer, Uint8Array, Int8Array,
// or a JZZ.MIDI.SMF object
var sty = new JZZ.MIDI.STY(data);
```

##### Extracting MIDI tracks

```js
console.log('All style tracks:', sty.tracks());
// additional track names not reported by tracks() can be:
// '', 'SFF1', 'SFF2', 'OTSc1', 'OTSc2', 'OTSc3', 'OTSc4' (if present)
var smf = sty.export('Intro A'); // see JZZ.MIDI.SMF
fs.writeFileSync('intro-a.mid', smf.dump(), 'binary');
fs.writeFileSync('otsc1.mid', sty.export('OTSc1').dump(), 'binary');
```

##### Cleaning up

```js
// remove the OTSc section: it is not required
// unless you use it on a Yamaha keyboard (see the docs...)
delete sty.otsc;
// remove the FNRc section: it is not used for playback
// and in most cases contains garbage (see the docs...)
delete sty.fnrc;
```

##### Writing file

```js
fs.writeFileSync('new-style.sty', sty.dump(), 'binary');
```

## Some useful Style links
* http://wierzba.homepage.t-online.de/stylefiles_v101.pdf
* http://www.jososoft.dk/yamaha/articles/keyboard_and_style.pdf