museaikit
Version:
A powerful music-focused AI toolkit
1 lines • 89.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mm=t():e.mm=t()}(this,(()=>(()=>{"use strict";var e={75:e=>{e.exports=require("@tensorflow/tfjs")},151:(e,t,n)=>{var o,r,i=n(384),a=i.Reader,s=i.Writer,u=i.util,c=i.roots.default||(i.roots.default={});c.tensorflow=((r={}).magenta=((o={}).NoteSequence=function(){function e(e){if(this.timeSignatures=[],this.keySignatures=[],this.tempos=[],this.notes=[],this.pitchBends=[],this.controlChanges=[],this.partInfos=[],this.textAnnotations=[],this.sectionAnnotations=[],this.sectionGroups=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t,n;return e.prototype.id="",e.prototype.filename="",e.prototype.referenceNumber=u.Long?u.Long.fromBits(0,0,!1):0,e.prototype.collectionName="",e.prototype.ticksPerQuarter=0,e.prototype.timeSignatures=u.emptyArray,e.prototype.keySignatures=u.emptyArray,e.prototype.tempos=u.emptyArray,e.prototype.notes=u.emptyArray,e.prototype.totalTime=0,e.prototype.totalQuantizedSteps=u.Long?u.Long.fromBits(0,0,!1):0,e.prototype.pitchBends=u.emptyArray,e.prototype.controlChanges=u.emptyArray,e.prototype.partInfos=u.emptyArray,e.prototype.sourceInfo=null,e.prototype.textAnnotations=u.emptyArray,e.prototype.sectionAnnotations=u.emptyArray,e.prototype.sectionGroups=u.emptyArray,e.prototype.quantizationInfo=null,e.prototype.subsequenceInfo=null,e.prototype.sequenceMetadata=null,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=s.create()),null!=e.id&&e.hasOwnProperty("id")&&t.uint32(10).string(e.id),null!=e.filename&&e.hasOwnProperty("filename")&&t.uint32(18).string(e.filename),null!=e.collectionName&&e.hasOwnProperty("collectionName")&&t.uint32(26).string(e.collectionName),null!=e.ticksPerQuarter&&e.hasOwnProperty("ticksPerQuarter")&&t.uint32(32).int32(e.ticksPerQuarter),null!=e.timeSignatures&&e.timeSignatures.length)for(var n=0;n<e.timeSignatures.length;++n)c.tensorflow.magenta.NoteSequence.TimeSignature.encode(e.timeSignatures[n],t.uint32(42).fork()).ldelim();if(null!=e.keySignatures&&e.keySignatures.length)for(n=0;n<e.keySignatures.length;++n)c.tensorflow.magenta.NoteSequence.KeySignature.encode(e.keySignatures[n],t.uint32(50).fork()).ldelim();if(null!=e.tempos&&e.tempos.length)for(n=0;n<e.tempos.length;++n)c.tensorflow.magenta.NoteSequence.Tempo.encode(e.tempos[n],t.uint32(58).fork()).ldelim();if(null!=e.notes&&e.notes.length)for(n=0;n<e.notes.length;++n)c.tensorflow.magenta.NoteSequence.Note.encode(e.notes[n],t.uint32(66).fork()).ldelim();if(null!=e.totalTime&&e.hasOwnProperty("totalTime")&&t.uint32(73).double(e.totalTime),null!=e.pitchBends&&e.pitchBends.length)for(n=0;n<e.pitchBends.length;++n)c.tensorflow.magenta.NoteSequence.PitchBend.encode(e.pitchBends[n],t.uint32(82).fork()).ldelim();if(null!=e.controlChanges&&e.controlChanges.length)for(n=0;n<e.controlChanges.length;++n)c.tensorflow.magenta.NoteSequence.ControlChange.encode(e.controlChanges[n],t.uint32(90).fork()).ldelim();if(null!=e.partInfos&&e.partInfos.length)for(n=0;n<e.partInfos.length;++n)c.tensorflow.magenta.NoteSequence.PartInfo.encode(e.partInfos[n],t.uint32(98).fork()).ldelim();if(null!=e.sourceInfo&&e.hasOwnProperty("sourceInfo")&&c.tensorflow.magenta.NoteSequence.SourceInfo.encode(e.sourceInfo,t.uint32(106).fork()).ldelim(),null!=e.textAnnotations&&e.textAnnotations.length)for(n=0;n<e.textAnnotations.length;++n)c.tensorflow.magenta.NoteSequence.TextAnnotation.encode(e.textAnnotations[n],t.uint32(114).fork()).ldelim();if(null!=e.quantizationInfo&&e.hasOwnProperty("quantizationInfo")&&c.tensorflow.magenta.NoteSequence.QuantizationInfo.encode(e.quantizationInfo,t.uint32(122).fork()).ldelim(),null!=e.totalQuantizedSteps&&e.hasOwnProperty("totalQuantizedSteps")&&t.uint32(128).int64(e.totalQuantizedSteps),null!=e.subsequenceInfo&&e.hasOwnProperty("subsequenceInfo")&&c.tensorflow.magenta.NoteSequence.SubsequenceInfo.encode(e.subsequenceInfo,t.uint32(138).fork()).ldelim(),null!=e.referenceNumber&&e.hasOwnProperty("referenceNumber")&&t.uint32(144).int64(e.referenceNumber),null!=e.sequenceMetadata&&e.hasOwnProperty("sequenceMetadata")&&c.tensorflow.magenta.SequenceMetadata.encode(e.sequenceMetadata,t.uint32(154).fork()).ldelim(),null!=e.sectionAnnotations&&e.sectionAnnotations.length)for(n=0;n<e.sectionAnnotations.length;++n)c.tensorflow.magenta.NoteSequence.SectionAnnotation.encode(e.sectionAnnotations[n],t.uint32(162).fork()).ldelim();if(null!=e.sectionGroups&&e.sectionGroups.length)for(n=0;n<e.sectionGroups.length;++n)c.tensorflow.magenta.NoteSequence.SectionGroup.encode(e.sectionGroups[n],t.uint32(170).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.id=e.string();break;case 2:o.filename=e.string();break;case 18:o.referenceNumber=u.Long?e.int64().toNumber():e.int64();break;case 3:o.collectionName=e.string();break;case 4:o.ticksPerQuarter=e.int32();break;case 5:o.timeSignatures&&o.timeSignatures.length||(o.timeSignatures=[]),o.timeSignatures.push(c.tensorflow.magenta.NoteSequence.TimeSignature.decode(e,e.uint32()));break;case 6:o.keySignatures&&o.keySignatures.length||(o.keySignatures=[]),o.keySignatures.push(c.tensorflow.magenta.NoteSequence.KeySignature.decode(e,e.uint32()));break;case 7:o.tempos&&o.tempos.length||(o.tempos=[]),o.tempos.push(c.tensorflow.magenta.NoteSequence.Tempo.decode(e,e.uint32()));break;case 8:o.notes&&o.notes.length||(o.notes=[]),o.notes.push(c.tensorflow.magenta.NoteSequence.Note.decode(e,e.uint32()));break;case 9:o.totalTime=e.double();break;case 16:o.totalQuantizedSteps=u.Long?e.int64().toNumber():e.int64();break;case 10:o.pitchBends&&o.pitchBends.length||(o.pitchBends=[]),o.pitchBends.push(c.tensorflow.magenta.NoteSequence.PitchBend.decode(e,e.uint32()));break;case 11:o.controlChanges&&o.controlChanges.length||(o.controlChanges=[]),o.controlChanges.push(c.tensorflow.magenta.NoteSequence.ControlChange.decode(e,e.uint32()));break;case 12:o.partInfos&&o.partInfos.length||(o.partInfos=[]),o.partInfos.push(c.tensorflow.magenta.NoteSequence.PartInfo.decode(e,e.uint32()));break;case 13:o.sourceInfo=c.tensorflow.magenta.NoteSequence.SourceInfo.decode(e,e.uint32());break;case 14:o.textAnnotations&&o.textAnnotations.length||(o.textAnnotations=[]),o.textAnnotations.push(c.tensorflow.magenta.NoteSequence.TextAnnotation.decode(e,e.uint32()));break;case 20:o.sectionAnnotations&&o.sectionAnnotations.length||(o.sectionAnnotations=[]),o.sectionAnnotations.push(c.tensorflow.magenta.NoteSequence.SectionAnnotation.decode(e,e.uint32()));break;case 21:o.sectionGroups&&o.sectionGroups.length||(o.sectionGroups=[]),o.sectionGroups.push(c.tensorflow.magenta.NoteSequence.SectionGroup.decode(e,e.uint32()));break;case 15:o.quantizationInfo=c.tensorflow.magenta.NoteSequence.QuantizationInfo.decode(e,e.uint32());break;case 17:o.subsequenceInfo=c.tensorflow.magenta.NoteSequence.SubsequenceInfo.decode(e,e.uint32());break;case 19:o.sequenceMetadata=c.tensorflow.magenta.SequenceMetadata.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!u.isString(e.id))return"id: string expected";if(null!=e.filename&&e.hasOwnProperty("filename")&&!u.isString(e.filename))return"filename: string expected";if(null!=e.referenceNumber&&e.hasOwnProperty("referenceNumber")&&!(u.isInteger(e.referenceNumber)||e.referenceNumber&&u.isInteger(e.referenceNumber.low)&&u.isInteger(e.referenceNumber.high)))return"referenceNumber: integer|Long expected";if(null!=e.collectionName&&e.hasOwnProperty("collectionName")&&!u.isString(e.collectionName))return"collectionName: string expected";if(null!=e.ticksPerQuarter&&e.hasOwnProperty("ticksPerQuarter")&&!u.isInteger(e.ticksPerQuarter))return"ticksPerQuarter: integer expected";if(null!=e.timeSignatures&&e.hasOwnProperty("timeSignatures")){if(!Array.isArray(e.timeSignatures))return"timeSignatures: array expected";for(var t=0;t<e.timeSignatures.length;++t)if(n=c.tensorflow.magenta.NoteSequence.TimeSignature.verify(e.timeSignatures[t]))return"timeSignatures."+n}if(null!=e.keySignatures&&e.hasOwnProperty("keySignatures")){if(!Array.isArray(e.keySignatures))return"keySignatures: array expected";for(t=0;t<e.keySignatures.length;++t)if(n=c.tensorflow.magenta.NoteSequence.KeySignature.verify(e.keySignatures[t]))return"keySignatures."+n}if(null!=e.tempos&&e.hasOwnProperty("tempos")){if(!Array.isArray(e.tempos))return"tempos: array expected";for(t=0;t<e.tempos.length;++t)if(n=c.tensorflow.magenta.NoteSequence.Tempo.verify(e.tempos[t]))return"tempos."+n}if(null!=e.notes&&e.hasOwnProperty("notes")){if(!Array.isArray(e.notes))return"notes: array expected";for(t=0;t<e.notes.length;++t)if(n=c.tensorflow.magenta.NoteSequence.Note.verify(e.notes[t]))return"notes."+n}if(null!=e.totalTime&&e.hasOwnProperty("totalTime")&&"number"!=typeof e.totalTime)return"totalTime: number expected";if(null!=e.totalQuantizedSteps&&e.hasOwnProperty("totalQuantizedSteps")&&!(u.isInteger(e.totalQuantizedSteps)||e.totalQuantizedSteps&&u.isInteger(e.totalQuantizedSteps.low)&&u.isInteger(e.totalQuantizedSteps.high)))return"totalQuantizedSteps: integer|Long expected";if(null!=e.pitchBends&&e.hasOwnProperty("pitchBends")){if(!Array.isArray(e.pitchBends))return"pitchBends: array expected";for(t=0;t<e.pitchBends.length;++t)if(n=c.tensorflow.magenta.NoteSequence.PitchBend.verify(e.pitchBends[t]))return"pitchBends."+n}if(null!=e.controlChanges&&e.hasOwnProperty("controlChanges")){if(!Array.isArray(e.controlChanges))return"controlChanges: array expected";for(t=0;t<e.controlChanges.length;++t)if(n=c.tensorflow.magenta.NoteSequence.ControlChange.verify(e.controlChanges[t]))return"controlChanges."+n}if(null!=e.partInfos&&e.hasOwnProperty("partInfos")){if(!Array.isArray(e.partInfos))return"partInfos: array expected";for(t=0;t<e.partInfos.length;++t)if(n=c.tensorflow.magenta.NoteSequence.PartInfo.verify(e.partInfos[t]))return"partInfos."+n}if(null!=e.sourceInfo&&e.hasOwnProperty("sourceInfo")&&(n=c.tensorflow.magenta.NoteSequence.SourceInfo.verify(e.sourceInfo)))return"sourceInfo."+n;if(null!=e.textAnnotations&&e.hasOwnProperty("textAnnotations")){if(!Array.isArray(e.textAnnotations))return"textAnnotations: array expected";for(t=0;t<e.textAnnotations.length;++t)if(n=c.tensorflow.magenta.NoteSequence.TextAnnotation.verify(e.textAnnotations[t]))return"textAnnotations."+n}if(null!=e.sectionAnnotations&&e.hasOwnProperty("sectionAnnotations")){if(!Array.isArray(e.sectionAnnotations))return"sectionAnnotations: array expected";for(t=0;t<e.sectionAnnotations.length;++t)if(n=c.tensorflow.magenta.NoteSequence.SectionAnnotation.verify(e.sectionAnnotations[t]))return"sectionAnnotations."+n}if(null!=e.sectionGroups&&e.hasOwnProperty("sectionGroups")){if(!Array.isArray(e.sectionGroups))return"sectionGroups: array expected";for(t=0;t<e.sectionGroups.length;++t){var n;if(n=c.tensorflow.magenta.NoteSequence.SectionGroup.verify(e.sectionGroups[t]))return"sectionGroups."+n}}return null!=e.quantizationInfo&&e.hasOwnProperty("quantizationInfo")&&(n=c.tensorflow.magenta.NoteSequence.QuantizationInfo.verify(e.quantizationInfo))?"quantizationInfo."+n:null!=e.subsequenceInfo&&e.hasOwnProperty("subsequenceInfo")&&(n=c.tensorflow.magenta.NoteSequence.SubsequenceInfo.verify(e.subsequenceInfo))?"subsequenceInfo."+n:null!=e.sequenceMetadata&&e.hasOwnProperty("sequenceMetadata")&&(n=c.tensorflow.magenta.SequenceMetadata.verify(e.sequenceMetadata))?"sequenceMetadata."+n:null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence)return e;var t=new c.tensorflow.magenta.NoteSequence;if(null!=e.id&&(t.id=String(e.id)),null!=e.filename&&(t.filename=String(e.filename)),null!=e.referenceNumber&&(u.Long?(t.referenceNumber=u.Long.fromValue(e.referenceNumber)).unsigned=!1:"string"==typeof e.referenceNumber?t.referenceNumber=parseInt(e.referenceNumber,10):"number"==typeof e.referenceNumber?t.referenceNumber=e.referenceNumber:"object"==typeof e.referenceNumber&&(t.referenceNumber=new u.LongBits(e.referenceNumber.low>>>0,e.referenceNumber.high>>>0).toNumber())),null!=e.collectionName&&(t.collectionName=String(e.collectionName)),null!=e.ticksPerQuarter&&(t.ticksPerQuarter=0|e.ticksPerQuarter),e.timeSignatures){if(!Array.isArray(e.timeSignatures))throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: array expected");t.timeSignatures=[];for(var n=0;n<e.timeSignatures.length;++n){if("object"!=typeof e.timeSignatures[n])throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: object expected");t.timeSignatures[n]=c.tensorflow.magenta.NoteSequence.TimeSignature.fromObject(e.timeSignatures[n])}}if(e.keySignatures){if(!Array.isArray(e.keySignatures))throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: array expected");for(t.keySignatures=[],n=0;n<e.keySignatures.length;++n){if("object"!=typeof e.keySignatures[n])throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: object expected");t.keySignatures[n]=c.tensorflow.magenta.NoteSequence.KeySignature.fromObject(e.keySignatures[n])}}if(e.tempos){if(!Array.isArray(e.tempos))throw TypeError(".tensorflow.magenta.NoteSequence.tempos: array expected");for(t.tempos=[],n=0;n<e.tempos.length;++n){if("object"!=typeof e.tempos[n])throw TypeError(".tensorflow.magenta.NoteSequence.tempos: object expected");t.tempos[n]=c.tensorflow.magenta.NoteSequence.Tempo.fromObject(e.tempos[n])}}if(e.notes){if(!Array.isArray(e.notes))throw TypeError(".tensorflow.magenta.NoteSequence.notes: array expected");for(t.notes=[],n=0;n<e.notes.length;++n){if("object"!=typeof e.notes[n])throw TypeError(".tensorflow.magenta.NoteSequence.notes: object expected");t.notes[n]=c.tensorflow.magenta.NoteSequence.Note.fromObject(e.notes[n])}}if(null!=e.totalTime&&(t.totalTime=Number(e.totalTime)),null!=e.totalQuantizedSteps&&(u.Long?(t.totalQuantizedSteps=u.Long.fromValue(e.totalQuantizedSteps)).unsigned=!1:"string"==typeof e.totalQuantizedSteps?t.totalQuantizedSteps=parseInt(e.totalQuantizedSteps,10):"number"==typeof e.totalQuantizedSteps?t.totalQuantizedSteps=e.totalQuantizedSteps:"object"==typeof e.totalQuantizedSteps&&(t.totalQuantizedSteps=new u.LongBits(e.totalQuantizedSteps.low>>>0,e.totalQuantizedSteps.high>>>0).toNumber())),e.pitchBends){if(!Array.isArray(e.pitchBends))throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: array expected");for(t.pitchBends=[],n=0;n<e.pitchBends.length;++n){if("object"!=typeof e.pitchBends[n])throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: object expected");t.pitchBends[n]=c.tensorflow.magenta.NoteSequence.PitchBend.fromObject(e.pitchBends[n])}}if(e.controlChanges){if(!Array.isArray(e.controlChanges))throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: array expected");for(t.controlChanges=[],n=0;n<e.controlChanges.length;++n){if("object"!=typeof e.controlChanges[n])throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: object expected");t.controlChanges[n]=c.tensorflow.magenta.NoteSequence.ControlChange.fromObject(e.controlChanges[n])}}if(e.partInfos){if(!Array.isArray(e.partInfos))throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: array expected");for(t.partInfos=[],n=0;n<e.partInfos.length;++n){if("object"!=typeof e.partInfos[n])throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: object expected");t.partInfos[n]=c.tensorflow.magenta.NoteSequence.PartInfo.fromObject(e.partInfos[n])}}if(null!=e.sourceInfo){if("object"!=typeof e.sourceInfo)throw TypeError(".tensorflow.magenta.NoteSequence.sourceInfo: object expected");t.sourceInfo=c.tensorflow.magenta.NoteSequence.SourceInfo.fromObject(e.sourceInfo)}if(e.textAnnotations){if(!Array.isArray(e.textAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: array expected");for(t.textAnnotations=[],n=0;n<e.textAnnotations.length;++n){if("object"!=typeof e.textAnnotations[n])throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: object expected");t.textAnnotations[n]=c.tensorflow.magenta.NoteSequence.TextAnnotation.fromObject(e.textAnnotations[n])}}if(e.sectionAnnotations){if(!Array.isArray(e.sectionAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: array expected");for(t.sectionAnnotations=[],n=0;n<e.sectionAnnotations.length;++n){if("object"!=typeof e.sectionAnnotations[n])throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: object expected");t.sectionAnnotations[n]=c.tensorflow.magenta.NoteSequence.SectionAnnotation.fromObject(e.sectionAnnotations[n])}}if(e.sectionGroups){if(!Array.isArray(e.sectionGroups))throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: array expected");for(t.sectionGroups=[],n=0;n<e.sectionGroups.length;++n){if("object"!=typeof e.sectionGroups[n])throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: object expected");t.sectionGroups[n]=c.tensorflow.magenta.NoteSequence.SectionGroup.fromObject(e.sectionGroups[n])}}if(null!=e.quantizationInfo){if("object"!=typeof e.quantizationInfo)throw TypeError(".tensorflow.magenta.NoteSequence.quantizationInfo: object expected");t.quantizationInfo=c.tensorflow.magenta.NoteSequence.QuantizationInfo.fromObject(e.quantizationInfo)}if(null!=e.subsequenceInfo){if("object"!=typeof e.subsequenceInfo)throw TypeError(".tensorflow.magenta.NoteSequence.subsequenceInfo: object expected");t.subsequenceInfo=c.tensorflow.magenta.NoteSequence.SubsequenceInfo.fromObject(e.subsequenceInfo)}if(null!=e.sequenceMetadata){if("object"!=typeof e.sequenceMetadata)throw TypeError(".tensorflow.magenta.NoteSequence.sequenceMetadata: object expected");t.sequenceMetadata=c.tensorflow.magenta.SequenceMetadata.fromObject(e.sequenceMetadata)}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.timeSignatures=[],n.keySignatures=[],n.tempos=[],n.notes=[],n.pitchBends=[],n.controlChanges=[],n.partInfos=[],n.textAnnotations=[],n.sectionAnnotations=[],n.sectionGroups=[]),t.defaults){if(n.id="",n.filename="",n.collectionName="",n.ticksPerQuarter=0,n.totalTime=0,n.sourceInfo=null,n.quantizationInfo=null,u.Long){var o=new u.Long(0,0,!1);n.totalQuantizedSteps=t.longs===String?o.toString():t.longs===Number?o.toNumber():o}else n.totalQuantizedSteps=t.longs===String?"0":0;n.subsequenceInfo=null,u.Long?(o=new u.Long(0,0,!1),n.referenceNumber=t.longs===String?o.toString():t.longs===Number?o.toNumber():o):n.referenceNumber=t.longs===String?"0":0,n.sequenceMetadata=null}if(null!=e.id&&e.hasOwnProperty("id")&&(n.id=e.id),null!=e.filename&&e.hasOwnProperty("filename")&&(n.filename=e.filename),null!=e.collectionName&&e.hasOwnProperty("collectionName")&&(n.collectionName=e.collectionName),null!=e.ticksPerQuarter&&e.hasOwnProperty("ticksPerQuarter")&&(n.ticksPerQuarter=e.ticksPerQuarter),e.timeSignatures&&e.timeSignatures.length){n.timeSignatures=[];for(var r=0;r<e.timeSignatures.length;++r)n.timeSignatures[r]=c.tensorflow.magenta.NoteSequence.TimeSignature.toObject(e.timeSignatures[r],t)}if(e.keySignatures&&e.keySignatures.length)for(n.keySignatures=[],r=0;r<e.keySignatures.length;++r)n.keySignatures[r]=c.tensorflow.magenta.NoteSequence.KeySignature.toObject(e.keySignatures[r],t);if(e.tempos&&e.tempos.length)for(n.tempos=[],r=0;r<e.tempos.length;++r)n.tempos[r]=c.tensorflow.magenta.NoteSequence.Tempo.toObject(e.tempos[r],t);if(e.notes&&e.notes.length)for(n.notes=[],r=0;r<e.notes.length;++r)n.notes[r]=c.tensorflow.magenta.NoteSequence.Note.toObject(e.notes[r],t);if(null!=e.totalTime&&e.hasOwnProperty("totalTime")&&(n.totalTime=t.json&&!isFinite(e.totalTime)?String(e.totalTime):e.totalTime),e.pitchBends&&e.pitchBends.length)for(n.pitchBends=[],r=0;r<e.pitchBends.length;++r)n.pitchBends[r]=c.tensorflow.magenta.NoteSequence.PitchBend.toObject(e.pitchBends[r],t);if(e.controlChanges&&e.controlChanges.length)for(n.controlChanges=[],r=0;r<e.controlChanges.length;++r)n.controlChanges[r]=c.tensorflow.magenta.NoteSequence.ControlChange.toObject(e.controlChanges[r],t);if(e.partInfos&&e.partInfos.length)for(n.partInfos=[],r=0;r<e.partInfos.length;++r)n.partInfos[r]=c.tensorflow.magenta.NoteSequence.PartInfo.toObject(e.partInfos[r],t);if(null!=e.sourceInfo&&e.hasOwnProperty("sourceInfo")&&(n.sourceInfo=c.tensorflow.magenta.NoteSequence.SourceInfo.toObject(e.sourceInfo,t)),e.textAnnotations&&e.textAnnotations.length)for(n.textAnnotations=[],r=0;r<e.textAnnotations.length;++r)n.textAnnotations[r]=c.tensorflow.magenta.NoteSequence.TextAnnotation.toObject(e.textAnnotations[r],t);if(null!=e.quantizationInfo&&e.hasOwnProperty("quantizationInfo")&&(n.quantizationInfo=c.tensorflow.magenta.NoteSequence.QuantizationInfo.toObject(e.quantizationInfo,t)),null!=e.totalQuantizedSteps&&e.hasOwnProperty("totalQuantizedSteps")&&("number"==typeof e.totalQuantizedSteps?n.totalQuantizedSteps=t.longs===String?String(e.totalQuantizedSteps):e.totalQuantizedSteps:n.totalQuantizedSteps=t.longs===String?u.Long.prototype.toString.call(e.totalQuantizedSteps):t.longs===Number?new u.LongBits(e.totalQuantizedSteps.low>>>0,e.totalQuantizedSteps.high>>>0).toNumber():e.totalQuantizedSteps),null!=e.subsequenceInfo&&e.hasOwnProperty("subsequenceInfo")&&(n.subsequenceInfo=c.tensorflow.magenta.NoteSequence.SubsequenceInfo.toObject(e.subsequenceInfo,t)),null!=e.referenceNumber&&e.hasOwnProperty("referenceNumber")&&("number"==typeof e.referenceNumber?n.referenceNumber=t.longs===String?String(e.referenceNumber):e.referenceNumber:n.referenceNumber=t.longs===String?u.Long.prototype.toString.call(e.referenceNumber):t.longs===Number?new u.LongBits(e.referenceNumber.low>>>0,e.referenceNumber.high>>>0).toNumber():e.referenceNumber),null!=e.sequenceMetadata&&e.hasOwnProperty("sequenceMetadata")&&(n.sequenceMetadata=c.tensorflow.magenta.SequenceMetadata.toObject(e.sequenceMetadata,t)),e.sectionAnnotations&&e.sectionAnnotations.length)for(n.sectionAnnotations=[],r=0;r<e.sectionAnnotations.length;++r)n.sectionAnnotations[r]=c.tensorflow.magenta.NoteSequence.SectionAnnotation.toObject(e.sectionAnnotations[r],t);if(e.sectionGroups&&e.sectionGroups.length)for(n.sectionGroups=[],r=0;r<e.sectionGroups.length;++r)n.sectionGroups[r]=c.tensorflow.magenta.NoteSequence.SectionGroup.toObject(e.sectionGroups[r],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.Note=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.pitch=0,e.prototype.pitchName=0,e.prototype.velocity=0,e.prototype.startTime=0,e.prototype.quantizedStartStep=u.Long?u.Long.fromBits(0,0,!1):0,e.prototype.endTime=0,e.prototype.quantizedEndStep=u.Long?u.Long.fromBits(0,0,!1):0,e.prototype.numerator=0,e.prototype.denominator=0,e.prototype.instrument=0,e.prototype.program=0,e.prototype.isDrum=!1,e.prototype.part=0,e.prototype.voice=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.pitch&&e.hasOwnProperty("pitch")&&t.uint32(8).int32(e.pitch),null!=e.velocity&&e.hasOwnProperty("velocity")&&t.uint32(16).int32(e.velocity),null!=e.startTime&&e.hasOwnProperty("startTime")&&t.uint32(25).double(e.startTime),null!=e.endTime&&e.hasOwnProperty("endTime")&&t.uint32(33).double(e.endTime),null!=e.numerator&&e.hasOwnProperty("numerator")&&t.uint32(40).int32(e.numerator),null!=e.denominator&&e.hasOwnProperty("denominator")&&t.uint32(48).int32(e.denominator),null!=e.instrument&&e.hasOwnProperty("instrument")&&t.uint32(56).int32(e.instrument),null!=e.program&&e.hasOwnProperty("program")&&t.uint32(64).int32(e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&t.uint32(72).bool(e.isDrum),null!=e.part&&e.hasOwnProperty("part")&&t.uint32(80).int32(e.part),null!=e.pitchName&&e.hasOwnProperty("pitchName")&&t.uint32(88).int32(e.pitchName),null!=e.voice&&e.hasOwnProperty("voice")&&t.uint32(96).int32(e.voice),null!=e.quantizedStartStep&&e.hasOwnProperty("quantizedStartStep")&&t.uint32(104).int64(e.quantizedStartStep),null!=e.quantizedEndStep&&e.hasOwnProperty("quantizedEndStep")&&t.uint32(112).int64(e.quantizedEndStep),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.Note;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.pitch=e.int32();break;case 11:o.pitchName=e.int32();break;case 2:o.velocity=e.int32();break;case 3:o.startTime=e.double();break;case 13:o.quantizedStartStep=u.Long?e.int64().toNumber():e.int64();break;case 4:o.endTime=e.double();break;case 14:o.quantizedEndStep=u.Long?e.int64().toNumber():e.int64();break;case 5:o.numerator=e.int32();break;case 6:o.denominator=e.int32();break;case 7:o.instrument=e.int32();break;case 8:o.program=e.int32();break;case 9:o.isDrum=e.bool();break;case 10:o.part=e.int32();break;case 12:o.voice=e.int32();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.pitch&&e.hasOwnProperty("pitch")&&!u.isInteger(e.pitch))return"pitch: integer expected";if(null!=e.pitchName&&e.hasOwnProperty("pitchName"))switch(e.pitchName){default:return"pitchName: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:}return null!=e.velocity&&e.hasOwnProperty("velocity")&&!u.isInteger(e.velocity)?"velocity: integer expected":null!=e.startTime&&e.hasOwnProperty("startTime")&&"number"!=typeof e.startTime?"startTime: number expected":null!=e.quantizedStartStep&&e.hasOwnProperty("quantizedStartStep")&&!(u.isInteger(e.quantizedStartStep)||e.quantizedStartStep&&u.isInteger(e.quantizedStartStep.low)&&u.isInteger(e.quantizedStartStep.high))?"quantizedStartStep: integer|Long expected":null!=e.endTime&&e.hasOwnProperty("endTime")&&"number"!=typeof e.endTime?"endTime: number expected":null!=e.quantizedEndStep&&e.hasOwnProperty("quantizedEndStep")&&!(u.isInteger(e.quantizedEndStep)||e.quantizedEndStep&&u.isInteger(e.quantizedEndStep.low)&&u.isInteger(e.quantizedEndStep.high))?"quantizedEndStep: integer|Long expected":null!=e.numerator&&e.hasOwnProperty("numerator")&&!u.isInteger(e.numerator)?"numerator: integer expected":null!=e.denominator&&e.hasOwnProperty("denominator")&&!u.isInteger(e.denominator)?"denominator: integer expected":null!=e.instrument&&e.hasOwnProperty("instrument")&&!u.isInteger(e.instrument)?"instrument: integer expected":null!=e.program&&e.hasOwnProperty("program")&&!u.isInteger(e.program)?"program: integer expected":null!=e.isDrum&&e.hasOwnProperty("isDrum")&&"boolean"!=typeof e.isDrum?"isDrum: boolean expected":null!=e.part&&e.hasOwnProperty("part")&&!u.isInteger(e.part)?"part: integer expected":null!=e.voice&&e.hasOwnProperty("voice")&&!u.isInteger(e.voice)?"voice: integer expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.Note)return e;var t=new c.tensorflow.magenta.NoteSequence.Note;switch(null!=e.pitch&&(t.pitch=0|e.pitch),e.pitchName){case"UNKNOWN_PITCH_NAME":case 0:t.pitchName=0;break;case"F_FLAT_FLAT":case 1:t.pitchName=1;break;case"C_FLAT_FLAT":case 2:t.pitchName=2;break;case"G_FLAT_FLAT":case 3:t.pitchName=3;break;case"D_FLAT_FLAT":case 4:t.pitchName=4;break;case"A_FLAT_FLAT":case 5:t.pitchName=5;break;case"E_FLAT_FLAT":case 6:t.pitchName=6;break;case"B_FLAT_FLAT":case 7:t.pitchName=7;break;case"F_FLAT":case 8:t.pitchName=8;break;case"C_FLAT":case 9:t.pitchName=9;break;case"G_FLAT":case 10:t.pitchName=10;break;case"D_FLAT":case 11:t.pitchName=11;break;case"A_FLAT":case 12:t.pitchName=12;break;case"E_FLAT":case 13:t.pitchName=13;break;case"B_FLAT":case 14:t.pitchName=14;break;case"F":case 15:t.pitchName=15;break;case"C":case 16:t.pitchName=16;break;case"G":case 17:t.pitchName=17;break;case"D":case 18:t.pitchName=18;break;case"A":case 19:t.pitchName=19;break;case"E":case 20:t.pitchName=20;break;case"B":case 21:t.pitchName=21;break;case"F_SHARP":case 22:t.pitchName=22;break;case"C_SHARP":case 23:t.pitchName=23;break;case"G_SHARP":case 24:t.pitchName=24;break;case"D_SHARP":case 25:t.pitchName=25;break;case"A_SHARP":case 26:t.pitchName=26;break;case"E_SHARP":case 27:t.pitchName=27;break;case"B_SHARP":case 28:t.pitchName=28;break;case"F_SHARP_SHARP":case 29:t.pitchName=29;break;case"C_SHARP_SHARP":case 30:t.pitchName=30;break;case"G_SHARP_SHARP":case 31:t.pitchName=31;break;case"D_SHARP_SHARP":case 32:t.pitchName=32;break;case"A_SHARP_SHARP":case 33:t.pitchName=33;break;case"E_SHARP_SHARP":case 34:t.pitchName=34;break;case"B_SHARP_SHARP":case 35:t.pitchName=35}return null!=e.velocity&&(t.velocity=0|e.velocity),null!=e.startTime&&(t.startTime=Number(e.startTime)),null!=e.quantizedStartStep&&(u.Long?(t.quantizedStartStep=u.Long.fromValue(e.quantizedStartStep)).unsigned=!1:"string"==typeof e.quantizedStartStep?t.quantizedStartStep=parseInt(e.quantizedStartStep,10):"number"==typeof e.quantizedStartStep?t.quantizedStartStep=e.quantizedStartStep:"object"==typeof e.quantizedStartStep&&(t.quantizedStartStep=new u.LongBits(e.quantizedStartStep.low>>>0,e.quantizedStartStep.high>>>0).toNumber())),null!=e.endTime&&(t.endTime=Number(e.endTime)),null!=e.quantizedEndStep&&(u.Long?(t.quantizedEndStep=u.Long.fromValue(e.quantizedEndStep)).unsigned=!1:"string"==typeof e.quantizedEndStep?t.quantizedEndStep=parseInt(e.quantizedEndStep,10):"number"==typeof e.quantizedEndStep?t.quantizedEndStep=e.quantizedEndStep:"object"==typeof e.quantizedEndStep&&(t.quantizedEndStep=new u.LongBits(e.quantizedEndStep.low>>>0,e.quantizedEndStep.high>>>0).toNumber())),null!=e.numerator&&(t.numerator=0|e.numerator),null!=e.denominator&&(t.denominator=0|e.denominator),null!=e.instrument&&(t.instrument=0|e.instrument),null!=e.program&&(t.program=0|e.program),null!=e.isDrum&&(t.isDrum=Boolean(e.isDrum)),null!=e.part&&(t.part=0|e.part),null!=e.voice&&(t.voice=0|e.voice),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(n.pitch=0,n.velocity=0,n.startTime=0,n.endTime=0,n.numerator=0,n.denominator=0,n.instrument=0,n.program=0,n.isDrum=!1,n.part=0,n.pitchName=t.enums===String?"UNKNOWN_PITCH_NAME":0,n.voice=0,u.Long){var o=new u.Long(0,0,!1);n.quantizedStartStep=t.longs===String?o.toString():t.longs===Number?o.toNumber():o}else n.quantizedStartStep=t.longs===String?"0":0;u.Long?(o=new u.Long(0,0,!1),n.quantizedEndStep=t.longs===String?o.toString():t.longs===Number?o.toNumber():o):n.quantizedEndStep=t.longs===String?"0":0}return null!=e.pitch&&e.hasOwnProperty("pitch")&&(n.pitch=e.pitch),null!=e.velocity&&e.hasOwnProperty("velocity")&&(n.velocity=e.velocity),null!=e.startTime&&e.hasOwnProperty("startTime")&&(n.startTime=t.json&&!isFinite(e.startTime)?String(e.startTime):e.startTime),null!=e.endTime&&e.hasOwnProperty("endTime")&&(n.endTime=t.json&&!isFinite(e.endTime)?String(e.endTime):e.endTime),null!=e.numerator&&e.hasOwnProperty("numerator")&&(n.numerator=e.numerator),null!=e.denominator&&e.hasOwnProperty("denominator")&&(n.denominator=e.denominator),null!=e.instrument&&e.hasOwnProperty("instrument")&&(n.instrument=e.instrument),null!=e.program&&e.hasOwnProperty("program")&&(n.program=e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&(n.isDrum=e.isDrum),null!=e.part&&e.hasOwnProperty("part")&&(n.part=e.part),null!=e.pitchName&&e.hasOwnProperty("pitchName")&&(n.pitchName=t.enums===String?c.tensorflow.magenta.NoteSequence.PitchName[e.pitchName]:e.pitchName),null!=e.voice&&e.hasOwnProperty("voice")&&(n.voice=e.voice),null!=e.quantizedStartStep&&e.hasOwnProperty("quantizedStartStep")&&("number"==typeof e.quantizedStartStep?n.quantizedStartStep=t.longs===String?String(e.quantizedStartStep):e.quantizedStartStep:n.quantizedStartStep=t.longs===String?u.Long.prototype.toString.call(e.quantizedStartStep):t.longs===Number?new u.LongBits(e.quantizedStartStep.low>>>0,e.quantizedStartStep.high>>>0).toNumber():e.quantizedStartStep),null!=e.quantizedEndStep&&e.hasOwnProperty("quantizedEndStep")&&("number"==typeof e.quantizedEndStep?n.quantizedEndStep=t.longs===String?String(e.quantizedEndStep):e.quantizedEndStep:n.quantizedEndStep=t.longs===String?u.Long.prototype.toString.call(e.quantizedEndStep):t.longs===Number?new u.LongBits(e.quantizedEndStep.low>>>0,e.quantizedEndStep.high>>>0).toNumber():e.quantizedEndStep),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.PitchName=(t={},(n=Object.create(t))[t[0]="UNKNOWN_PITCH_NAME"]=0,n[t[1]="F_FLAT_FLAT"]=1,n[t[2]="C_FLAT_FLAT"]=2,n[t[3]="G_FLAT_FLAT"]=3,n[t[4]="D_FLAT_FLAT"]=4,n[t[5]="A_FLAT_FLAT"]=5,n[t[6]="E_FLAT_FLAT"]=6,n[t[7]="B_FLAT_FLAT"]=7,n[t[8]="F_FLAT"]=8,n[t[9]="C_FLAT"]=9,n[t[10]="G_FLAT"]=10,n[t[11]="D_FLAT"]=11,n[t[12]="A_FLAT"]=12,n[t[13]="E_FLAT"]=13,n[t[14]="B_FLAT"]=14,n[t[15]="F"]=15,n[t[16]="C"]=16,n[t[17]="G"]=17,n[t[18]="D"]=18,n[t[19]="A"]=19,n[t[20]="E"]=20,n[t[21]="B"]=21,n[t[22]="F_SHARP"]=22,n[t[23]="C_SHARP"]=23,n[t[24]="G_SHARP"]=24,n[t[25]="D_SHARP"]=25,n[t[26]="A_SHARP"]=26,n[t[27]="E_SHARP"]=27,n[t[28]="B_SHARP"]=28,n[t[29]="F_SHARP_SHARP"]=29,n[t[30]="C_SHARP_SHARP"]=30,n[t[31]="G_SHARP_SHARP"]=31,n[t[32]="D_SHARP_SHARP"]=32,n[t[33]="A_SHARP_SHARP"]=33,n[t[34]="E_SHARP_SHARP"]=34,n[t[35]="B_SHARP_SHARP"]=35,n),e.TimeSignature=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.time=0,e.prototype.numerator=0,e.prototype.denominator=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.time&&e.hasOwnProperty("time")&&t.uint32(9).double(e.time),null!=e.numerator&&e.hasOwnProperty("numerator")&&t.uint32(16).int32(e.numerator),null!=e.denominator&&e.hasOwnProperty("denominator")&&t.uint32(24).int32(e.denominator),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.TimeSignature;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.time=e.double();break;case 2:o.numerator=e.int32();break;case 3:o.denominator=e.int32();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.time&&e.hasOwnProperty("time")&&"number"!=typeof e.time?"time: number expected":null!=e.numerator&&e.hasOwnProperty("numerator")&&!u.isInteger(e.numerator)?"numerator: integer expected":null!=e.denominator&&e.hasOwnProperty("denominator")&&!u.isInteger(e.denominator)?"denominator: integer expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.TimeSignature)return e;var t=new c.tensorflow.magenta.NoteSequence.TimeSignature;return null!=e.time&&(t.time=Number(e.time)),null!=e.numerator&&(t.numerator=0|e.numerator),null!=e.denominator&&(t.denominator=0|e.denominator),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.time=0,n.numerator=0,n.denominator=0),null!=e.time&&e.hasOwnProperty("time")&&(n.time=t.json&&!isFinite(e.time)?String(e.time):e.time),null!=e.numerator&&e.hasOwnProperty("numerator")&&(n.numerator=e.numerator),null!=e.denominator&&e.hasOwnProperty("denominator")&&(n.denominator=e.denominator),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.KeySignature=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.time=0,e.prototype.key=0,e.prototype.mode=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.time&&e.hasOwnProperty("time")&&t.uint32(9).double(e.time),null!=e.key&&e.hasOwnProperty("key")&&t.uint32(16).int32(e.key),null!=e.mode&&e.hasOwnProperty("mode")&&t.uint32(24).int32(e.mode),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.KeySignature;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.time=e.double();break;case 2:o.key=e.int32();break;case 3:o.mode=e.int32();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.time&&e.hasOwnProperty("time")&&"number"!=typeof e.time)return"time: number expected";if(null!=e.key&&e.hasOwnProperty("key"))switch(e.key){default:return"key: enum value expected";case 0:case 1:case 1:case 2:case 3:case 3:case 4:case 5:case 6:case 6:case 7:case 8:case 8:case 9:case 10:case 10:case 11:}if(null!=e.mode&&e.hasOwnProperty("mode"))switch(e.mode){default:return"mode: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:}return null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.KeySignature)return e;var t=new c.tensorflow.magenta.NoteSequence.KeySignature;switch(null!=e.time&&(t.time=Number(e.time)),e.key){case"C":case 0:t.key=0;break;case"C_SHARP":case 1:case"D_FLAT":case 1:t.key=1;break;case"D":case 2:t.key=2;break;case"D_SHARP":case 3:case"E_FLAT":case 3:t.key=3;break;case"E":case 4:t.key=4;break;case"F":case 5:t.key=5;break;case"F_SHARP":case 6:case"G_FLAT":case 6:t.key=6;break;case"G":case 7:t.key=7;break;case"G_SHARP":case 8:case"A_FLAT":case 8:t.key=8;break;case"A":case 9:t.key=9;break;case"A_SHARP":case 10:case"B_FLAT":case 10:t.key=10;break;case"B":case 11:t.key=11}switch(e.mode){case"MAJOR":case 0:t.mode=0;break;case"MINOR":case 1:t.mode=1;break;case"NOT_SPECIFIED":case 2:t.mode=2;break;case"MIXOLYDIAN":case 3:t.mode=3;break;case"DORIAN":case 4:t.mode=4;break;case"PHRYGIAN":case 5:t.mode=5;break;case"LYDIAN":case 6:t.mode=6;break;case"LOCRIAN":case 7:t.mode=7}return t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.time=0,n.key=t.enums===String?"C":0,n.mode=t.enums===String?"MAJOR":0),null!=e.time&&e.hasOwnProperty("time")&&(n.time=t.json&&!isFinite(e.time)?String(e.time):e.time),null!=e.key&&e.hasOwnProperty("key")&&(n.key=t.enums===String?c.tensorflow.magenta.NoteSequence.KeySignature.Key[e.key]:e.key),null!=e.mode&&e.hasOwnProperty("mode")&&(n.mode=t.enums===String?c.tensorflow.magenta.NoteSequence.KeySignature.Mode[e.mode]:e.mode),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e.Key=function(){var e={},t=Object.create(e);return t[e[0]="C"]=0,t[e[1]="C_SHARP"]=1,t.D_FLAT=1,t[e[2]="D"]=2,t[e[3]="D_SHARP"]=3,t.E_FLAT=3,t[e[4]="E"]=4,t[e[5]="F"]=5,t[e[6]="F_SHARP"]=6,t.G_FLAT=6,t[e[7]="G"]=7,t[e[8]="G_SHARP"]=8,t.A_FLAT=8,t[e[9]="A"]=9,t[e[10]="A_SHARP"]=10,t.B_FLAT=10,t[e[11]="B"]=11,t}(),e.Mode=function(){var e={},t=Object.create(e);return t[e[0]="MAJOR"]=0,t[e[1]="MINOR"]=1,t[e[2]="NOT_SPECIFIED"]=2,t[e[3]="MIXOLYDIAN"]=3,t[e[4]="DORIAN"]=4,t[e[5]="PHRYGIAN"]=5,t[e[6]="LYDIAN"]=6,t[e[7]="LOCRIAN"]=7,t}(),e}(),e.Tempo=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.time=0,e.prototype.qpm=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.time&&e.hasOwnProperty("time")&&t.uint32(9).double(e.time),null!=e.qpm&&e.hasOwnProperty("qpm")&&t.uint32(17).double(e.qpm),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.Tempo;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.time=e.double();break;case 2:o.qpm=e.double();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.time&&e.hasOwnProperty("time")&&"number"!=typeof e.time?"time: number expected":null!=e.qpm&&e.hasOwnProperty("qpm")&&"number"!=typeof e.qpm?"qpm: number expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.Tempo)return e;var t=new c.tensorflow.magenta.NoteSequence.Tempo;return null!=e.time&&(t.time=Number(e.time)),null!=e.qpm&&(t.qpm=Number(e.qpm)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.time=0,n.qpm=0),null!=e.time&&e.hasOwnProperty("time")&&(n.time=t.json&&!isFinite(e.time)?String(e.time):e.time),null!=e.qpm&&e.hasOwnProperty("qpm")&&(n.qpm=t.json&&!isFinite(e.qpm)?String(e.qpm):e.qpm),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.PitchBend=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.time=0,e.prototype.bend=0,e.prototype.instrument=0,e.prototype.program=0,e.prototype.isDrum=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.time&&e.hasOwnProperty("time")&&t.uint32(9).double(e.time),null!=e.bend&&e.hasOwnProperty("bend")&&t.uint32(16).int32(e.bend),null!=e.instrument&&e.hasOwnProperty("instrument")&&t.uint32(24).int32(e.instrument),null!=e.program&&e.hasOwnProperty("program")&&t.uint32(32).int32(e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&t.uint32(40).bool(e.isDrum),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.PitchBend;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.time=e.double();break;case 2:o.bend=e.int32();break;case 3:o.instrument=e.int32();break;case 4:o.program=e.int32();break;case 5:o.isDrum=e.bool();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.time&&e.hasOwnProperty("time")&&"number"!=typeof e.time?"time: number expected":null!=e.bend&&e.hasOwnProperty("bend")&&!u.isInteger(e.bend)?"bend: integer expected":null!=e.instrument&&e.hasOwnProperty("instrument")&&!u.isInteger(e.instrument)?"instrument: integer expected":null!=e.program&&e.hasOwnProperty("program")&&!u.isInteger(e.program)?"program: integer expected":null!=e.isDrum&&e.hasOwnProperty("isDrum")&&"boolean"!=typeof e.isDrum?"isDrum: boolean expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.PitchBend)return e;var t=new c.tensorflow.magenta.NoteSequence.PitchBend;return null!=e.time&&(t.time=Number(e.time)),null!=e.bend&&(t.bend=0|e.bend),null!=e.instrument&&(t.instrument=0|e.instrument),null!=e.program&&(t.program=0|e.program),null!=e.isDrum&&(t.isDrum=Boolean(e.isDrum)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.time=0,n.bend=0,n.instrument=0,n.program=0,n.isDrum=!1),null!=e.time&&e.hasOwnProperty("time")&&(n.time=t.json&&!isFinite(e.time)?String(e.time):e.time),null!=e.bend&&e.hasOwnProperty("bend")&&(n.bend=e.bend),null!=e.instrument&&e.hasOwnProperty("instrument")&&(n.instrument=e.instrument),null!=e.program&&e.hasOwnProperty("program")&&(n.program=e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&(n.isDrum=e.isDrum),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.ControlChange=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.time=0,e.prototype.quantizedStep=u.Long?u.Long.fromBits(0,0,!1):0,e.prototype.controlNumber=0,e.prototype.controlValue=0,e.prototype.instrument=0,e.prototype.program=0,e.prototype.isDrum=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.time&&e.hasOwnProperty("time")&&t.uint32(9).double(e.time),null!=e.controlNumber&&e.hasOwnProperty("controlNumber")&&t.uint32(16).int32(e.controlNumber),null!=e.controlValue&&e.hasOwnProperty("controlValue")&&t.uint32(24).int32(e.controlValue),null!=e.instrument&&e.hasOwnProperty("instrument")&&t.uint32(32).int32(e.instrument),null!=e.program&&e.hasOwnProperty("program")&&t.uint32(40).int32(e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&t.uint32(48).bool(e.isDrum),null!=e.quantizedStep&&e.hasOwnProperty("quantizedStep")&&t.uint32(56).int64(e.quantizedStep),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.ControlChange;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.time=e.double();break;case 7:o.quantizedStep=u.Long?e.int64().toNumber():e.int64();break;case 2:o.controlNumber=e.int32();break;case 3:o.controlValue=e.int32();break;case 4:o.instrument=e.int32();break;case 5:o.program=e.int32();break;case 6:o.isDrum=e.bool();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.time&&e.hasOwnProperty("time")&&"number"!=typeof e.time?"time: number expected":null!=e.quantizedStep&&e.hasOwnProperty("quantizedStep")&&!(u.isInteger(e.quantizedStep)||e.quantizedStep&&u.isInteger(e.quantizedStep.low)&&u.isInteger(e.quantizedStep.high))?"quantizedStep: integer|Long expected":null!=e.controlNumber&&e.hasOwnProperty("controlNumber")&&!u.isInteger(e.controlNumber)?"controlNumber: integer expected":null!=e.controlValue&&e.hasOwnProperty("controlValue")&&!u.isInteger(e.controlValue)?"controlValue: integer expected":null!=e.instrument&&e.hasOwnProperty("instrument")&&!u.isInteger(e.instrument)?"instrument: integer expected":null!=e.program&&e.hasOwnProperty("program")&&!u.isInteger(e.program)?"program: integer expected":null!=e.isDrum&&e.hasOwnProperty("isDrum")&&"boolean"!=typeof e.isDrum?"isDrum: boolean expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.ControlChange)return e;var t=new c.tensorflow.magenta.NoteSequence.ControlChange;return null!=e.time&&(t.time=Number(e.time)),null!=e.quantizedStep&&(u.Long?(t.quantizedStep=u.Long.fromValue(e.quantizedStep)).unsigned=!1:"string"==typeof e.quantizedStep?t.quantizedStep=parseInt(e.quantizedStep,10):"number"==typeof e.quantizedStep?t.quantizedStep=e.quantizedStep:"object"==typeof e.quantizedStep&&(t.quantizedStep=new u.LongBits(e.quantizedStep.low>>>0,e.quantizedStep.high>>>0).toNumber())),null!=e.controlNumber&&(t.controlNumber=0|e.controlNumber),null!=e.controlValue&&(t.controlValue=0|e.controlValue),null!=e.instrument&&(t.instrument=0|e.instrument),null!=e.program&&(t.program=0|e.program),null!=e.isDrum&&(t.isDrum=Boolean(e.isDrum)),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults)if(n.time=0,n.controlNumber=0,n.controlValue=0,n.instrument=0,n.program=0,n.isDrum=!1,u.Long){var o=new u.Long(0,0,!1);n.quantizedStep=t.longs===String?o.toString():t.longs===Number?o.toNumber():o}else n.quantizedStep=t.longs===String?"0":0;return null!=e.time&&e.hasOwnProperty("time")&&(n.time=t.json&&!isFinite(e.time)?String(e.time):e.time),null!=e.controlNumber&&e.hasOwnProperty("controlNumber")&&(n.controlNumber=e.controlNumber),null!=e.controlValue&&e.hasOwnProperty("controlValue")&&(n.controlValue=e.controlValue),null!=e.instrument&&e.hasOwnProperty("instrument")&&(n.instrument=e.instrument),null!=e.program&&e.hasOwnProperty("program")&&(n.program=e.program),null!=e.isDrum&&e.hasOwnProperty("isDrum")&&(n.isDrum=e.isDrum),null!=e.quantizedStep&&e.hasOwnProperty("quantizedStep")&&("number"==typeof e.quantizedStep?n.quantizedStep=t.longs===String?String(e.quantizedStep):e.quantizedStep:n.quantizedStep=t.longs===String?u.Long.prototype.toString.call(e.quantizedStep):t.longs===Number?new u.LongBits(e.quantizedStep.low>>>0,e.quantizedStep.high>>>0).toNumber():e.quantizedStep),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,i.util.toJSONOptions)},e}(),e.PartInfo=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.part=0,e.prototype.name="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=s.create()),null!=e.part&&e.hasOwnProperty("part")&&t.uint32(8).int32(e.part),null!=e.name&&e.hasOwnProperty("name")&&t.uint32(18).string(e.name),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.tensorflow.magenta.NoteSequence.PartInfo;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:o.part=e.int32();break;case 2:o.name=e.string();break;default:e.skipType(7&r)}}return o},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.part&&e.hasOwnProperty("part")&&!u.isInteger(e.part)?"part: integer expected":null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name)?"name: string expected":null},e.fromObject=function(e){if(e instanceof c.tensorflow.magenta.NoteSequence.PartInfo)return e;var t=new c.tensorflow.magenta.NoteSequence.PartInfo;return null!=e.part&&(t.part=0|e.part),null!=e.name&&(t.name=String(e.name)),t},e.toObject=function(e,t){t||(t={});var n={};return t.def