Minor formatting and type casting adjustment to make codebase internally consistent

This commit is contained in:
Andrew Sliwinski 2014-04-09 01:17:50 -07:00
parent 1bd49e4e49
commit 586f29a285
10 changed files with 259 additions and 217 deletions

View file

@ -37,12 +37,12 @@ var IO = function() {
}; };
IO.prototype.loadProject = function(project_id) { IO.prototype.loadProject = function(project_id) {
var runningIO = this; var self = this;
$.getJSON(this.project_base + project_id + this.project_suffix, function(data) { $.getJSON(this.project_base + project_id + this.project_suffix, function(data) {
runningIO.data = data; self.data = data;
runningIO.makeObjects(); self.makeObjects();
runningIO.loadThreads(); self.loadThreads();
runningIO.loadNotesDrums(); self.loadNotesDrums();
runtime.loadStart(); // Try to run the project. runtime.loadStart(); // Try to run the project.
}); });
}; };
@ -126,8 +126,8 @@ IO.prototype.makeObjects = function() {
$.each(this.data.children, function(index, obj) { $.each(this.data.children, function(index, obj) {
createObj(obj, runtime.stage); // create children of stage - sprites, watchers, and stage's lists createObj(obj, runtime.stage); // create children of stage - sprites, watchers, and stage's lists
}); });
$.each(runtime.sprites.filter(function(sprite){return sprite instanceof Sprite}), function(index, sprite) { // list of sprites $.each(runtime.sprites.filter(function(sprite) {return sprite instanceof Sprite}), function(index, sprite) { // list of sprites
$.each(sprite.lists, function(index, list){ $.each(sprite.lists, function(index, list) {
createObj(list, sprite); // create local lists createObj(list, sprite); // create local lists
}); });
}); });

View file

@ -136,7 +136,7 @@ Interpreter.prototype.stepActiveThread = function() {
if (b == null) return; if (b == null) return;
this.yield = false; this.yield = false;
while (true) { while (true) {
if (this.activeThread.paused) return; if (this.activeThread.paused) return;
++this.opCount; ++this.opCount;
// Advance the "program counter" to the next block before running the primitive. // Advance the "program counter" to the next block before running the primitive.
@ -319,8 +319,11 @@ Interpreter.prototype.lookupPrim = function(op) {
Interpreter.prototype.primNoop = function(b) { console.log(b.op); }; Interpreter.prototype.primNoop = function(b) { console.log(b.op); };
Interpreter.prototype.primWait = function(b) { Interpreter.prototype.primWait = function(b) {
if (interp.activeThread.firstTime) interp.startTimer(interp.numarg(b, 0)); if (interp.activeThread.firstTime) {
else interp.checkTimer(); interp.startTimer(interp.numarg(b, 0));
} else {
interp.checkTimer();
}
}; };
Interpreter.prototype.primRepeat = function(b) { Interpreter.prototype.primRepeat = function(b) {
@ -348,7 +351,9 @@ Interpreter.prototype.broadcast = function(b, waitFlag) {
} }
} }
runtime.allStacksDo(findReceivers); runtime.allStacksDo(findReceivers);
for (pair in receivers) interp.restartThread(receivers[pair][0], receivers[pair][1]); for (pair in receivers) {
interp.restartThread(receivers[pair][0], receivers[pair][1]);
}
if (!waitFlag) return; if (!waitFlag) return;
interp.activeThread.tmpObj = receivers; interp.activeThread.tmpObj = receivers;
interp.activeThread.firstTime = false; interp.activeThread.firstTime = false;
@ -378,7 +383,7 @@ Interpreter.prototype.isRunning = function(b) {
Interpreter.prototype.startSubstack = function(b, isLoop, secondSubstack) { Interpreter.prototype.startSubstack = function(b, isLoop, secondSubstack) {
// Start the substack of a control structure command such as if or forever. // Start the substack of a control structure command such as if or forever.
b.isLoop = !!isLoop; b.isLoop = Boolean(isLoop);
this.activeThread.stack.push(b); // remember the block that started the substack this.activeThread.stack.push(b); // remember the block that started the substack
if (!secondSubstack) { if (!secondSubstack) {
this.activeThread.nextBlock = b.substack; this.activeThread.nextBlock = b.substack;

View file

@ -38,13 +38,9 @@ var Reporter = function(data) {
}; };
Reporter.prototype.determineReporterLabel = function() { Reporter.prototype.determineReporterLabel = function() {
if (this.target === 'Stage' && this.cmd === "getVar:") { if (this.target === 'Stage' && this.cmd === "getVar:") return this.param;
return this.param; if (this.target === 'Stage' && this.param === null) return this.cmd;
} else if (this.target === 'Stage' && this.param === null) {
return this.cmd;
} else {
return this.target + ': ' + this.param; return this.target + ': ' + this.param;
}
} }
Reporter.prototype.attach = function(scene) { Reporter.prototype.attach = function(scene) {
@ -114,13 +110,13 @@ Reporter.prototype.update = function() {
newValue = target.currentCostumeIndex + 1; newValue = target.currentCostumeIndex + 1;
break; break;
case 'timer': case 'timer':
newValue = '' + Math.round(interp.primitiveTable.timer() * 10) / 10; newValue = (Math.round(interp.primitiveTable.timer() * 10) / 10).toString();
break; break;
} }
if (typeof newValue === 'number' && Math.abs(newValue) > 0.001) { if (typeof newValue === 'number' && Math.abs(newValue) > 0.001) {
newValue = Math.round(newValue * 1000) / 1000; newValue = Math.round(newValue * 1000) / 1000;
} }
newValue = '' + newValue; newValue = newValue.toString();
this.valueEl.html(newValue); this.valueEl.html(newValue);
if (this.mode == 3) { if (this.mode == 3) {
this.slider.val(Number(newValue)); this.slider.val(Number(newValue));
@ -164,10 +160,10 @@ List.prototype.attach = function(scene) {
var c = this.containerEl = $('<div style="overflow:hidden;float:left;position:relative">').appendTo(this.el).width(this.width-13).height(this.height-34); var c = this.containerEl = $('<div style="overflow:hidden;float:left;position:relative">').appendTo(this.el).width(this.width-13).height(this.height-34);
var s = this.scrollbar = $('<div class="list-scrollbar-container"><div class="list-scrollbar">').appendTo(this.el); var s = this.scrollbar = $('<div class="list-scrollbar-container"><div class="list-scrollbar">').appendTo(this.el);
var sb = s.children('.list-scrollbar'); var sb = s.children('.list-scrollbar');
sb.mousedown(function(e){ sb.mousedown(function(e) {
if (e.which===1) $(this).data({scrolling:true,startY:e.pageY}); // left button if (e.which===1) $(this).data({scrolling:true,startY:e.pageY}); // left button
}); });
$('body').mousemove(function(e){ $('body').mousemove(function(e) {
if (sb.data('scrolling')) { if (sb.data('scrolling')) {
var offset = parseInt(sb.css('top'))+e.pageY-sb.data('startY'); var offset = parseInt(sb.css('top'))+e.pageY-sb.data('startY');
if (offset < 0) { if (offset < 0) {
@ -179,7 +175,7 @@ List.prototype.attach = function(scene) {
sb.css('top',offset); sb.css('top',offset);
c.scrollTop(c.height()/sb.height()*offset); c.scrollTop(c.height()/sb.height()*offset);
} }
}).mouseup(function(){ }).mouseup(function() {
if ($.hasData(sb[0],'scrolling')) sb.removeData(['scrolling','startY']); if ($.hasData(sb[0],'scrolling')) sb.removeData(['scrolling','startY']);
}); });
// this.el.append('<div class="list-add">+'); // disabled because it doesn't do anything even in the original // this.el.append('<div class="list-add">+'); // disabled because it doesn't do anything even in the original
@ -194,14 +190,14 @@ List.prototype.attach = function(scene) {
this.el.css('display', this.visible ? 'inline-block' : 'none'); this.el.css('display', this.visible ? 'inline-block' : 'none');
}; };
List.prototype.update = function(){ List.prototype.update = function() {
this.contents = findList(runtime.spriteNamed(this.target),this.listName); this.contents = findList(runtime.spriteNamed(this.target),this.listName);
this.el.css('display', this.visible ? 'inline-block' : 'none'); this.el.css('display', this.visible ? 'inline-block' : 'none');
if (!this.visible) return; if (!this.visible) return;
var c = this.containerEl.html(''); // so that it can be used inside the forEach var c = this.containerEl.html(''); // so that it can be used inside the forEach
this.contents.forEach(function(val,i){ this.contents.forEach(function(val,i) {
$('<div style="clear:both">').appendTo(c).append('<div class="list-index">'+(i+1),'<div class="list-item">'+val); $('<div style="clear:both">').appendTo(c).append('<div class="list-index">'+(i+1),'<div class="list-item">'+val);
}); });
c.find('.list-index').width(c.find('.list-index').last().width()); c.find('.list-index').width(c.find('.list-index').last().width());

View file

@ -42,11 +42,11 @@ Runtime.prototype.init = function() {
this.scene = $('#container'); this.scene = $('#container');
window.AudioContext = window.AudioContext || window.webkitAudioContext; window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.audioContext = new AudioContext(); this.audioContext = new AudioContext();
try{ try {
this.audioGain = this.audioContext.createGain(); this.audioGain = this.audioContext.createGain();
}catch(err){ } catch(err) {
this.audioGain = this.audioContext.createGainNode(); this.audioGain = this.audioContext.createGainNode();
} }
this.audioGain.connect(runtime.audioContext.destination); this.audioGain.connect(runtime.audioContext.destination);
}; };
@ -120,7 +120,7 @@ Runtime.prototype.allStacksDo = function(f) {
} }
} }
$.each(stage.stacks, function(index, stack) { $.each(stage.stacks, function(index, stack) {
f(stack, stage); f(stack, stage);
}); });
}; };

View file

@ -129,14 +129,14 @@ Sprite.prototype.attach = function(scene) {
$(sprite.textures[c]).css('display', sprite.currentCostumeIndex == c ? 'inline' : 'none'); $(sprite.textures[c]).css('display', sprite.currentCostumeIndex == c ? 'inline' : 'none');
$(sprite.textures[c]).css('position', 'absolute').css('left', '0px').css('top', '0px'); $(sprite.textures[c]).css('position', 'absolute').css('left', '0px').css('top', '0px');
$(sprite.textures[c]).bind('dragstart', function(evt) { evt.preventDefault(); }) $(sprite.textures[c]).bind('dragstart', function(evt) { evt.preventDefault(); })
.bind('selectstart', function(evt) { evt.preventDefault(); }) .bind('selectstart', function(evt) { evt.preventDefault(); })
.bind('touchend', function(evt) { sprite.onClick(evt); $(this).addClass('touched'); }) .bind('touchend', function(evt) { sprite.onClick(evt); $(this).addClass('touched'); })
.click(function(evt) { .click(function(evt) {
if (!$(this).hasClass('touched')) { if (!$(this).hasClass('touched')) {
sprite.onClick(evt); sprite.onClick(evt);
} else { } else {
$(this).removeClass('touched'); $(this).removeClass('touched');
} }
}); });
scene.append($(sprite.textures[c])); scene.append($(sprite.textures[c]));
}) })
@ -149,12 +149,12 @@ Sprite.prototype.attach = function(scene) {
this.updateTransform(); this.updateTransform();
if (! this.isStage) { if (! this.isStage) {
this.talkBubble = $('<div class="bubble-container"></div>'); this.talkBubble = $('<div class="bubble-container"></div>');
this.talkBubble.css('display', 'none'); this.talkBubble.css('display', 'none');
this.talkBubbleBox = $('<div class="bubble"></div>'); this.talkBubbleBox = $('<div class="bubble"></div>');
this.talkBubbleStyler = $('<div class="bubble-say"></div>'); this.talkBubbleStyler = $('<div class="bubble-say"></div>');
this.talkBubble.append(this.talkBubbleBox); this.talkBubble.append(this.talkBubbleBox);
this.talkBubble.append(this.talkBubbleStyler); this.talkBubble.append(this.talkBubbleStyler);
} }
this.askInput = $('<div class="ask-container"></div>'); this.askInput = $('<div class="ask-container"></div>');
@ -173,9 +173,9 @@ Sprite.prototype.attach = function(scene) {
// Load sounds from the server and buffer them // Load sounds from the server and buffer them
Sprite.prototype.loadSounds = function() { Sprite.prototype.loadSounds = function() {
var spr = this; var self = this;
$.each(this.sounds, function(index, sound) { $.each(this.sounds, function(index, sound) {
io.soundRequest(sound, spr); io.soundRequest(sound, self);
}); });
}; };
@ -273,8 +273,8 @@ Sprite.prototype.onClick = function(evt) {
}; };
Sprite.prototype.setVisible = function(v) { Sprite.prototype.setVisible = function(v) {
this.visible = v; this.visible = v;
this.updateVisible(); this.updateVisible();
}; };
Sprite.prototype.updateLayer = function() { Sprite.prototype.updateLayer = function() {
@ -308,21 +308,27 @@ Sprite.prototype.updateTransform = function() {
// sign to the X scale. // sign to the X scale.
} }
$(this.mesh).css('transform', $(this.mesh).css(
'translatex(' + drawX + 'px) \ 'transform',
translatey(' + drawY + 'px) \ 'translatex(' + drawX + 'px) ' +
rotate(' + this.rotation + 'deg) \ 'translatey(' + drawY + 'px) ' +
scaleX(' + scaleXprepend + (this.scale / resolution) + ') scaleY(' + (this.scale / resolution) + ')'); 'rotate(' + this.rotation + 'deg) ' +
$(this.mesh).css('-moz-transform', 'scaleX(' + scaleXprepend + (this.scale / resolution) + ') scaleY(' + (this.scale / resolution) + ')'
'translatex(' + drawX + 'px) \ );
translatey(' + drawY + 'px) \ $(this.mesh).css(
rotate(' + this.rotation + 'deg) \ '-moz-transform',
scaleX(' + scaleXprepend + this.scale + ') scaleY(' + this.scale / resolution + ')'); 'translatex(' + drawX + 'px) ' +
$(this.mesh).css('-webkit-transform', 'translatey(' + drawY + 'px) ' +
'translatex(' + drawX + 'px) \ 'rotate(' + this.rotation + 'deg) ' +
translatey(' + drawY + 'px) \ 'scaleX(' + scaleXprepend + this.scale + ') scaleY(' + this.scale / resolution + ')'
rotate(' + this.rotation + 'deg) \ );
scaleX(' + scaleXprepend + (this.scale / resolution) + ') scaleY(' + (this.scale / resolution) + ')'); $(this.mesh).css(
'-webkit-transform',
'translatex(' + drawX + 'px) ' +
'translatey(' + drawY + 'px) ' +
'rotate(' + this.rotation + 'deg) ' +
'scaleX(' + scaleXprepend + (this.scale / resolution) + ') scaleY(' + (this.scale / resolution) + ')'
);
$(this.mesh).css('-webkit-transform-origin', rotationCenterX + 'px ' + rotationCenterY + 'px'); $(this.mesh).css('-webkit-transform-origin', rotationCenterX + 'px ' + rotationCenterY + 'px');
$(this.mesh).css('-moz-transform-origin', rotationCenterX + 'px ' + rotationCenterY + 'px'); $(this.mesh).css('-moz-transform-origin', rotationCenterX + 'px ' + rotationCenterY + 'px');
@ -342,9 +348,11 @@ Sprite.prototype.updateTransform = function() {
Sprite.prototype.updateFilters = function() { Sprite.prototype.updateFilters = function() {
$(this.mesh).css('opacity', 1 - this.filters.ghost / 100); $(this.mesh).css('opacity', 1 - this.filters.ghost / 100);
$(this.mesh).css('-webkit-filter', $(this.mesh).css(
'hue-rotate(' + (this.filters.color * 1.8) + 'deg) \ '-webkit-filter',
brightness(' + (this.filters.brightness < 0 ? this.filters.brightness / 100 + 1 : Math.min(2.5, this.filters.brightness * .015 + 1)) + ')'); 'hue-rotate(' + (this.filters.color * 1.8) + 'deg) ' +
'brightness(' + (this.filters.brightness < 0 ? this.filters.brightness / 100 + 1 : Math.min(2.5, this.filters.brightness * .015 + 1)) + ')'
);
}; };
Sprite.prototype.getTalkBubbleXY = function() { Sprite.prototype.getTalkBubbleXY = function() {
@ -368,7 +376,7 @@ Sprite.prototype.showBubble = function(text, type) {
this.talkBubbleBox.removeClass('say-think-border'); this.talkBubbleBox.removeClass('say-think-border');
this.talkBubbleBox.removeClass('ask-border'); this.talkBubbleBox.removeClass('ask-border');
this.talkBubbleStyler.removeClass('bubble-say'); this.talkBubbleStyler.removeClass('bubble-say');
this.talkBubbleStyler.removeClass('bubble-think'); this.talkBubbleStyler.removeClass('bubble-think');
this.talkBubbleStyler.removeClass('bubble-ask'); this.talkBubbleStyler.removeClass('bubble-ask');
@ -415,17 +423,17 @@ Sprite.prototype.hideAsk = function() {
}; };
Sprite.prototype.bindDoAskButton = function() { Sprite.prototype.bindDoAskButton = function() {
var self = this; var self = this;
this.askInputButton.on("keypress click", function(e){ this.askInputButton.on("keypress click", function(e) {
var eType = e.type; var eType = e.type;
if (eType === 'click' || (eType === 'keypress' && e.which === 13)) { if (eType === 'click' || (eType === 'keypress' && e.which === 13)) {
var stage = interp.targetStage(); var stage = interp.targetStage();
stage.askAnswer = $(self.askInputTextField).val(); stage.askAnswer = $(self.askInputTextField).val();
self.hideBubble(); self.hideBubble();
self.hideAsk(); self.hideAsk();
interp.activeThread.paused = false; interp.activeThread.paused = false;
} }
}); });
}; };
Sprite.prototype.setXY = function(x, y) { Sprite.prototype.setXY = function(x, y) {

View file

@ -46,7 +46,7 @@ Primitives.prototype.addPrimsTo = function(primTable) {
primTable['computeFunction:of:'] = this.primMathFunction; primTable['computeFunction:of:'] = this.primMathFunction;
// String primitives // String primitives
primTable['concatenate:with:'] = function(b) { return '' + interp.arg(b, 0) + interp.arg(b, 1); }; primTable['concatenate:with:'] = function(b) { return (interp.arg(b, 0) + interp.arg(b, 1)).toString(); };
primTable['letter:of:'] = this.primLetterOf; primTable['letter:of:'] = this.primLetterOf;
primTable['stringLength:'] = function(b) { return interp.arg(b, 0).length; }; primTable['stringLength:'] = function(b) { return interp.arg(b, 0).length; };

View file

@ -33,7 +33,7 @@ SensingPrims.prototype.addPrimsTo = function(primTable) {
primTable['getAttribute:of:'] = this.primGetAttribute; primTable['getAttribute:of:'] = this.primGetAttribute;
primTable['timeAndDate'] = function(b){ return runtime.getTimeString(interp.arg(b, 0)); }; primTable['timeAndDate'] = function(b) { return runtime.getTimeString(interp.arg(b, 0)); };
primTable['timestamp'] = this.primTimestamp; primTable['timestamp'] = this.primTimestamp;
}; };
@ -181,8 +181,8 @@ SensingPrims.prototype.primDoAsk= function(b) {
showBubble(b, "doAsk"); showBubble(b, "doAsk");
var s = interp.targetSprite(); var s = interp.targetSprite();
if (s !== null) { if (s !== null) {
interp.activeThread.paused = true; interp.activeThread.paused = true;
s.showAsk(); s.showAsk();
} }
}; };

View file

@ -109,8 +109,8 @@ function findList(targetSprite, listName) {
VarListPrims.prototype.primReadList = function(b) { VarListPrims.prototype.primReadList = function(b) {
var list = findList(interp.targetSprite(), interp.arg(b, 0)); var list = findList(interp.targetSprite(), interp.arg(b, 0));
if (list) { if (list) {
var allOne = list.map(function(val) { return val.length; }).reduce(function(old,val) { return old + val; }, 0) === list.length; var allOne = list.map(function(val) { return val.length; }).reduce(function(old,val) { return old + val; }, 0) === list.length;
return list.join(allOne ? '' : ' '); return list.join(allOne ? '' : ' ');
} }
}; };
@ -123,9 +123,13 @@ VarListPrims.prototype.primListDeleteLine = function(b) {
var list = findList(interp.targetSprite(), interp.arg(b, 1)); var list = findList(interp.targetSprite(), interp.arg(b, 1));
if (!list) return; if (!list) return;
var line = interp.arg(b, 0); var line = interp.arg(b, 0);
if (line == 'all' || list.length == 0) list.length = 0; if (line == 'all' || list.length == 0) {
else if (line == 'last') list.splice(list.length - 1, 1); list.length = 0;
else if (parseInt(line, 10) - 1 in list) list.splice(parseInt(line, 10) - 1, 1); } else if (line == 'last') {
list.splice(list.length - 1, 1);
} else if (parseInt(line, 10) - 1 in list) {
list.splice(parseInt(line, 10) - 1, 1);
}
}; };
VarListPrims.prototype.primListInsertAt = function(b) { VarListPrims.prototype.primListInsertAt = function(b) {
@ -134,9 +138,13 @@ VarListPrims.prototype.primListInsertAt = function(b) {
var newItem = interp.arg(b, 0); var newItem = interp.arg(b, 0);
var position = interp.arg(b, 1); var position = interp.arg(b, 1);
if (position == 'last') position = list.length; if (position == 'last') {
else if (position == 'random') position = Math.round(Math.random() * list.length); position = list.length;
else position = parseInt(position, 10) - 1; } else if (position == 'random') {
position = Math.round(Math.random() * list.length);
} else {
position = parseInt(position, 10) - 1;
}
if (position > list.length) return; if (position > list.length) return;
list.splice(position, 0, newItem); list.splice(position, 0, newItem);
@ -148,12 +156,15 @@ VarListPrims.prototype.primListSetLine = function(b) {
var newItem = interp.arg(b, 2); var newItem = interp.arg(b, 2);
var position = interp.arg(b, 0); var position = interp.arg(b, 0);
if (position == 'last') position = list.length - 1; if (position == 'last') {
else if (position == 'random') position = Math.floor(Math.random() * list.length); position = list.length - 1;
else position = parseInt(position, 10) - 1; } else if (position == 'random') {
position = Math.floor(Math.random() * list.length);
} else {
position = parseInt(position, 10) - 1;
}
if (position > list.length - 1) return; if (position > list.length - 1) return;
list[position] = newItem; list[position] = newItem;
}; };

View file

@ -27,21 +27,21 @@
var NotePlayer = function(wavFileData, originalPitch, loopStart, loopEnd, env) { var NotePlayer = function(wavFileData, originalPitch, loopStart, loopEnd, env) {
this.originalPitch = originalPitch || null; this.originalPitch = originalPitch || null;
this.index = 0; this.index = 0;
this.samplesRemaining = 0; // determines note duration this.samplesRemaining = 0; // determines note duration
// Looping // Looping
this.isLooped = false; this.isLooped = false;
this.loopPoint = 0; // final sample in loop this.loopPoint = 0; // final sample in loop
this.loopLength = 0; this.loopLength = 0;
// Volume Envelope // Volume Envelope
this.envelopeValue = 1; this.envelopeValue = 1;
this.samplesSinceStart = 0; this.samplesSinceStart = 0;
this.attackEnd = 0; this.attackEnd = 0;
this.attackRate = 0; this.attackRate = 0;
this.holdEnd = 0; this.holdEnd = 0;
this.decayRate = 1; this.decayRate = 1;
if (wavFileData == null) wavFileData = new ArrayBuffer(); if (wavFileData == null) wavFileData = new ArrayBuffer();
@ -107,8 +107,8 @@ NotePlayer.prototype.interpolatedSample = function() {
NotePlayer.prototype.rawSample = function(sampleIndex) { NotePlayer.prototype.rawSample = function(sampleIndex) {
if (sampleIndex >= this.endOffset) { if (sampleIndex >= this.endOffset) {
if (this.isLooped) sampleIndex = this.loopPoint; if (!this.isLooped) return 0;
else return 0; sampleIndex = this.loopPoint;
} }
var byteIndex = 2 * sampleIndex; var byteIndex = 2 * sampleIndex;
var result = (this.soundData[byteIndex + 1] << 8) + this.soundData[byteIndex]; var result = (this.soundData[byteIndex + 1] << 8) + this.soundData[byteIndex];

View file

@ -32,114 +32,136 @@ var SoundBank = function() {};
// The loop points are -1 if the sound is unlooped (e.g. Marimba). // The loop points are -1 if the sound is unlooped (e.g. Marimba).
// The three-element envelop array may be omitted if the instrument has no envelope. // The three-element envelop array may be omitted if the instrument has no envelope.
SoundBank.instruments = [ SoundBank.instruments = [
[[38, 'AcousticPiano_As3', 58, 10266, 17053, [0, 100, 22]], [
[44, 'AcousticPiano_C4', 60, 13968, 18975, [0, 100, 20]], [38, 'AcousticPiano_As3', 58, 10266, 17053, [0, 100, 22]],
[51, 'AcousticPiano_G4', 67, 12200, 12370, [0, 80, 18]], [44, 'AcousticPiano_C4', 60, 13968, 18975, [0, 100, 20]],
[62, 'AcousticPiano_C6', 84, 13042, 13276, [0, 80, 16]], [51, 'AcousticPiano_G4', 67, 12200, 12370, [0, 80, 18]],
[70, 'AcousticPiano_F5', 77, 12425, 12965, [0, 40, 14]], [62, 'AcousticPiano_C6', 84, 13042, 13276, [0, 80, 16]],
[77, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 20, 10]], [70, 'AcousticPiano_F5', 77, 12425, 12965, [0, 40, 14]],
[85, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 0, 8]], [77, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 20, 10]],
[90, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 0, 6]], [85, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 0, 8]],
[96, 'AcousticPiano_D7', 98, 7454, 7606, [0, 0, 3]], [90, 'AcousticPiano_Ds6', 87, 12368, 12869, [0, 0, 6]],
[128, 'AcousticPiano_D7', 98, 7454, 7606, [0, 0, 2]]], [96, 'AcousticPiano_D7', 98, 7454, 7606, [0, 0, 3]],
[128, 'AcousticPiano_D7', 98, 7454, 7606, [0, 0, 2]]
[[48, 'ElectricPiano_C2', 36, 15338, 17360, [0, 80, 10]], ],
[74, 'ElectricPiano_C4', 60, 11426, 12016, [0, 40, 8]], [
[128, 'ElectricPiano_C4', 60, 11426, 12016, [0, 0, 6]]], [48, 'ElectricPiano_C2', 36, 15338, 17360, [0, 80, 10]],
[74, 'ElectricPiano_C4', 60, 11426, 12016, [0, 40, 8]],
[[128, 'Organ_G2', 43, 1306, 3330]], [128, 'ElectricPiano_C4', 60, 11426, 12016, [0, 0, 6]]
],
[[40, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 15]], [
[56, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 13.5]], [128, 'Organ_G2', 43, 1306, 3330]
[60, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 12]], ],
[67, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 8.5]], [
[72, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 7]], [40, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 15]],
[83, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 5.5]], [56, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 13.5]],
[128, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 4.5]]], [60, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 12]],
[67, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 8.5]],
[[40, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 15]], [72, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 7]],
[56, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 13.5]], [83, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 5.5]],
[60, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 12]], [128, 'AcousticGuitar_F3', 53, 36665, 36791, [0, 0, 4.5]]
[67, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 8.5]], ],
[72, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 7]], [
[83, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 5.5]], [40, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 15]],
[128, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 4.5]]], [56, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 13.5]],
[60, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 12]],
[[34, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 17]], [67, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 8.5]],
[48, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 14]], [72, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 7]],
[64, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 12]], [83, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 5.5]],
[128, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 10]]], [128, 'ElectricGuitar_F3', 53, 34692, 34945, [0, 0, 4.5]]
],
[[38, 'Pizz_G2', 43, 8554, 8782, [0, 0, 5]], [
[45, 'Pizz_G2', 43, 8554, 8782, [0, 12, 4]], [34, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 17]],
[56, 'Pizz_A3', 57, 11460, 11659, [0, 0, 4]], [48, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 14]],
[64, 'Pizz_A3', 57, 11460, 11659, [0, 0, 3.2]], [64, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 12]],
[72, 'Pizz_E4', 64, 17525, 17592, [0, 0, 2.8]], [128, 'ElectricBass_G1', 31, 41912, 42363, [0, 0, 10]]
[80, 'Pizz_E4', 64, 17525, 17592, [0, 0, 2.2]], ],
[128, 'Pizz_E4', 64, 17525, 17592, [0, 0, 1.5]]], [
[38, 'Pizz_G2', 43, 8554, 8782, [0, 0, 5]],
[[41, 'Cello_C2', 36, 8548, 8885], [45, 'Pizz_G2', 43, 8554, 8782, [0, 12, 4]],
[52, 'Cello_As2', 46, 7465, 7845], [56, 'Pizz_A3', 57, 11460, 11659, [0, 0, 4]],
[62, 'Violin_D4', 62, 10608, 11360], [64, 'Pizz_A3', 57, 11460, 11659, [0, 0, 3.2]],
[75, 'Violin_A4', 69, 3111, 3314, [70, 0, 0]], [72, 'Pizz_E4', 64, 17525, 17592, [0, 0, 2.8]],
[128, 'Violin_E5', 76, 2383, 2484]], [80, 'Pizz_E4', 64, 17525, 17592, [0, 0, 2.2]],
[128, 'Pizz_E4', 64, 17525, 17592, [0, 0, 1.5]]
[[30, 'BassTrombone_A2_3', 45, 1357, 2360], ],
[40, 'BassTrombone_A2_2', 45, 1893, 2896], [
[55, 'Trombone_B3', 59, 2646, 3897], [41, 'Cello_C2', 36, 8548, 8885],
[88, 'Trombone_B3', 59, 2646, 3897, [50, 0, 0]], [52, 'Cello_As2', 46, 7465, 7845],
[128, 'Trumpet_E5', 76, 2884, 3152]], [62, 'Violin_D4', 62, 10608, 11360],
[75, 'Violin_A4', 69, 3111, 3314, [70, 0, 0]],
[[128, 'Clarinet_C4', 60, 14540, 15468]], [128, 'Violin_E5', 76, 2383, 2484]
],
[[40, 'TenorSax_C3', 48, 8939, 10794], [
[50, 'TenorSax_C3', 48, 8939, 10794, [20, 0, 0]], [30, 'BassTrombone_A2_3', 45, 1357, 2360],
[59, 'TenorSax_C3', 48, 8939, 10794, [40, 0, 0]], [40, 'BassTrombone_A2_2', 45, 1893, 2896],
[67, 'AltoSax_A3', 57, 8546, 9049], [55, 'Trombone_B3', 59, 2646, 3897],
[75, 'AltoSax_A3', 57, 8546, 9049, [20, 0, 0]], [88, 'Trombone_B3', 59, 2646, 3897, [50, 0, 0]],
[80, 'AltoSax_A3', 57, 8546, 9049, [20, 0, 0]], [128, 'Trumpet_E5', 76, 2884, 3152]
[128, 'AltoSax_C6', 84, 1258, 1848]], ],
[
[[61, 'Flute_B5_2', 83, 1859, 2259], [128, 'Clarinet_C4', 60, 14540, 15468]
[128, 'Flute_B5_1', 83, 2418, 2818]], ],
[
[[128, 'WoodenFlute_C5', 72, 11426, 15724]], [40, 'TenorSax_C3', 48, 8939, 10794],
[50, 'TenorSax_C3', 48, 8939, 10794, [20, 0, 0]],
[[57, 'Bassoon_C3', 48, 2428, 4284], [59, 'TenorSax_C3', 48, 8939, 10794, [40, 0, 0]],
[67, 'Bassoon_C3', 48, 2428, 4284, [40, 0, 0]], [67, 'AltoSax_A3', 57, 8546, 9049],
[76, 'Bassoon_C3', 48, 2428, 4284, [80, 0, 0]], [75, 'AltoSax_A3', 57, 8546, 9049, [20, 0, 0]],
[84, 'EnglishHorn_F3', 53, 7538, 8930, [40, 0, 0]], [80, 'AltoSax_A3', 57, 8546, 9049, [20, 0, 0]],
[128, 'EnglishHorn_D4', 62, 4857, 5231]], [128, 'AltoSax_C6', 84, 1258, 1848]
],
[[39, 'Choir_F3', 53, 14007, 41281], [
[50, 'Choir_F3', 53, 14007, 41281, [40, 0, 0]], [61, 'Flute_B5_2', 83, 1859, 2259],
[61, 'Choir_F3', 53, 14007, 41281, [60, 0, 0]], [128, 'Flute_B5_1', 83, 2418, 2818]
[72, 'Choir_F4', 65, 16351, 46436], ],
[128, 'Choir_F5', 77, 18440, 45391]], [
[128, 'WoodenFlute_C5', 72, 11426, 15724]
[[38, 'Vibraphone_C3', 48, 6202, 6370, [0, 100, 8]], ],
[48, 'Vibraphone_C3', 48, 6202, 6370, [0, 100, 7.5]], [
[59, 'Vibraphone_C3', 48, 6202, 6370, [0, 60, 7]], [57, 'Bassoon_C3', 48, 2428, 4284],
[70, 'Vibraphone_C3', 48, 6202, 6370, [0, 40, 6]], [67, 'Bassoon_C3', 48, 2428, 4284, [40, 0, 0]],
[78, 'Vibraphone_C3', 48, 6202, 6370, [0, 20, 5]], [76, 'Bassoon_C3', 48, 2428, 4284, [80, 0, 0]],
[86, 'Vibraphone_C3', 48, 6202, 6370, [0, 0, 4]], [84, 'EnglishHorn_F3', 53, 7538, 8930, [40, 0, 0]],
[128, 'Vibraphone_C3', 48, 6202, 6370, [0, 0, 3]]], [128, 'EnglishHorn_D4', 62, 4857, 5231]
],
[[128, 'MusicBox_C4', 60, 14278, 14700, [0, 0, 2]]], [
[39, 'Choir_F3', 53, 14007, 41281],
[[128, 'SteelDrum_D5', 74.4, -1, -1, [0, 0, 2]]], [50, 'Choir_F3', 53, 14007, 41281, [40, 0, 0]],
[61, 'Choir_F3', 53, 14007, 41281, [60, 0, 0]],
[[128, 'Marimba_C4', 60, -1, -1]], [72, 'Choir_F4', 65, 16351, 46436],
[128, 'Choir_F5', 77, 18440, 45391]
[[80, 'SynthLead_C4', 60, 135, 1400], ],
[128, 'SynthLead_C6', 84, 124, 356]], [
[38, 'Vibraphone_C3', 48, 6202, 6370, [0, 100, 8]],
[[38, 'SynthPad_A3', 57, 4212, 88017, [50, 0, 0]], [48, 'Vibraphone_C3', 48, 6202, 6370, [0, 100, 7.5]],
[50, 'SynthPad_A3', 57, 4212, 88017, [80, 0, 0]], [59, 'Vibraphone_C3', 48, 6202, 6370, [0, 60, 7]],
[62, 'SynthPad_A3', 57, 4212, 88017, [110, 0, 0]], [70, 'Vibraphone_C3', 48, 6202, 6370, [0, 40, 6]],
[74, 'SynthPad_A3', 57, 4212, 88017, [150, 0, 0]], [78, 'Vibraphone_C3', 48, 6202, 6370, [0, 20, 5]],
[86, 'SynthPad_A3', 57, 4212, 88017, [200, 0, 0]], [86, 'Vibraphone_C3', 48, 6202, 6370, [0, 0, 4]],
[128, 'SynthPad_C6', 84, 2575, 9202]], [128, 'Vibraphone_C3', 48, 6202, 6370, [0, 0, 3]]
],
[
[128, 'MusicBox_C4', 60, 14278, 14700, [0, 0, 2]]
],
[
[128, 'SteelDrum_D5', 74.4, -1, -1, [0, 0, 2]]
],
[
[128, 'Marimba_C4', 60, -1, -1]
],
[
[80, 'SynthLead_C4', 60, 135, 1400],
[128, 'SynthLead_C6', 84, 124, 356]
],
[
[38, 'SynthPad_A3', 57, 4212, 88017, [50, 0, 0]],
[50, 'SynthPad_A3', 57, 4212, 88017, [80, 0, 0]],
[62, 'SynthPad_A3', 57, 4212, 88017, [110, 0, 0]],
[74, 'SynthPad_A3', 57, 4212, 88017, [150, 0, 0]],
[86, 'SynthPad_A3', 57, 4212, 88017, [200, 0, 0]],
[128, 'SynthPad_C6', 84, 2575, 9202]
]
]; ];
// ----------------------------- // -----------------------------