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

@magenta/music

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magenta/music - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

dist/.DS_Store

6

es5/core/chords.d.ts

@@ -7,3 +7,3 @@ import * as tf from '@tensorflow/tfjs-core';

Diminished = 3,
Other = 4,
Other = 4
}

@@ -30,3 +30,3 @@ export declare class ChordSymbolException extends Error {

depth: number;
private index(chord);
private index;
encode(chord: string): tf.Tensor<tf.Rank.R1>;

@@ -36,3 +36,3 @@ }

depth: number;
private index(chord);
private index;
encode(chord: string): tf.Tensor<tf.Rank.R1>;

@@ -39,0 +39,0 @@ }

@@ -19,1 +19,5 @@ export declare const DEFAULT_QUARTERS_PER_MINUTE = 120;

export declare const MAX_MIDI_PROGRAM = 127;
export declare const LO_CLICK_PITCH = 89;
export declare const HI_CLICK_PITCH = 90;
export declare const LO_CLICK_CLASS = 9;
export declare const HI_CLICK_CLASS = 10;

@@ -22,2 +22,6 @@ "use strict";

exports.MAX_MIDI_PROGRAM = 127;
exports.LO_CLICK_PITCH = 89;
exports.HI_CLICK_PITCH = 90;
exports.LO_CLICK_CLASS = 9;
exports.HI_CLICK_CLASS = 10;
//# sourceMappingURL=constants.js.map

@@ -37,6 +37,6 @@ import * as tf from '@tensorflow/tfjs-core';

readonly numSegments: number;
readonly abstract depth: number;
readonly abstract endTensor: tf.Tensor1D;
readonly abstract NUM_SPLITS: number;
readonly abstract SEGMENTED_BY_TRACK: boolean;
abstract readonly depth: number;
abstract readonly endTensor: tf.Tensor1D;
abstract readonly NUM_SPLITS: number;
abstract readonly SEGMENTED_BY_TRACK: boolean;
abstract toTensor(noteSequence: INoteSequence): tf.Tensor2D;

@@ -127,6 +127,6 @@ abstract toNoteSequence(tensor: tf.Tensor2D, stepsPerQuarter: number): Promise<INoteSequence>;

constructor(args: MultitrackConverterArgs);
private trackToTensor(track?);
private trackToTensor;
toTensor(noteSequence: INoteSequence): tf.Tensor<tf.Rank.R2>;
private tokensToTrack(tokens);
private tokensToTrack;
toNoteSequence(oh: tf.Tensor2D, stepsPerQuarter?: number): Promise<NoteSequence>;
}

@@ -27,4 +27,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -362,4 +362,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var _a, _b, ohs, ns, bassNs, drumsNs;
var _this = this;
var ohs, ns, bassNs, drumsNs, _a, _b;
return __generator(this, function (_c) {

@@ -530,4 +530,4 @@ switch (_c.label) {

return __awaiter(this, void 0, void 0, function () {
var noteSequence, tensors, tracks;
var _this = this;
var noteSequence, tensors, tracks;
return __generator(this, function (_a) {

@@ -557,5 +557,5 @@ switch (_a.label) {

tracks.forEach(function (track, instrument) {
var _a;
track.setNumSteps(_this.totalSteps);
(_a = noteSequence.notes).push.apply(_a, track.toNoteSequence(instrument).notes);
var _a;
});

@@ -562,0 +562,0 @@ return [2, noteSequence];

import * as aux_inputs from './aux_inputs';
import * as chords from './chords';
import * as constants from './constants';
import * as data from './data';
import * as sequences from './sequences';
export { aux_inputs, chords, data, sequences };
export { aux_inputs, chords, constants, data, sequences };
export * from './midi_io';
export * from './player';

@@ -10,2 +10,4 @@ "use strict";

exports.chords = chords;
var constants = require("./constants");
exports.constants = constants;
var data = require("./data");

@@ -12,0 +14,0 @@ exports.data = data;

import { INoteSequence, NoteSequence } from '../protobuf/index';
export declare abstract class BasePlayerCallback {
abstract run(n: NoteSequence.INote): void;
abstract stop(): void;
}
export declare abstract class BasePlayer {
private currentPart;
private scheduledStop;
protected currentPart: any;
protected scheduledStop: number;
protected playClick: boolean;
protected callbackObject: BasePlayerCallback;
protected abstract playNote(time: number, note: NoteSequence.INote): void;
constructor();
constructor(playClick?: boolean, callbackObject?: BasePlayerCallback);
private makeClickSequence;
start(seq: INoteSequence, qpm?: number): Promise<void>;

@@ -16,3 +23,3 @@ stop(): void;

protected playNote(time: number, note: NoteSequence.INote): void;
private getSynth(instrument, program?);
private getSynth;
}

@@ -29,1 +36,4 @@ export declare class SoundFontPlayer extends BasePlayer {

}
export declare class PlayerWithClick extends Player {
constructor(callbackObject?: BasePlayerCallback);
}

@@ -27,4 +27,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -52,10 +52,52 @@ case 0: case 1: t = op; break;

var _1 = require(".");
var constants = require("./constants");
var data_1 = require("./data");
var soundfont = require("./soundfont");
function compareQuantizedNotes(a, b) {
if (a.quantizedStartStep < b.quantizedStartStep) {
return -1;
}
if (a.quantizedStartStep > b.quantizedStartStep) {
return 1;
}
if (a.pitch < b.pitch) {
return -1;
}
return 1;
}
var BasePlayerCallback = (function () {
function BasePlayerCallback() {
}
return BasePlayerCallback;
}());
exports.BasePlayerCallback = BasePlayerCallback;
var BasePlayer = (function () {
function BasePlayer() {
function BasePlayer(playClick, callbackObject) {
if (playClick === void 0) { playClick = false; }
this.playClick = playClick;
this.callbackObject = callbackObject;
Tone.Transport.bpm.value = 60;
}
BasePlayer.prototype.makeClickSequence = function (seq) {
var clickSeq = _1.sequences.clone(seq);
var sixteenthEnds = clickSeq.notes.map(function (n) { return n.quantizedEndStep; });
var lastSixteenth = Math.max.apply(Math, sixteenthEnds);
for (var i = 0; i < lastSixteenth; i += 4) {
var click = {
pitch: i % 16 === 0 ? constants.LO_CLICK_PITCH :
constants.HI_CLICK_PITCH,
quantizedStartStep: i,
isDrum: true,
quantizedEndStep: i + 1
};
clickSeq.notes.push(click);
}
clickSeq.notes.sort(compareQuantizedNotes);
return clickSeq;
};
BasePlayer.prototype.start = function (seq, qpm) {
var _this = this;
if (this.playClick) {
seq = this.makeClickSequence(seq);
}
if (_1.sequences.isQuantizedSequence(seq)) {

@@ -67,3 +109,14 @@ seq = _1.sequences.unquantizeSequence(seq, qpm);

}
this.currentPart = new Tone.Part(function (t, n) { return _this.playNote(t, n); }, seq.notes.map(function (n) { return [n.startTime, n]; }));
this.currentPart = new Tone.Part(function (t, n) {
if (_this.playClick ||
(n.pitch !== constants.LO_CLICK_PITCH &&
n.pitch !== constants.HI_CLICK_PITCH)) {
_this.playNote(t, n);
}
if (_this.callbackObject) {
Tone.Draw.schedule(function () {
_this.callbackObject.run(n);
}, t);
}
}, seq.notes.map(function (n) { return [n.startTime, n]; }));
this.currentPart.start();

@@ -77,2 +130,5 @@ if (Tone.Transport.state !== 'started') {

resolve();
if (_this.callbackObject) {
_this.callbackObject.stop();
}
}, "+" + seq.totalTime);

@@ -155,2 +211,14 @@ });

.toMaster();
this.loClick = new Tone
.MembraneSynth({
pitchDecay: 0.008,
envelope: { attack: 0.001, decay: 0.3, sustain: 0 }
})
.toMaster();
this.hiClick = new Tone
.MembraneSynth({
pitchDecay: 0.008,
envelope: { attack: 0.001, decay: 0.3, sustain: 0 }
})
.toMaster();
this.pitchPlayers = [

@@ -165,3 +233,5 @@ function (time) { return _this.kick.triggerAttackRelease('C2', '8n', time); },

function (time) { return _this.crash.triggerAttack(time, 1.0); },
function (time) { return _this.ride.triggerAttack(time, 0.5); }
function (time) { return _this.ride.triggerAttack(time, 0.5); },
function (time) { return _this.loClick.triggerAttack('G5', time, 0.5); },
function (time) { return _this.hiClick.triggerAttack('C6', time, 0.5); }
];

@@ -176,2 +246,4 @@ var _loop_1 = function (c) {

}
this.DRUM_PITCH_TO_CLASS.set(constants.LO_CLICK_PITCH, constants.LO_CLICK_CLASS);
this.DRUM_PITCH_TO_CLASS.set(constants.HI_CLICK_PITCH, constants.HI_CLICK_CLASS);
}

@@ -275,2 +347,10 @@ DrumKit.getInstance = function () {

exports.SoundFontPlayer = SoundFontPlayer;
var PlayerWithClick = (function (_super) {
__extends(PlayerWithClick, _super);
function PlayerWithClick(callbackObject) {
return _super.call(this, true, callbackObject) || this;
}
return PlayerWithClick;
}(Player));
exports.PlayerWithClick = PlayerWithClick;
//# sourceMappingURL=player.js.map

@@ -28,5 +28,5 @@ export interface SampleInfo {

initialize(): Promise<void>;
private sampleInfoToName(sampleInfo);
private sampleNameToURL(name);
private nearestVelocity(velocity);
private sampleInfoToName;
private sampleNameToURL;
private nearestVelocity;
loadSamples(samples: SampleInfo[]): Promise<void>;

@@ -33,0 +33,0 @@ playNote(pitch: number, velocity: number, startTime: number, duration: number, output: any): void;

@@ -17,4 +17,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -103,4 +103,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var nearestSampleNames, uniqueSampleNames, sampleNamesAndURLs;
var _this = this;
var nearestSampleNames, uniqueSampleNames, sampleNamesAndURLs;
return __generator(this, function (_a) {

@@ -204,4 +204,4 @@ switch (_a.label) {

return __awaiter(this, void 0, void 0, function () {
var instrumentSamples;
var _this = this;
var instrumentSamples;
return __generator(this, function (_a) {

@@ -208,0 +208,0 @@ switch (_a.label) {

@@ -33,2 +33,3 @@ "use strict";

AttentionWrapper.prototype.call = function (input, c, h, state) {
var _a;
var nextAttnInput = tf.concat([input, state.attention.as2D(1, -1)], 1);

@@ -59,3 +60,2 @@ var nextRnnInput = tf.add(tf.matMul(nextAttnInput, this.attnInputMatrix), this.attnInputBias.as2D(1, -1));

return { output: output, c: c, h: h, attentionState: { attention: attention, attentionState: attentionState } };
var _a;
};

@@ -62,0 +62,0 @@ return AttentionWrapper;

@@ -29,7 +29,7 @@ import * as aux_inputs from '../core/aux_inputs';

isInitialized(): boolean;
private instantiateFromSpec();
private instantiateFromSpec;
initialize(): Promise<void>;
dispose(): void;
continueSequence(sequence: INoteSequence, steps: number, temperature?: number, chordProgression?: string[]): Promise<INoteSequence>;
private sampleRnn(inputs, steps, temperature, controls?, auxInputs?);
private sampleRnn;
}

@@ -17,4 +17,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -70,4 +70,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var vars, hasAttention, rnnPrefix, l, _loop_1, this_1, state_1;
var _this = this;
var vars, hasAttention, rnnPrefix, l, _loop_1, this_1, state_1;
return __generator(this, function (_a) {

@@ -147,4 +147,4 @@ switch (_a.label) {

return __awaiter(this, void 0, void 0, function () {
var oh, result, _a, _b;
var _this = this;
var oh, result, _a, _b;
return __generator(this, function (_c) {

@@ -190,2 +190,3 @@ switch (_c.label) {

MusicRNN.prototype.sampleRnn = function (inputs, steps, temperature, controls, auxInputs) {
var _a;
var length = inputs.shape[0];

@@ -244,3 +245,2 @@ var outputSize = inputs.shape[1];

return samples;
var _a;
};

@@ -247,0 +247,0 @@ return MusicRNN;

@@ -42,15 +42,15 @@ import * as tf from '@tensorflow/tfjs-core';

constructor(checkpointURL: string, spec?: MusicVAESpec);
private instantiateFromSpec();
private instantiateFromSpec;
dispose(): void;
private getLstmLayers(cellFormat, vars);
private getLstmLayers;
initialize(): Promise<void>;
isInitialized(): boolean;
interpolate(inputSequences: INoteSequence[], numInterps: number | number[], temperature?: number, chordProgression?: string[]): Promise<INoteSequence[]>;
private getSegmentLengths(inputTensors);
private encodeChordProgression(chordProgression);
private getSegmentLengths;
private encodeChordProgression;
encode(inputSequences: INoteSequence[], chordProgression?: string[]): Promise<tf.Tensor<tf.Rank.R2>>;
decode(z: tf.Tensor2D, temperature?: number, chordProgression?: string[], stepsPerQuarter?: number): Promise<INoteSequence[]>;
private getInterpolatedZs(z, numInterps);
private getInterpolatedZs;
sample(numSamples: number, temperature?: number, chordProgression?: string[], stepsPerQuarter?: number): Promise<INoteSequence[]>;
}
export { LayerVars, Encoder, Decoder, Nade, MusicVAE };
export { LayerVars, Encoder, Decoder, Nade, MusicVAE, };

@@ -27,4 +27,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -204,2 +204,3 @@ case 0: case 1: t = op; break;

return tf.tidy(function () {
var _a;
var lstmCell = initLstmCells(z, _this.lstmCellVars, _this.zToInitStateVars);

@@ -235,3 +236,2 @@ var samples = [];

return tf.stack(samples, 1);
var _a;
});

@@ -258,2 +258,3 @@ };

return tf.tidy(function () {
var _a;
var lstmCell = initLstmCells(z, _this.lstmCellVars, _this.zToInitStateVars);

@@ -276,3 +277,2 @@ var samples = [];

return tf.concat(samples, 1);
var _a;
});

@@ -350,4 +350,4 @@ };

return __awaiter(this, void 0, void 0, function () {
var LSTM_CELL_FORMAT, MUTLI_LSTM_CELL_FORMAT, CONDUCTOR_PREFIX, BIDI_LSTM_CELL, ENCODER_FORMAT, HIER_ENCODER_FORMAT, vars, encMu, fwLayers_1, bwLayers_1, baseEncoders, fwLayers, bwLayers, decVarPrefix, decVarPrefixes, i, baseDecoders, condLstmLayers, condZtoInitState;
var _this = this;
var LSTM_CELL_FORMAT, MUTLI_LSTM_CELL_FORMAT, CONDUCTOR_PREFIX, BIDI_LSTM_CELL, ENCODER_FORMAT, HIER_ENCODER_FORMAT, vars, encMu, fwLayers_1, bwLayers_1, baseEncoders, fwLayers, bwLayers, decVarPrefix, decVarPrefixes, i, baseDecoders, condLstmLayers, condZtoInitState;
return __generator(this, function (_a) {

@@ -451,4 +451,4 @@ switch (_a.label) {

return __awaiter(this, void 0, void 0, function () {
var inputZs, interpZs, outputSequenes;
var _this = this;
var inputZs, interpZs, outputSequenes;
return __generator(this, function (_a) {

@@ -482,4 +482,4 @@ switch (_a.label) {

return __awaiter(this, void 0, void 0, function () {
var numSteps, numSegments, isEndTensor, isEndArray, maxSegmentLength, segmentLengths, offset, fromIndex;
var _this = this;
var numSteps, numSegments, isEndTensor, isEndArray, maxSegmentLength, segmentLengths, offset, fromIndex;
return __generator(this, function (_a) {

@@ -533,4 +533,4 @@ switch (_a.label) {

return __awaiter(this, void 0, void 0, function () {
var inputTensors, segmentLengths, _a, newInputTensors, z;
var _this = this;
var inputTensors, segmentLengths, _a, newInputTensors, z;
return __generator(this, function (_b) {

@@ -585,4 +585,4 @@ switch (_b.label) {

return __awaiter(this, void 0, void 0, function () {
var numSteps, ohSeqs, outputSequences, _i, ohSeqs_1, oh, _a, _b;
var _this = this;
var numSteps, ohSeqs, outputSequences, _i, ohSeqs_1, oh, _a, _b;
return __generator(this, function (_c) {

@@ -678,4 +678,4 @@ switch (_c.label) {

return __awaiter(this, void 0, void 0, function () {
var randZs, outputSequenes;
var _this = this;
var randZs, outputSequenes;
return __generator(this, function (_a) {

@@ -682,0 +682,0 @@ switch (_a.label) {

{
"name": "@magenta/music",
"version": "1.1.1",
"version": "1.1.2",
"description": "Make music in the browser with machine learning.",

@@ -19,4 +19,4 @@ "main": "es5/index.js",

"@types/clone": "^0.1.30",
"@types/tape": "^4.2.31",
"browserify": "~14.4.0",
"@types/tape": "^4.2.32",
"browserify": "^14.4.0",
"clang-format": "^1.2.3",

@@ -28,7 +28,7 @@ "clone": "^1.0.4",

"ts-node": "^5.0.1",
"tsify": "~3.0.1",
"tsify": "^3.0.4",
"tslint": "^5.9.1",
"typedoc": "^0.11.1",
"typedoc-plugin-sourcefile-url": "^1.0.3",
"typescript": "2.7.2"
"typescript": "^2.7.2"
},

@@ -35,0 +35,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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