Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

midimal

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midimal - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

4

lib/utils.js

@@ -30,3 +30,3 @@ var Levenshtein = require('levenshtein');

var props = {
channel: 0,
channel: -1,
key: 0,

@@ -276,3 +276,3 @@ velocity: 63,

id: 0,
channel: 0,
channel: -1,
isPercussion: false

@@ -279,0 +279,0 @@ };

@@ -44,2 +44,5 @@ var var_length_buffer = require(__dirname+'/utils.js').var_length_buffer;

var beats_per_minute = 120;
var ticks_per_beat = 60000/beats_per_minute; //All time-deltas are in miliseconds
function MIDImalWriter(stream) {

@@ -56,6 +59,8 @@ var _this = this;

stream.write(tracks);
stream.write(new Buffer([0xE7, 0x28])); //All time-deltas are in miliseconds
var timing = new Buffer(2);
timing.writeUInt16BE(ticks_per_beat, 0);
stream.write(timing);
};
var writeTrack = function(track) {
var totalLength = 0;
var totalLength = 4;
var buffers = [];

@@ -74,2 +79,3 @@ track.forEach(function(event) {

});
stream.write(new Buffer([0x00, 0xFF, 0x2F, 0x00])); //End-of-track event
};

@@ -80,2 +86,3 @@

var percussionInstrument = null;
var trackNumber = _this.tracks.length;
_this.tracks.push(track);

@@ -91,6 +98,6 @@

notes.forEach(function(note_info) {
if(note_info.note.toVal) {
note_info.note = note_info.note.toVal();
}
if(percussionInstrument !== null) {
if(note_info.note.toVal) {
note_info.note = note_info.note.toVal();
}
if(!note_info.note.force) {

@@ -100,2 +107,7 @@ note_info.note.key = percussionInstrument;

note_info.note.channel = 9;
} else if(note_info.note.channel === -1) {
note_info.note.channel = trackNumber%15;
if(note_info.note.channel >= 9) {
note_info.note.channel++;
}
}

@@ -121,2 +133,5 @@ absolutePosition += note_info.delta; //Absolutize deltas to make the events sortable

}
if(instrument.channel === -1) {
instrument.channel = trackNumber%16;
}
if(instrument.isPercussion) {

@@ -123,0 +138,0 @@ percussionInstrument = instrument.id;

@@ -6,3 +6,3 @@ {

"keywords": ["midi", "audio"],
"version": "0.0.1",
"version": "0.0.2",
"repository": {

@@ -9,0 +9,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc