@magenta/music
Version:
Make music with machine learning, in the browser.
1 lines • 98.1 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.protobuf=t():e.protobuf=t()}(self,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=181)}({10:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(35),o=r.tensorflow.magenta.NoteSequence},18:function(e,t,n){"use strict";(function(e){var r=t;function o(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;++o)void 0!==e[r[o]]&&n||(e[r[o]]=t[r[o]]);return e}function i(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&o(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=n(51),r.base64=n(52),r.EventEmitter=n(53),r.float=n(54),r.inquire=n(55),r.utf8=n(56),r.pool=n(57),r.LongBits=n(58),r.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),r.global=r.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=o,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=i,r.ProtocolError=i("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}}).call(this,n(21))},181:function(e,t,n){"use strict";n.r(t);var r=n(10);n.d(t,"NoteSequence",(function(){return r.a}))},21:function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},33:function(e,t,n){"use strict";e.exports=p;var r,o=n(18),i=o.LongBits,s=o.base64,a=o.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}var f=function(){return o.Buffer?function(){return(p.create=function(){return new r})()}:function(){return new p}};function m(e,t,n){t[n]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function h(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}p.create=f(),p.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(p.alloc=o.pool(p.alloc,o.Array.prototype.subarray)),p.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},d.prototype=Object.create(u.prototype),d.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(h,10,i.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.uint64=function(e){var t=i.from(e);return this._push(h,t.length(),t)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(e){var t=i.from(e).zzEncode();return this._push(h,t.length(),t)},p.prototype.bool=function(e){return this._push(m,1,e?1:0)},p.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(e){var t=i.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var y=o.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};p.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(m,1,0);if(o.isString(e)){var n=p.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(y,t,e)},p.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(m,1,0)},p.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new u(c,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(c,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},p._configure=function(e){r=e,p.create=f(),r._configure()}},34:function(e,t,n){"use strict";e.exports=u;var r,o=n(18),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var c,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},p=function(){return o.Buffer?function(e){return(u.create=function(e){return o.Buffer.isBuffer(e)?new r(e):l(e)})(e)}:l};function f(){var e=new i(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function m(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw a(this,8);return new i(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}u.create=p(),u.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,u.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return m(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|m(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e,u.create=p(),r._configure();var t=o.Long?"toLong":"toNumber";o.merge(u.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return d.call(this)[t](!0)},sfixed64:function(){return d.call(this)[t](!1)}})}},35:function(e,t,n){"use strict";var r,o,i=n(49),s=i.Reader,a=i.Writer,u=i.util,c=i.roots.default||(i.roots.default={});c.tensorflow=((o={}).magenta=((r={}).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=a.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 s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new c.tensorflow.magenta.NoteSequence;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.id=e.string();break;case 2:r.filename=e.string();break;case 18:r.referenceNumber=u.Long?e.int64().toNumber():e.int64();break;case 3:r.collectionName=e.string();break;case 4:r.ticksPerQuarter=e.int32();break;case 5:r.timeSignatures&&r.timeSignatures.length||(r.timeSignatures=[]),r.timeSignatures.push(c.tensorflow.magenta.NoteSequence.TimeSignature.decode(e,e.uint32()));break;case 6:r.keySignatures&&r.keySignatures.length||(r.keySignatures=[]),r.keySignatures.push(c.tensorflow.magenta.NoteSequence.KeySignature.decode(e,e.uint32()));break;case 7:r.tempos&&r.tempos.length||(r.tempos=[]),r.tempos.push(c.tensorflow.magenta.NoteSequence.Tempo.decode(e,e.uint32()));break;case 8:r.notes&&r.notes.length||(r.notes=[]),r.notes.push(c.tensorflow.magenta.NoteSequence.Note.decode(e,e.uint32()));break;case 9:r.totalTime=e.double();break;case 16:r.totalQuantizedSteps=u.Long?e.int64().toNumber():e.int64();break;case 10:r.pitchBends&&r.pitchBends.length||(r.pitchBends=[]),r.pitchBends.push(c.tensorflow.magenta.NoteSequence.PitchBend.decode(e,e.uint32()));break;case 11:r.controlChanges&&r.controlChanges.length||(r.controlChanges=[]),r.controlChanges.push(c.tensorflow.magenta.NoteSequence.ControlChange.decode(e,e.uint32()));break;case 12:r.partInfos&&r.partInfos.length||(r.partInfos=[]),r.partInfos.push(c.tensorflow.magenta.NoteSequence.PartInfo.decode(e,e.uint32()));break;case 13:r.sourceInfo=c.tensorflow.magenta.NoteSequence.SourceInfo.decode(e,e.uint32());break;case 14:r.textAnnotations&&r.textAnnotations.length||(r.textAnnotations=[]),r.textAnnotations.push(c.tensorflow.magenta.NoteSequence.TextAnnotation.decode(e,e.uint32()));break;case 20:r.sectionAnnotations&&r.sectionAnnotations.length||(r.sectionAnnotations=[]),r.sectionAnnotations.push(c.tensorflow.magenta.NoteSequence.SectionAnnotation.decode(e,e.uint32()));break;case 21:r.sectionGroups&&r.sectionGroups.length||(r.sectionGroups=[]),r.sectionGroups.push(c.tensorflow.magenta.NoteSequence.SectionGroup.decode(e,e.uint32()));break;case 15:r.quantizationInfo=c.tensorflow.magenta.NoteSequence.QuantizationInfo.decode(e,e.uint32());break;case 17:r.subsequenceInfo=c.tensorflow.magenta.NoteSequence.SubsequenceInfo.decode(e,e.uint32());break;case 19:r.sequenceMetadata=c.tensorflow.magenta.SequenceMetadata.decode(e,e.uint32());break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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 r=new u.Long(0,0,!1);n.totalQuantizedSteps=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.totalQuantizedSteps=t.longs===String?"0":0;n.subsequenceInfo=null,u.Long?(r=new u.Long(0,0,!1),n.referenceNumber=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):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 o=0;o<e.timeSignatures.length;++o)n.timeSignatures[o]=c.tensorflow.magenta.NoteSequence.TimeSignature.toObject(e.timeSignatures[o],t)}if(e.keySignatures&&e.keySignatures.length)for(n.keySignatures=[],o=0;o<e.keySignatures.length;++o)n.keySignatures[o]=c.tensorflow.magenta.NoteSequence.KeySignature.toObject(e.keySignatures[o],t);if(e.tempos&&e.tempos.length)for(n.tempos=[],o=0;o<e.tempos.length;++o)n.tempos[o]=c.tensorflow.magenta.NoteSequence.Tempo.toObject(e.tempos[o],t);if(e.notes&&e.notes.length)for(n.notes=[],o=0;o<e.notes.length;++o)n.notes[o]=c.tensorflow.magenta.NoteSequence.Note.toObject(e.notes[o],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=[],o=0;o<e.pitchBends.length;++o)n.pitchBends[o]=c.tensorflow.magenta.NoteSequence.PitchBend.toObject(e.pitchBends[o],t);if(e.controlChanges&&e.controlChanges.length)for(n.controlChanges=[],o=0;o<e.controlChanges.length;++o)n.controlChanges[o]=c.tensorflow.magenta.NoteSequence.ControlChange.toObject(e.controlChanges[o],t);if(e.partInfos&&e.partInfos.length)for(n.partInfos=[],o=0;o<e.partInfos.length;++o)n.partInfos[o]=c.tensorflow.magenta.NoteSequence.PartInfo.toObject(e.partInfos[o],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=[],o=0;o<e.textAnnotations.length;++o)n.textAnnotations[o]=c.tensorflow.magenta.NoteSequence.TextAnnotation.toObject(e.textAnnotations[o],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=[],o=0;o<e.sectionAnnotations.length;++o)n.sectionAnnotations[o]=c.tensorflow.magenta.NoteSequence.SectionAnnotation.toObject(e.sectionAnnotations[o],t);if(e.sectionGroups&&e.sectionGroups.length)for(n.sectionGroups=[],o=0;o<e.sectionGroups.length;++o)n.sectionGroups[o]=c.tensorflow.magenta.NoteSequence.SectionGroup.toObject(e.sectionGroups[o],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=a.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 s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new c.tensorflow.magenta.NoteSequence.Note;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.pitch=e.int32();break;case 11:r.pitchName=e.int32();break;case 2:r.velocity=e.int32();break;case 3:r.startTime=e.double();break;case 13:r.quantizedStartStep=u.Long?e.int64().toNumber():e.int64();break;case 4:r.endTime=e.double();break;case 14:r.quantizedEndStep=u.Long?e.int64().toNumber():e.int64();break;case 5:r.numerator=e.int32();break;case 6:r.denominator=e.int32();break;case 7:r.instrument=e.int32();break;case 8:r.program=e.int32();break;case 9:r.isDrum=e.bool();break;case 10:r.part=e.int32();break;case 12:r.voice=e.int32();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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 r=new u.Long(0,0,!1);n.quantizedStartStep=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.quantizedStartStep=t.longs===String?"0":0;u.Long?(r=new u.Long(0,0,!1),n.quantizedEndStep=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):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=a.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 s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new c.tensorflow.magenta.NoteSequence.TimeSignature;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.time=e.double();break;case 2:r.numerator=e.int32();break;case 3:r.denominator=e.int32();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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=a.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 s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new c.tensorflow.magenta.NoteSequence.KeySignature;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.time=e.double();break;case 2:r.key=e.int32();break;case 3:r.mode=e.int32();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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:t.key=1;break;case"D_FLAT":case 1:t.key=1;break;case"D":case 2:t.key=2;break;case"D_SHARP":case 3:t.key=3;break;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:t.key=6;break;case"G_FLAT":case 6:t.key=6;break;case"G":case 7:t.key=7;break;case"G_SHARP":case 8:t.key=8;break;case"A_FLAT":case 8:t.key=8;break;case"A":case 9:t.key=9;break;case"A_SHARP":case 10:t.key=10;break;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")