midifile-ts
Advanced tools
Comparing version 1.1.4 to 1.2.0
{ | ||
"semi": false | ||
} |
@@ -0,0 +0,0 @@ { |
{ | ||
"editor.formatOnSave": true | ||
} | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
} | ||
} |
@@ -163,2 +163,2 @@ interface Event<T extends string> { | ||
}; | ||
export { read, MidiFile, MidiHeader, write, serialize, deserialize, MIDIChannelEvents, MIDIControlEventNames, MIDIControlEvents, MIDIMetaEventNames, MIDIMetaEvents, StreamSource, Stream, Event, MetaEvent, SequenceNumberEvent, TextEvent, CopyrightNoticeEvent, TrackNameEvent, InstrumentNameEvent, LyricsEvent, MarkerEvent, CuePointEvent, ChannelPrefixEvent, PortPrefixEvent, EndOfTrackEvent, SetTempoEvent, SmpteOffsetEvent, TimeSignatureEvent, KeySignatureEvent, SequencerSpecificEvent, UnknownMetaEvent, ChannelEvent, NoteOffEvent, NoteOnEvent, NoteAftertouchEvent, ProgramChangeEvent, ChannelAftertouchEvent, PitchBendEvent, UnknownChannelEvent, ControllerEvent, SysExEvent, DividedSysExEvent, AnyEvent }; | ||
export { read, MidiFile, MidiHeader, write, serialize, deserialize, MIDIChannelEvents, MIDIControlEventNames, MIDIControlEvents, MIDIMetaEventNames, MIDIMetaEvents, StreamSource, Event, MetaEvent, SequenceNumberEvent, TextEvent, CopyrightNoticeEvent, TrackNameEvent, InstrumentNameEvent, LyricsEvent, MarkerEvent, CuePointEvent, ChannelPrefixEvent, PortPrefixEvent, EndOfTrackEvent, SetTempoEvent, SmpteOffsetEvent, TimeSignatureEvent, KeySignatureEvent, SequencerSpecificEvent, UnknownMetaEvent, ChannelEvent, NoteOffEvent, NoteOnEvent, NoteAftertouchEvent, ProgramChangeEvent, ChannelAftertouchEvent, PitchBendEvent, UnknownChannelEvent, ControllerEvent, SysExEvent, DividedSysExEvent, AnyEvent }; |
@@ -104,3 +104,3 @@ 'use strict'; | ||
subtype: "sequenceNumber", | ||
number: stream.readInt16() | ||
number: stream.readInt16(), | ||
}; | ||
@@ -112,3 +112,3 @@ case 0x01: | ||
subtype: "text", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -120,3 +120,3 @@ case 0x02: | ||
subtype: "copyrightNotice", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -128,3 +128,3 @@ case 0x03: | ||
subtype: "trackName", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -136,3 +136,3 @@ case 0x04: | ||
subtype: "instrumentName", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -144,3 +144,3 @@ case 0x05: | ||
subtype: "lyrics", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -152,3 +152,3 @@ case 0x06: | ||
subtype: "marker", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -160,3 +160,3 @@ case 0x07: | ||
subtype: "cuePoint", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
}; | ||
@@ -170,3 +170,3 @@ case 0x20: | ||
subtype: "midiChannelPrefix", | ||
channel: stream.readInt8() | ||
value: stream.readInt8(), | ||
}; | ||
@@ -180,3 +180,3 @@ case 0x21: | ||
subtype: "portPrefix", | ||
port: stream.readInt8() | ||
port: stream.readInt8(), | ||
}; | ||
@@ -189,3 +189,3 @@ case 0x2f: | ||
type: type, | ||
subtype: "endOfTrack" | ||
subtype: "endOfTrack", | ||
}; | ||
@@ -201,3 +201,3 @@ case 0x51: | ||
(stream.readInt8() << 8) + | ||
stream.readInt8() | ||
stream.readInt8(), | ||
}; | ||
@@ -212,3 +212,3 @@ case 0x54: { | ||
0x40: 29, | ||
0x60: 30 | ||
0x60: 30, | ||
}; | ||
@@ -224,3 +224,3 @@ return { | ||
frame: stream.readInt8(), | ||
subframe: stream.readInt8() | ||
subframe: stream.readInt8(), | ||
}; | ||
@@ -238,3 +238,3 @@ } | ||
metronome: stream.readInt8(), | ||
thirtyseconds: stream.readInt8() | ||
thirtyseconds: stream.readInt8(), | ||
}; | ||
@@ -249,3 +249,3 @@ case 0x59: | ||
key: stream.readInt8(true), | ||
scale: stream.readInt8() | ||
scale: stream.readInt8(), | ||
}; | ||
@@ -257,3 +257,3 @@ case 0x7f: | ||
subtype: "sequencerSpecific", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
}; | ||
@@ -265,3 +265,3 @@ default: | ||
subtype: "unknown", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
}; | ||
@@ -275,3 +275,3 @@ } | ||
type: "sysEx", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
}; | ||
@@ -284,3 +284,3 @@ } | ||
type: "dividedSysEx", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
}; | ||
@@ -317,3 +317,3 @@ } | ||
noteNumber: param1, | ||
velocity: stream.readInt8() | ||
velocity: stream.readInt8(), | ||
}; | ||
@@ -328,3 +328,3 @@ case 0x09: { | ||
noteNumber: param1, | ||
velocity: velocity | ||
velocity: velocity, | ||
}; | ||
@@ -339,3 +339,3 @@ } | ||
noteNumber: param1, | ||
amount: stream.readInt8() | ||
amount: stream.readInt8(), | ||
}; | ||
@@ -349,3 +349,3 @@ case 0x0b: | ||
controllerType: param1, | ||
value: stream.readInt8() | ||
value: stream.readInt8(), | ||
}; | ||
@@ -358,3 +358,3 @@ case 0x0c: | ||
subtype: "programChange", | ||
value: param1 | ||
value: param1, | ||
}; | ||
@@ -367,3 +367,3 @@ case 0x0d: | ||
subtype: "channelAftertouch", | ||
amount: param1 | ||
amount: param1, | ||
}; | ||
@@ -376,3 +376,3 @@ case 0x0e: | ||
subtype: "pitchBend", | ||
value: param1 + (stream.readInt8() << 7) | ||
value: param1 + (stream.readInt8() << 7), | ||
}; | ||
@@ -385,3 +385,3 @@ default: | ||
subtype: "unknown", | ||
data: stream.readInt8() | ||
data: stream.readInt8(), | ||
}; | ||
@@ -504,16 +504,2 @@ } | ||
// variable-length quantity | ||
function toVLQ(intNum) { | ||
var v = intNum; | ||
var r = [v & 0x7f]; | ||
while (true) { | ||
v >>= 7; | ||
if (v === 0) { | ||
break; | ||
} | ||
r.unshift(0x80 + (v & 0x7f)); | ||
} | ||
return r; | ||
} | ||
var MIDIChannelEvents = { | ||
@@ -548,2 +534,16 @@ noteOff: 0x08, | ||
// variable-length quantity | ||
function toVLQ(intNum) { | ||
var v = intNum; | ||
var r = [v & 0x7f]; | ||
while (true) { | ||
v >>= 7; | ||
if (v === 0) { | ||
break; | ||
} | ||
r.unshift(0x80 + (v & 0x7f)); | ||
} | ||
return r; | ||
} | ||
function serialize(e, includeDeltaTime) { | ||
@@ -608,3 +608,3 @@ if (includeDeltaTime === void 0) { includeDeltaTime = true; } | ||
case "midiChannelPrefix": | ||
addNumbers([e.channel]); | ||
addNumbers([e.value]); | ||
break; | ||
@@ -631,3 +631,3 @@ case "portPrefix": | ||
e.metronome, | ||
e.thirtyseconds | ||
e.thirtyseconds, | ||
]); | ||
@@ -905,3 +905,2 @@ break; | ||
exports.MIDIMetaEvents = MIDIMetaEvents; | ||
exports.Stream = Stream; | ||
exports.deserialize = deserialize; | ||
@@ -911,1 +910,2 @@ exports.read = read; | ||
exports.write = write; | ||
//# sourceMappingURL=index.js.map |
@@ -0,0 +0,0 @@ module.exports = { |
{ | ||
"name": "midifile-ts", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -22,10 +22,11 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "26.0.19", | ||
"@types/node": "14.14.14", | ||
"@wessberg/rollup-plugin-ts": "1.3.8", | ||
"jest": "^26.6.3", | ||
"rollup": "2.35.1", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "4.1.3" | ||
"@rollup/plugin-typescript": "^8.2.5", | ||
"@types/jest": "27.0.1", | ||
"@types/node": "16.7.5", | ||
"jest": "^27.1.0", | ||
"rollup": "2.56.3", | ||
"ts-jest": "^27.0.5", | ||
"tslib": "^2.3.1", | ||
"typescript": "4.4.2" | ||
} | ||
} |
@@ -0,0 +0,0 @@ [![npm version](https://badge.fury.io/js/midifile-ts.svg)](https://badge.fury.io/js/midifile-ts) [![Actions Status](https://github.com/ryohey/midifile-ts/workflows/CI/badge.svg?branch=master)](https://github.com/ryohey/midifile-ts/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) |
@@ -1,2 +0,2 @@ | ||
import ts from "@wessberg/rollup-plugin-ts" | ||
import typescript from "@rollup/plugin-typescript" | ||
@@ -7,5 +7,6 @@ export default { | ||
file: "dist/index.js", | ||
format: "cjs" | ||
format: "cjs", | ||
sourcemap: true, | ||
}, | ||
plugins: [ts()] | ||
plugins: [typescript()], | ||
} |
@@ -0,0 +0,0 @@ import { toCharCodes } from "./toCharCodes" |
@@ -0,0 +0,0 @@ export const MIDIChannelEvents: { [key: string]: number } = { |
@@ -0,0 +0,0 @@ export const MIDIControlEventNames = [ |
@@ -0,0 +0,0 @@ export const MIDIControlEvents: { [key: string]: number } = { |
@@ -0,0 +0,0 @@ export const MIDIMetaEventNames: { [key: number]: string } = { |
@@ -0,0 +0,0 @@ export const MIDIMetaEvents: { [key: string]: number } = { |
import { | ||
SequenceNumberEvent, | ||
TextEvent, | ||
AnyEvent, | ||
ChannelAftertouchEvent, | ||
ChannelPrefixEvent, | ||
ControllerEvent, | ||
CopyrightNoticeEvent, | ||
TrackNameEvent, | ||
CuePointEvent, | ||
DividedSysExEvent, | ||
EndOfTrackEvent, | ||
InstrumentNameEvent, | ||
KeySignatureEvent, | ||
LyricsEvent, | ||
MarkerEvent, | ||
CuePointEvent, | ||
ChannelPrefixEvent, | ||
NoteAftertouchEvent, | ||
NoteOffEvent, | ||
NoteOnEvent, | ||
PitchBendEvent, | ||
PortPrefixEvent, | ||
EndOfTrackEvent, | ||
ProgramChangeEvent, | ||
SequenceNumberEvent, | ||
SequencerSpecificEvent, | ||
SetTempoEvent, | ||
SmpteOffsetEvent, | ||
SysExEvent, | ||
TextEvent, | ||
TimeSignatureEvent, | ||
KeySignatureEvent, | ||
SequencerSpecificEvent, | ||
TrackNameEvent, | ||
UnknownChannelEvent, | ||
UnknownMetaEvent, | ||
SysExEvent, | ||
DividedSysExEvent, | ||
NoteOffEvent, | ||
NoteOnEvent, | ||
NoteAftertouchEvent, | ||
ControllerEvent, | ||
ProgramChangeEvent, | ||
ChannelAftertouchEvent, | ||
PitchBendEvent, | ||
UnknownChannelEvent, | ||
AnyEvent | ||
} from "./event" | ||
@@ -57,3 +57,3 @@ import { Stream } from "./stream" | ||
subtype: "sequenceNumber", | ||
number: stream.readInt16() | ||
number: stream.readInt16(), | ||
} | ||
@@ -65,3 +65,3 @@ case 0x01: | ||
subtype: "text", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -73,3 +73,3 @@ case 0x02: | ||
subtype: "copyrightNotice", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -81,3 +81,3 @@ case 0x03: | ||
subtype: "trackName", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -89,3 +89,3 @@ case 0x04: | ||
subtype: "instrumentName", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -97,3 +97,3 @@ case 0x05: | ||
subtype: "lyrics", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -105,3 +105,3 @@ case 0x06: | ||
subtype: "marker", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -113,3 +113,3 @@ case 0x07: | ||
subtype: "cuePoint", | ||
text: stream.readStr(length) | ||
text: stream.readStr(length), | ||
} | ||
@@ -125,3 +125,3 @@ case 0x20: | ||
subtype: "midiChannelPrefix", | ||
channel: stream.readInt8() | ||
value: stream.readInt8(), | ||
} | ||
@@ -137,3 +137,3 @@ case 0x21: | ||
subtype: "portPrefix", | ||
port: stream.readInt8() | ||
port: stream.readInt8(), | ||
} | ||
@@ -148,3 +148,3 @@ case 0x2f: | ||
type, | ||
subtype: "endOfTrack" | ||
subtype: "endOfTrack", | ||
} | ||
@@ -163,3 +163,3 @@ case 0x51: | ||
(stream.readInt8() << 8) + | ||
stream.readInt8() | ||
stream.readInt8(), | ||
} | ||
@@ -176,3 +176,3 @@ case 0x54: { | ||
0x40: 29, | ||
0x60: 30 | ||
0x60: 30, | ||
} | ||
@@ -188,3 +188,3 @@ return <SmpteOffsetEvent>{ | ||
frame: stream.readInt8(), | ||
subframe: stream.readInt8() | ||
subframe: stream.readInt8(), | ||
} | ||
@@ -204,3 +204,3 @@ } | ||
metronome: stream.readInt8(), | ||
thirtyseconds: stream.readInt8() | ||
thirtyseconds: stream.readInt8(), | ||
} | ||
@@ -217,3 +217,3 @@ case 0x59: | ||
key: stream.readInt8(true), | ||
scale: stream.readInt8() | ||
scale: stream.readInt8(), | ||
} | ||
@@ -225,3 +225,3 @@ case 0x7f: | ||
subtype: "sequencerSpecific", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
} | ||
@@ -233,3 +233,3 @@ default: | ||
subtype: "unknown", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
} | ||
@@ -242,3 +242,3 @@ } | ||
type: "sysEx", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
} | ||
@@ -250,3 +250,3 @@ } else if (eventTypeByte === 0xf7) { | ||
type: "dividedSysEx", | ||
data: stream.read(length) | ||
data: stream.read(length), | ||
} | ||
@@ -280,3 +280,3 @@ } else { | ||
noteNumber: param1, | ||
velocity: stream.readInt8() | ||
velocity: stream.readInt8(), | ||
} | ||
@@ -291,3 +291,3 @@ case 0x09: { | ||
noteNumber: param1, | ||
velocity: velocity | ||
velocity: velocity, | ||
} | ||
@@ -302,3 +302,3 @@ } | ||
noteNumber: param1, | ||
amount: stream.readInt8() | ||
amount: stream.readInt8(), | ||
} | ||
@@ -312,3 +312,3 @@ case 0x0b: | ||
controllerType: param1, | ||
value: stream.readInt8() | ||
value: stream.readInt8(), | ||
} | ||
@@ -321,3 +321,3 @@ case 0x0c: | ||
subtype: "programChange", | ||
value: param1 | ||
value: param1, | ||
} | ||
@@ -330,3 +330,3 @@ case 0x0d: | ||
subtype: "channelAftertouch", | ||
amount: param1 | ||
amount: param1, | ||
} | ||
@@ -339,3 +339,3 @@ case 0x0e: | ||
subtype: "pitchBend", | ||
value: param1 + (stream.readInt8() << 7) | ||
value: param1 + (stream.readInt8() << 7), | ||
} | ||
@@ -348,3 +348,3 @@ default: | ||
subtype: "unknown", | ||
data: stream.readInt8() | ||
data: stream.readInt8(), | ||
} | ||
@@ -351,0 +351,0 @@ } |
@@ -45,3 +45,3 @@ export interface Event<T extends string> { | ||
export interface ChannelPrefixEvent extends MetaEvent<"midiChannelPrefix"> { | ||
channel: number | ||
value: number | ||
} | ||
@@ -48,0 +48,0 @@ |
@@ -10,3 +10,3 @@ export { read, MidiFile, MidiHeader } from "./read" | ||
export { MIDIMetaEvents } from "./constants/MIDIMetaEvents" | ||
export { StreamSource, Stream } from "./stream" | ||
export { StreamSource } from "./stream" | ||
export * from "./event" |
@@ -0,0 +0,0 @@ import assert from "assert" |
@@ -0,0 +0,0 @@ import { AnyEvent } from "./event" |
@@ -0,0 +0,0 @@ import assert from "assert" |
@@ -1,6 +0,6 @@ | ||
import { toVLQ } from "./vlq" | ||
import { toCharCodes } from "./toCharCodes" | ||
import { MIDIChannelEvents } from "./constants/MIDIChannelEvents" | ||
import { MIDIMetaEvents } from "./constants/MIDIMetaEvents" | ||
import { AnyEvent } from "./event" | ||
import { toCharCodes } from "./toCharCodes" | ||
import { toVLQ } from "./vlq" | ||
@@ -31,3 +31,3 @@ function assertUnreachable(x: never): never { | ||
add(list.length) | ||
list.forEach(v => add(v)) | ||
list.forEach((v) => add(v)) | ||
} | ||
@@ -74,3 +74,3 @@ | ||
case "midiChannelPrefix": | ||
addNumbers([e.channel]) | ||
addNumbers([e.value]) | ||
break | ||
@@ -97,3 +97,3 @@ case "portPrefix": | ||
e.metronome, | ||
e.thirtyseconds | ||
e.thirtyseconds, | ||
]) | ||
@@ -100,0 +100,0 @@ break |
@@ -0,0 +0,0 @@ import assert from "assert" |
@@ -0,0 +0,0 @@ export type StreamSource = |
@@ -0,0 +0,0 @@ export function toCharCodes(str: string): number[] { |
@@ -0,0 +0,0 @@ import assert from "assert" |
@@ -0,0 +0,0 @@ // variable-length quantity |
@@ -0,0 +0,0 @@ import assert from "assert" |
@@ -0,0 +0,0 @@ import { AnyEvent } from "./event" |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148742
35
2287
8