spessasynth_lib 3.22.5 → 3.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/midi_parser/basic_midi.js +0 -0
- package/midi_parser/rmidi_writer.js +0 -0
- package/package.json +1 -1
- package/soundfont/basic_soundfont/basic_zones.js +0 -0
- package/soundfont/basic_soundfont/generator.js +3 -3
- package/soundfont/dls/read_lart.js +0 -0
- package/synthetizer/worklet_processor.min.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.js +1 -1
- package/utils/buffer_to_wav.js +0 -0
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -106,9 +106,9 @@ generatorLimits[generatorTypes.freqVibLFO] = { min: -16000, max: 4500, def: 0 };
|
|
|
106
106
|
generatorLimits[generatorTypes.delayModEnv] = { min: -32768, max: 5000, def: -32768 }; // -32768 indicates instant phase, this is done to prevent click at the start of filter modenv
|
|
107
107
|
generatorLimits[generatorTypes.attackModEnv] = { min: -32768, max: 8000, def: -32768 };
|
|
108
108
|
generatorLimits[generatorTypes.holdModEnv] = { min: -12000, max: 5000, def: -12000 };
|
|
109
|
-
generatorLimits[generatorTypes.decayModEnv] = { min: -
|
|
109
|
+
generatorLimits[generatorTypes.decayModEnv] = { min: -7200, max: 8000, def: -12000 }; // min is set to -7200 to prevent lowpass clicks
|
|
110
110
|
generatorLimits[generatorTypes.sustainModEnv] = { min: 0, max: 1000, def: 0 };
|
|
111
|
-
generatorLimits[generatorTypes.releaseModEnv] = { min: -
|
|
111
|
+
generatorLimits[generatorTypes.releaseModEnv] = { min: -7200, max: 8000, def: -12000 }; // min is set to -7200 to prevent lowpass clicks
|
|
112
112
|
// keynum to mod env
|
|
113
113
|
generatorLimits[generatorTypes.keyNumToModEnvHold] = { min: -1200, max: 1200, def: 0 };
|
|
114
114
|
generatorLimits[generatorTypes.keyNumToModEnvDecay] = { min: -1200, max: 1200, def: 0 };
|
|
@@ -119,7 +119,7 @@ generatorLimits[generatorTypes.attackVolEnv] = { min: -12000, max: 8000, def: -1
|
|
|
119
119
|
generatorLimits[generatorTypes.holdVolEnv] = { min: -12000, max: 5000, def: -12000 };
|
|
120
120
|
generatorLimits[generatorTypes.decayVolEnv] = { min: -12000, max: 8000, def: -12000 };
|
|
121
121
|
generatorLimits[generatorTypes.sustainVolEnv] = { min: 0, max: 1440, def: 0 };
|
|
122
|
-
generatorLimits[generatorTypes.releaseVolEnv] = { min: -7200, max: 8000, def: -12000 }; // prevent clicks
|
|
122
|
+
generatorLimits[generatorTypes.releaseVolEnv] = { min: -7200, max: 8000, def: -12000 }; // min is set to -7200 prevent clicks
|
|
123
123
|
// keynum to vol env
|
|
124
124
|
generatorLimits[generatorTypes.keyNumToVolEnvHold] = { min: -1200, max: 1200, def: 0 };
|
|
125
125
|
generatorLimits[generatorTypes.keyNumToVolEnvDecay] = { min: -1200, max: 1200, def: 0 };
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var cs=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(A,e)=>(typeof require<"u"?require:A)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Y=class extends Uint8Array{currentIndex;constructor(A){super(A),this.currentIndex=0}};function Fe(t){let A=t.reduce((n,o)=>n+o.length,0),e=new Y(A),s=0;for(let n of t)e.set(n,s),s+=n.length;return e}function Dt(t){t=Math.floor(t);let A=Math.floor(t/60),e=Math.round(t-A*60);return{minutes:A,seconds:e,time:`${A.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`}}function ls(t){return t.trim().replaceAll(".mid","").replaceAll(".rmi","").replaceAll("_"," ")}function lA(t){let A="";for(let e=0;e<t.length;e++){let s=t[e].toString(16).padStart(2,"0").toUpperCase();A+=s,A+=" "}return A}var r={warn:"color: orange;",unrecognized:"color: red;",info:"color: aqua;",recognized:"color: lime",value:"color: yellow; background-color: black;"};var Ce=class{constructor(A,e,s){this.ticks=A,this.messageStatusByte=e,this.messageData=s}};function us(t){let A=t&240,e=t&15,s=e;switch(A){case 128:case 144:case 160:case 176:case 192:case 208:case 224:break;case 240:switch(e){case 0:s=-3;break;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:s=-1;break;case 15:s=-2;break}break;default:s=-1}return s}var F={noteOff:128,noteOn:144,polyPressure:160,controllerChange:176,programChange:192,channelPressure:208,pitchBend:224,systemExclusive:240,timecode:241,songPosition:242,songSelect:243,tuneRequest:246,clock:248,start:250,continue:251,stop:252,activeSensing:254,reset:255,sequenceNumber:0,text:1,copyright:2,trackName:3,instrumentName:4,lyric:5,marker:6,cuePoint:7,programName:8,midiChannelPrefix:32,midiPort:33,endOfTrack:47,setTempo:81,smpteOffset:84,timeSignature:88,keySignature:89,sequenceSpecific:127};function Re(t){let A=t&240,e=t&15,s=-1,n=t;return A>=128&&A<=224&&(s=e,n=A),{status:n,channel:s}}var y={bankSelect:0,modulationWheel:1,breathController:2,footController:4,portamentoTime:5,dataEntryMsb:6,mainVolume:7,balance:8,pan:10,expressionController:11,effectControl1:12,effectControl2:13,generalPurposeController1:16,generalPurposeController2:17,generalPurposeController3:18,generalPurposeController4:19,lsbForControl0BankSelect:32,lsbForControl1ModulationWheel:33,lsbForControl2BreathController:34,lsbForControl4FootController:36,lsbForControl5PortamentoTime:37,lsbForControl6DataEntry:38,lsbForControl7MainVolume:39,lsbForControl8Balance:40,lsbForControl10Pan:42,lsbForControl11ExpressionController:43,lsbForControl12EffectControl1:44,lsbForControl13EffectControl2:45,sustainPedal:64,portamentoOnOff:65,sostenutoPedal:66,softPedal:67,legatoFootswitch:68,hold2Pedal:69,soundVariation:70,timbreHarmonicContent:71,releaseTime:72,attackTime:73,brightness:74,soundController6:75,soundController7:76,soundController8:77,soundController9:78,soundController10:79,generalPurposeController5:80,generalPurposeController6:81,generalPurposeController7:82,generalPurposeController8:83,portamentoControl:84,reverbDepth:91,tremoloDepth:92,chorusDepth:93,detuneDepth:94,phaserDepth:95,dataIncrement:96,dataDecrement:97,NRPNLsb:98,NRPNMsb:99,RPNLsb:100,RPNMsb:101,allSoundOff:120,resetAllControllers:121,localControlOnOff:122,allNotesOff:123,omniModeOff:124,omniModeOn:125,monoModeOn:126,polyModeOn:127},ds={8:2,9:2,10:2,11:2,12:1,13:1,14:2};var AA={noteOff:0,noteOn:1,ccChange:2,programChange:3,channelPressure:4,polyPressure:5,killNote:6,ccReset:7,setChannelVibrato:8,soundFontManager:9,stopAll:10,killNotes:11,muteChannel:12,addNewChannel:13,customcCcChange:14,debugMessage:15,systemExclusive:16,setMasterParameter:17,setDrums:18,pitchWheel:19,transpose:20,highPerformanceMode:21,lockController:22,sequencerSpecific:23,requestSynthesizerSnapshot:24,setLogLevel:25,keyModifierManager:26},Ee={mainVolume:0,masterPan:1,voicesCap:2,interpolationType:3},HA=-1,uA={channelProperties:0,eventCall:1,reportedCurrentTime:2,sequencerSpecific:3,synthesizerSnapshot:4,ready:5,soundfontError:6,identify:7};var fs=!1,ms=!0,Ke=!1,ps=!0;function ys(t,A,e,s){fs=t,ms=A,Ke=e,ps=s}function m(...t){fs&&console.info(...t)}function T(...t){ms&&console.warn(...t)}function Ss(...t){ps&&console.table(...t)}function ne(...t){Ke&&console.group(...t)}function yA(...t){Ke&&console.groupCollapsed(...t)}function V(){Ke&&console.groupEnd()}var Be={reloadSoundFont:0,addNewSoundFont:2,deleteSoundFont:3,rearrangeSoundFonts:4};var a={INVALID:-1,startAddrsOffset:0,endAddrOffset:1,startloopAddrsOffset:2,endloopAddrsOffset:3,startAddrsCoarseOffset:4,modLfoToPitch:5,vibLfoToPitch:6,modEnvToPitch:7,initialFilterFc:8,initialFilterQ:9,modLfoToFilterFc:10,modEnvToFilterFc:11,endAddrsCoarseOffset:12,modLfoToVolume:13,unused1:14,chorusEffectsSend:15,reverbEffectsSend:16,pan:17,unused2:18,unused3:19,unused4:20,delayModLFO:21,freqModLFO:22,delayVibLFO:23,freqVibLFO:24,delayModEnv:25,attackModEnv:26,holdModEnv:27,decayModEnv:28,sustainModEnv:29,releaseModEnv:30,keyNumToModEnvHold:31,keyNumToModEnvDecay:32,delayVolEnv:33,attackVolEnv:34,holdVolEnv:35,decayVolEnv:36,sustainVolEnv:37,releaseVolEnv:38,keyNumToVolEnvHold:39,keyNumToVolEnvDecay:40,instrument:41,reserved1:42,keyRange:43,velRange:44,startloopAddrsCoarseOffset:45,keyNum:46,velocity:47,initialAttenuation:48,reserved2:49,endloopAddrsCoarseOffset:50,coarseTune:51,fineTune:52,sampleID:53,sampleModes:54,reserved3:55,scaleTuning:56,exclusiveClass:57,overridingRootKey:58,unused5:59,endOper:60},L=[];L[a.startAddrsOffset]={min:0,max:32768,def:0};L[a.endAddrOffset]={min:-32768,max:32768,def:0};L[a.startloopAddrsOffset]={min:-32768,max:32768,def:0};L[a.endloopAddrsOffset]={min:-32768,max:32768,def:0};L[a.startAddrsCoarseOffset]={min:0,max:32768,def:0};L[a.modLfoToPitch]={min:-12e3,max:12e3,def:0};L[a.vibLfoToPitch]={min:-12e3,max:12e3,def:0};L[a.modEnvToPitch]={min:-12e3,max:12e3,def:0};L[a.initialFilterFc]={min:1500,max:13500,def:13500};L[a.initialFilterQ]={min:0,max:960,def:0};L[a.modLfoToFilterFc]={min:-12e3,max:12e3,def:0};L[a.modEnvToFilterFc]={min:-12e3,max:12e3,def:0};L[a.endAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.modLfoToVolume]={min:-960,max:960,def:0};L[a.chorusEffectsSend]={min:0,max:1e3,def:0};L[a.reverbEffectsSend]={min:0,max:1e3,def:0};L[a.pan]={min:-500,max:500,def:0};L[a.delayModLFO]={min:-12e3,max:5e3,def:-12e3};L[a.freqModLFO]={min:-16e3,max:4500,def:0};L[a.delayVibLFO]={min:-12e3,max:5e3,def:-12e3};L[a.freqVibLFO]={min:-16e3,max:4500,def:0};L[a.delayModEnv]={min:-32768,max:5e3,def:-32768};L[a.attackModEnv]={min:-32768,max:8e3,def:-32768};L[a.holdModEnv]={min:-12e3,max:5e3,def:-12e3};L[a.decayModEnv]={min:-12e3,max:8e3,def:-12e3};L[a.sustainModEnv]={min:0,max:1e3,def:0};L[a.releaseModEnv]={min:-12e3,max:8e3,def:-12e3};L[a.keyNumToModEnvHold]={min:-1200,max:1200,def:0};L[a.keyNumToModEnvDecay]={min:-1200,max:1200,def:0};L[a.delayVolEnv]={min:-12e3,max:5e3,def:-12e3};L[a.attackVolEnv]={min:-12e3,max:8e3,def:-12e3};L[a.holdVolEnv]={min:-12e3,max:5e3,def:-12e3};L[a.decayVolEnv]={min:-12e3,max:8e3,def:-12e3};L[a.sustainVolEnv]={min:0,max:1440,def:0};L[a.releaseVolEnv]={min:-7200,max:8e3,def:-12e3};L[a.keyNumToVolEnvHold]={min:-1200,max:1200,def:0};L[a.keyNumToVolEnvDecay]={min:-1200,max:1200,def:0};L[a.startloopAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.keyNum]={min:-1,max:127,def:-1};L[a.velocity]={min:-1,max:127,def:-1};L[a.initialAttenuation]={min:-250,max:1440,def:0};L[a.endloopAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.coarseTune]={min:-120,max:120,def:0};L[a.fineTune]={min:-12700,max:12700,def:0};L[a.scaleTuning]={min:0,max:1200,def:100};L[a.exclusiveClass]={min:0,max:99999,def:0};L[a.overridingRootKey]={min:-1,max:127,def:-1};var b=class{generatorType=a.INVALID;generatorValue=0;constructor(A=a.INVALID,e=0){if(this.generatorType=A,e===void 0)throw new Error("No value provided.");let s=L[A];this.generatorValue=Math.round(e),s!==void 0&&(this.generatorValue=Math.max(s.min,Math.min(s.max,this.generatorValue)))}};function Ds(t,A,e){let s=L[t]||{min:0,max:32768,def:0},n=A.find(B=>B.generatorType===t),o=0;n&&(o=n.generatorValue);let g=e.find(B=>B.generatorType===t),C=s.def;g&&(C=g.generatorValue);let Q=C+o;return t===a.initialAttenuation?Q:Math.max(s.min,Math.min(s.max,Q))}var O={noController:0,noteOnVelocity:2,noteOnKeyNum:3,polyPressure:10,channelPressure:13,pitchWheel:14,pitchWheelRange:16,link:127},QA={linear:0,concave:1,convex:2,switch:3},j=class t{currentValue=0;constructor(A){this.sourceEnum=A.srcEnum,this.modulatorDestination=A.dest,this.secondarySourceEnum=A.secSrcEnum,this.transformAmount=A.amt,this.transformType=A.transform,this.modulatorDestination>58&&(this.modulatorDestination=a.INVALID),this.sourcePolarity=this.sourceEnum>>9&1,this.sourceDirection=this.sourceEnum>>8&1,this.sourceUsesCC=this.sourceEnum>>7&1,this.sourceIndex=this.sourceEnum&127,this.sourceCurveType=this.sourceEnum>>10&3,this.secSrcPolarity=this.secondarySourceEnum>>9&1,this.secSrcDirection=this.secondarySourceEnum>>8&1,this.secSrcUsesCC=this.secondarySourceEnum>>7&1,this.secSrcIndex=this.secondarySourceEnum&127,this.secSrcCurveType=this.secondarySourceEnum>>10&3,this.isEffectModulator=(this.sourceEnum===219||this.sourceEnum===221)&&this.secondarySourceEnum===0&&(this.modulatorDestination===a.reverbEffectsSend||this.modulatorDestination===a.chorusEffectsSend)}static copy(A){return new t({srcEnum:A.sourceEnum,secSrcEnum:A.secondarySourceEnum,transform:A.transformType,amt:A.transformAmount,dest:A.modulatorDestination})}static isIdentical(A,e){return A.sourceEnum===e.sourceEnum&&A.modulatorDestination===e.modulatorDestination&&A.secondarySourceEnum===e.secondarySourceEnum&&A.transformType===e.transformType}sumTransform(A){return new t({srcEnum:this.sourceEnum,secSrcEnum:this.secondarySourceEnum,dest:this.modulatorDestination,transform:this.transformType,amt:this.transformAmount+A.transformAmount})}debugString(){function A(n,o){return Object.keys(n).find(g=>n[g]===o)}let e=A(QA,this.sourceCurveType);e+=this.sourcePolarity===0?" unipolar ":" bipolar ",e+=this.sourceDirection===0?"forwards ":"backwards ",this.sourceUsesCC?e+=A(y,this.sourceIndex):e+=A(O,this.sourceIndex);let s=A(QA,this.secSrcCurveType);return s+=this.secSrcPolarity===0?" unipolar ":" bipolar ",s+=this.secSrcCurveType===0?"forwards ":"backwards ",this.secSrcUsesCC?s+=A(y,this.secSrcIndex):s+=A(O,this.secSrcIndex),`Modulator:
|
|
1
|
+
var cs=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(A,e)=>(typeof require<"u"?require:A)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Y=class extends Uint8Array{currentIndex;constructor(A){super(A),this.currentIndex=0}};function Fe(t){let A=t.reduce((n,o)=>n+o.length,0),e=new Y(A),s=0;for(let n of t)e.set(n,s),s+=n.length;return e}function Dt(t){t=Math.floor(t);let A=Math.floor(t/60),e=Math.round(t-A*60);return{minutes:A,seconds:e,time:`${A.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`}}function ls(t){return t.trim().replaceAll(".mid","").replaceAll(".rmi","").replaceAll("_"," ")}function lA(t){let A="";for(let e=0;e<t.length;e++){let s=t[e].toString(16).padStart(2,"0").toUpperCase();A+=s,A+=" "}return A}var r={warn:"color: orange;",unrecognized:"color: red;",info:"color: aqua;",recognized:"color: lime",value:"color: yellow; background-color: black;"};var Ce=class{constructor(A,e,s){this.ticks=A,this.messageStatusByte=e,this.messageData=s}};function us(t){let A=t&240,e=t&15,s=e;switch(A){case 128:case 144:case 160:case 176:case 192:case 208:case 224:break;case 240:switch(e){case 0:s=-3;break;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:s=-1;break;case 15:s=-2;break}break;default:s=-1}return s}var F={noteOff:128,noteOn:144,polyPressure:160,controllerChange:176,programChange:192,channelPressure:208,pitchBend:224,systemExclusive:240,timecode:241,songPosition:242,songSelect:243,tuneRequest:246,clock:248,start:250,continue:251,stop:252,activeSensing:254,reset:255,sequenceNumber:0,text:1,copyright:2,trackName:3,instrumentName:4,lyric:5,marker:6,cuePoint:7,programName:8,midiChannelPrefix:32,midiPort:33,endOfTrack:47,setTempo:81,smpteOffset:84,timeSignature:88,keySignature:89,sequenceSpecific:127};function Re(t){let A=t&240,e=t&15,s=-1,n=t;return A>=128&&A<=224&&(s=e,n=A),{status:n,channel:s}}var y={bankSelect:0,modulationWheel:1,breathController:2,footController:4,portamentoTime:5,dataEntryMsb:6,mainVolume:7,balance:8,pan:10,expressionController:11,effectControl1:12,effectControl2:13,generalPurposeController1:16,generalPurposeController2:17,generalPurposeController3:18,generalPurposeController4:19,lsbForControl0BankSelect:32,lsbForControl1ModulationWheel:33,lsbForControl2BreathController:34,lsbForControl4FootController:36,lsbForControl5PortamentoTime:37,lsbForControl6DataEntry:38,lsbForControl7MainVolume:39,lsbForControl8Balance:40,lsbForControl10Pan:42,lsbForControl11ExpressionController:43,lsbForControl12EffectControl1:44,lsbForControl13EffectControl2:45,sustainPedal:64,portamentoOnOff:65,sostenutoPedal:66,softPedal:67,legatoFootswitch:68,hold2Pedal:69,soundVariation:70,timbreHarmonicContent:71,releaseTime:72,attackTime:73,brightness:74,soundController6:75,soundController7:76,soundController8:77,soundController9:78,soundController10:79,generalPurposeController5:80,generalPurposeController6:81,generalPurposeController7:82,generalPurposeController8:83,portamentoControl:84,reverbDepth:91,tremoloDepth:92,chorusDepth:93,detuneDepth:94,phaserDepth:95,dataIncrement:96,dataDecrement:97,NRPNLsb:98,NRPNMsb:99,RPNLsb:100,RPNMsb:101,allSoundOff:120,resetAllControllers:121,localControlOnOff:122,allNotesOff:123,omniModeOff:124,omniModeOn:125,monoModeOn:126,polyModeOn:127},ds={8:2,9:2,10:2,11:2,12:1,13:1,14:2};var AA={noteOff:0,noteOn:1,ccChange:2,programChange:3,channelPressure:4,polyPressure:5,killNote:6,ccReset:7,setChannelVibrato:8,soundFontManager:9,stopAll:10,killNotes:11,muteChannel:12,addNewChannel:13,customcCcChange:14,debugMessage:15,systemExclusive:16,setMasterParameter:17,setDrums:18,pitchWheel:19,transpose:20,highPerformanceMode:21,lockController:22,sequencerSpecific:23,requestSynthesizerSnapshot:24,setLogLevel:25,keyModifierManager:26},Ee={mainVolume:0,masterPan:1,voicesCap:2,interpolationType:3},HA=-1,uA={channelProperties:0,eventCall:1,reportedCurrentTime:2,sequencerSpecific:3,synthesizerSnapshot:4,ready:5,soundfontError:6,identify:7};var fs=!1,ms=!0,Ke=!1,ps=!0;function ys(t,A,e,s){fs=t,ms=A,Ke=e,ps=s}function m(...t){fs&&console.info(...t)}function T(...t){ms&&console.warn(...t)}function Ss(...t){ps&&console.table(...t)}function ne(...t){Ke&&console.group(...t)}function yA(...t){Ke&&console.groupCollapsed(...t)}function V(){Ke&&console.groupEnd()}var Be={reloadSoundFont:0,addNewSoundFont:2,deleteSoundFont:3,rearrangeSoundFonts:4};var a={INVALID:-1,startAddrsOffset:0,endAddrOffset:1,startloopAddrsOffset:2,endloopAddrsOffset:3,startAddrsCoarseOffset:4,modLfoToPitch:5,vibLfoToPitch:6,modEnvToPitch:7,initialFilterFc:8,initialFilterQ:9,modLfoToFilterFc:10,modEnvToFilterFc:11,endAddrsCoarseOffset:12,modLfoToVolume:13,unused1:14,chorusEffectsSend:15,reverbEffectsSend:16,pan:17,unused2:18,unused3:19,unused4:20,delayModLFO:21,freqModLFO:22,delayVibLFO:23,freqVibLFO:24,delayModEnv:25,attackModEnv:26,holdModEnv:27,decayModEnv:28,sustainModEnv:29,releaseModEnv:30,keyNumToModEnvHold:31,keyNumToModEnvDecay:32,delayVolEnv:33,attackVolEnv:34,holdVolEnv:35,decayVolEnv:36,sustainVolEnv:37,releaseVolEnv:38,keyNumToVolEnvHold:39,keyNumToVolEnvDecay:40,instrument:41,reserved1:42,keyRange:43,velRange:44,startloopAddrsCoarseOffset:45,keyNum:46,velocity:47,initialAttenuation:48,reserved2:49,endloopAddrsCoarseOffset:50,coarseTune:51,fineTune:52,sampleID:53,sampleModes:54,reserved3:55,scaleTuning:56,exclusiveClass:57,overridingRootKey:58,unused5:59,endOper:60},L=[];L[a.startAddrsOffset]={min:0,max:32768,def:0};L[a.endAddrOffset]={min:-32768,max:32768,def:0};L[a.startloopAddrsOffset]={min:-32768,max:32768,def:0};L[a.endloopAddrsOffset]={min:-32768,max:32768,def:0};L[a.startAddrsCoarseOffset]={min:0,max:32768,def:0};L[a.modLfoToPitch]={min:-12e3,max:12e3,def:0};L[a.vibLfoToPitch]={min:-12e3,max:12e3,def:0};L[a.modEnvToPitch]={min:-12e3,max:12e3,def:0};L[a.initialFilterFc]={min:1500,max:13500,def:13500};L[a.initialFilterQ]={min:0,max:960,def:0};L[a.modLfoToFilterFc]={min:-12e3,max:12e3,def:0};L[a.modEnvToFilterFc]={min:-12e3,max:12e3,def:0};L[a.endAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.modLfoToVolume]={min:-960,max:960,def:0};L[a.chorusEffectsSend]={min:0,max:1e3,def:0};L[a.reverbEffectsSend]={min:0,max:1e3,def:0};L[a.pan]={min:-500,max:500,def:0};L[a.delayModLFO]={min:-12e3,max:5e3,def:-12e3};L[a.freqModLFO]={min:-16e3,max:4500,def:0};L[a.delayVibLFO]={min:-12e3,max:5e3,def:-12e3};L[a.freqVibLFO]={min:-16e3,max:4500,def:0};L[a.delayModEnv]={min:-32768,max:5e3,def:-32768};L[a.attackModEnv]={min:-32768,max:8e3,def:-32768};L[a.holdModEnv]={min:-12e3,max:5e3,def:-12e3};L[a.decayModEnv]={min:-7200,max:8e3,def:-12e3};L[a.sustainModEnv]={min:0,max:1e3,def:0};L[a.releaseModEnv]={min:-7200,max:8e3,def:-12e3};L[a.keyNumToModEnvHold]={min:-1200,max:1200,def:0};L[a.keyNumToModEnvDecay]={min:-1200,max:1200,def:0};L[a.delayVolEnv]={min:-12e3,max:5e3,def:-12e3};L[a.attackVolEnv]={min:-12e3,max:8e3,def:-12e3};L[a.holdVolEnv]={min:-12e3,max:5e3,def:-12e3};L[a.decayVolEnv]={min:-12e3,max:8e3,def:-12e3};L[a.sustainVolEnv]={min:0,max:1440,def:0};L[a.releaseVolEnv]={min:-7200,max:8e3,def:-12e3};L[a.keyNumToVolEnvHold]={min:-1200,max:1200,def:0};L[a.keyNumToVolEnvDecay]={min:-1200,max:1200,def:0};L[a.startloopAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.keyNum]={min:-1,max:127,def:-1};L[a.velocity]={min:-1,max:127,def:-1};L[a.initialAttenuation]={min:-250,max:1440,def:0};L[a.endloopAddrsCoarseOffset]={min:-32768,max:32768,def:0};L[a.coarseTune]={min:-120,max:120,def:0};L[a.fineTune]={min:-12700,max:12700,def:0};L[a.scaleTuning]={min:0,max:1200,def:100};L[a.exclusiveClass]={min:0,max:99999,def:0};L[a.overridingRootKey]={min:-1,max:127,def:-1};var b=class{generatorType=a.INVALID;generatorValue=0;constructor(A=a.INVALID,e=0){if(this.generatorType=A,e===void 0)throw new Error("No value provided.");let s=L[A];this.generatorValue=Math.round(e),s!==void 0&&(this.generatorValue=Math.max(s.min,Math.min(s.max,this.generatorValue)))}};function Ds(t,A,e){let s=L[t]||{min:0,max:32768,def:0},n=A.find(B=>B.generatorType===t),o=0;n&&(o=n.generatorValue);let g=e.find(B=>B.generatorType===t),C=s.def;g&&(C=g.generatorValue);let Q=C+o;return t===a.initialAttenuation?Q:Math.max(s.min,Math.min(s.max,Q))}var O={noController:0,noteOnVelocity:2,noteOnKeyNum:3,polyPressure:10,channelPressure:13,pitchWheel:14,pitchWheelRange:16,link:127},QA={linear:0,concave:1,convex:2,switch:3},j=class t{currentValue=0;constructor(A){this.sourceEnum=A.srcEnum,this.modulatorDestination=A.dest,this.secondarySourceEnum=A.secSrcEnum,this.transformAmount=A.amt,this.transformType=A.transform,this.modulatorDestination>58&&(this.modulatorDestination=a.INVALID),this.sourcePolarity=this.sourceEnum>>9&1,this.sourceDirection=this.sourceEnum>>8&1,this.sourceUsesCC=this.sourceEnum>>7&1,this.sourceIndex=this.sourceEnum&127,this.sourceCurveType=this.sourceEnum>>10&3,this.secSrcPolarity=this.secondarySourceEnum>>9&1,this.secSrcDirection=this.secondarySourceEnum>>8&1,this.secSrcUsesCC=this.secondarySourceEnum>>7&1,this.secSrcIndex=this.secondarySourceEnum&127,this.secSrcCurveType=this.secondarySourceEnum>>10&3,this.isEffectModulator=(this.sourceEnum===219||this.sourceEnum===221)&&this.secondarySourceEnum===0&&(this.modulatorDestination===a.reverbEffectsSend||this.modulatorDestination===a.chorusEffectsSend)}static copy(A){return new t({srcEnum:A.sourceEnum,secSrcEnum:A.secondarySourceEnum,transform:A.transformType,amt:A.transformAmount,dest:A.modulatorDestination})}static isIdentical(A,e){return A.sourceEnum===e.sourceEnum&&A.modulatorDestination===e.modulatorDestination&&A.secondarySourceEnum===e.secondarySourceEnum&&A.transformType===e.transformType}sumTransform(A){return new t({srcEnum:this.sourceEnum,secSrcEnum:this.secondarySourceEnum,dest:this.modulatorDestination,transform:this.transformType,amt:this.transformAmount+A.transformAmount})}debugString(){function A(n,o){return Object.keys(n).find(g=>n[g]===o)}let e=A(QA,this.sourceCurveType);e+=this.sourcePolarity===0?" unipolar ":" bipolar ",e+=this.sourceDirection===0?"forwards ":"backwards ",this.sourceUsesCC?e+=A(y,this.sourceIndex):e+=A(O,this.sourceIndex);let s=A(QA,this.secSrcCurveType);return s+=this.secSrcPolarity===0?" unipolar ":" bipolar ",s+=this.secSrcCurveType===0?"forwards ":"backwards ",this.secSrcUsesCC?s+=A(y,this.secSrcIndex):s+=A(O,this.secSrcIndex),`Modulator:
|
|
2
2
|
Source: ${e}
|
|
3
3
|
Secondary source: ${s}
|
|
4
4
|
Destination: ${A(a,this.modulatorDestination)}
|
|
@@ -6,7 +6,7 @@ var cs=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(A,e)=>(
|
|
|
6
6
|
Transform type: ${this.transformType}
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
`}},kt=960,wt=QA.concave;function YA(t,A,e,s,n){return t<<10|A<<9|e<<8|s<<7|n}var Oe=[new j({srcEnum:YA(wt,0,1,0,O.noteOnVelocity),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:129,dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:YA(wt,0,1,1,y.mainVolume),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:13,dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:526,dest:a.fineTune,amt:12700,secSrcEnum:16,transform:0}),new j({srcEnum:650,dest:a.pan,amt:500,secSrcEnum:0,transform:0}),new j({srcEnum:YA(wt,0,1,1,y.expressionController),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:219,dest:a.reverbEffectsSend,amt:200,secSrcEnum:0,transform:0}),new j({srcEnum:221,dest:a.chorusEffectsSend,amt:200,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,0,0,0,O.polyPressure),dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,0,0,1,y.tremoloDepth),dest:a.modLfoToVolume,amt:24,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.releaseTime),dest:a.releaseVolEnv,amt:1200,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.brightness),dest:a.initialFilterFc,amt:6e3,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.timbreHarmonicContent),dest:a.initialFilterQ,amt:250,secSrcEnum:0,transform:0})];var gA=128,Ve=147,Ft=new Int16Array(Ve).fill(0),dA=(t,A)=>Ft[t]=A<<7;dA(y.mainVolume,100);dA(y.balance,64);dA(y.expressionController,127);dA(y.pan,64);dA(y.timbreHarmonicContent,64);dA(y.releaseTime,64);dA(y.attackTime,64);dA(y.brightness,64);dA(y.soundController6,64);dA(y.soundController7,64);dA(y.soundController8,64);dA(y.soundController9,64);dA(y.generalPurposeController6,64);dA(y.generalPurposeController8,64);dA(gA+O.pitchWheel,64);dA(gA+O.pitchWheelRange,2);var aA={channelTuning:0,channelTransposeFine:1,modulationMultiplier:2,masterTuning:3,channelTuningSemitones:4},Rt=Object.keys(aA).length,Gt=new Float32Array(Rt);Gt[aA.modulationMultiplier]=1;var fA={Idle:0,RPCoarse:1,RPFine:2,NRPCoarse:3,NRPFine:4,DataCoarse:5,DataFine:6};function ks(t=!1){let A={midiControllers:new Int16Array(Ve),lockedControllers:Array(Ve).fill(!1),customControllers:new Float32Array(Rt),NRPCoarse:0,NRPFine:0,RPValue:0,dataEntryState:fA.Idle,voices:[],sustainedVoices:[],cachedVoices:[],preset:this.defaultPreset,presetUsesOverride:!1,channelTransposeKeyShift:0,channelOctaveTuning:new Int8Array(12),keyCentTuning:new Int16Array(128),channelVibrato:{delay:0,depth:0,rate:0},velocityOverride:0,lockGSNRPNParams:!1,holdPedal:!1,isMuted:!1,drumChannel:!1,lockPreset:!1};for(let e=0;e<128;e++)A.cachedVoices.push([]);this.workletProcessorChannels.push(A),this.resetControllers(this.workletProcessorChannels.length-1),this.sendChannelProperties(),t&&this.callEvent("newchannel",void 0)}function jA(t,A){t.lockPreset||(t.bank=A)}function PA(t){return t.drumChannel?128:t.bank}var xt={velocityOverride:128};var Ze={addMapping:0,deleteMapping:1,clearMappings:2},Xe=class{_keyMappings=[];handleMessage(A,e){switch(A){default:return;case Ze.addMapping:this.addMapping(...e);break;case Ze.clearMappings:this.clearMappings();break;case Ze.deleteMapping:this.deleteMapping(...e)}}addMapping(A,e,s){this._keyMappings[A]===void 0&&(this._keyMappings[A]=[]),this._keyMappings[A][e]=s}deleteMapping(A,e){this._keyMappings[A]?.[e]!==void 0&&(this._keyMappings[A][e]=void 0)}clearMappings(){this._keyMappings=[]}setMappings(A){this._keyMappings=A}getMappings(){return this._keyMappings}getVelocity(A,e){let s=this._keyMappings[A]?.[e];return s?s.velocity:-1}hasOverridePatch(A,e){let s=this._keyMappings[A]?.[e]?.patch?.bank;return s!==void 0&&s>0}getPatch(A,e){let s=this._keyMappings[A]?.[e];if(s)return s.patch;throw new Error("No modifier.")}};var ws="spessasynth-worklet-system",Fs=350,SA=9,We=16,_e="gs";var wA={loadNewSongList:0,pause:1,stop:2,play:3,setTime:4,changeMIDIMessageSending:5,setPlaybackRate:6,setLoop:7,changeSong:8,getMIDI:9,setSkipToFirstNote:10,setPreservePlaybackState:11},FA={midiEvent:0,songChange:1,textEvent:2,timeChange:3,pause:4,getMIDI:5,midiError:6};function $A(t,A){let e=0;for(let s=8*(A-1);s>=0;s-=8)e|=t[t.currentIndex++]<<s;return e>>>0}function Rs(t,A){if(this.ignoreEvents)return;if(this.sendMIDIMessages&&t.messageStatusByte>=128){this.sendMIDIMessage([t.messageStatusByte,...t.messageData]);return}let e=Re(t.messageStatusByte),s=this.midiPortChannelOffsets[this.midiPorts[A]]||0;switch(e.channel+=s,e.status){case F.noteOn:let n=t.messageData[1];if(n>0)this.synth.noteOn(e.channel,t.messageData[0],n),this.playingNotes.push({midiNote:t.messageData[0],channel:e.channel,velocity:n});else{this.synth.noteOff(e.channel,t.messageData[0]);let g=this.playingNotes.findIndex(C=>C.midiNote===t.messageData[0]&&C.channel===e.channel);g!==-1&&this.playingNotes.splice(g,1)}break;case F.noteOff:this.synth.noteOff(e.channel,t.messageData[0]);let o=this.playingNotes.findIndex(g=>g.midiNote===t.messageData[0]&&g.channel===e.channel);o!==-1&&this.playingNotes.splice(o,1);break;case F.pitchBend:this.synth.pitchWheel(e.channel,t.messageData[1],t.messageData[0]);break;case F.controllerChange:this.synth.controllerChange(e.channel,t.messageData[0],t.messageData[1]);break;case F.programChange:this.synth.programChange(e.channel,t.messageData[0]);break;case F.polyPressure:this.synth.polyPressure(e.channel,t.messageData[0],t.messageData[1]);break;case F.channelPressure:this.synth.channelPressure(e.channel,t.messageData[0]);break;case F.systemExclusive:this.synth.systemExclusive(t.messageData,s);break;case F.setTempo:this.oneTickToSeconds=60/(To(t)*this.midiData.timeDivision),this.oneTickToSeconds===0&&(this.oneTickToSeconds=60/(120*this.midiData.timeDivision),T("invalid tempo! falling back to 120 BPM"));break;case F.timeSignature:case F.endOfTrack:case F.midiChannelPrefix:case F.songPosition:case F.activeSensing:case F.keySignature:case F.sequenceNumber:case F.sequenceSpecific:break;case F.text:case F.lyric:case F.copyright:case F.trackName:case F.marker:case F.cuePoint:case F.instrumentName:case F.programName:this.post(FA.textEvent,[t.messageData,e.status]);break;case F.midiPort:this.assignMIDIPort(A,t.messageData[0]);break;case F.reset:this.synth.stopAllChannels(),this.synth.resetAllControllers();break;default:T(`%cUnrecognized Event: %c${t.messageStatusByte}%c status byte: %c${Object.keys(F).find(g=>F[g]===e.status)}`,r.warn,r.unrecognized,r.warn,r.value);break}}function Gs(){for(let t=0;t<16;t++)this.synth.createWorkletChannel(!0),t===SA&&this.synth.setDrums(this.synth.workletProcessorChannels.length-1,!0)}function To(t){return t.messageData.currentIndex=0,6e7/$A(t.messageData,3)}function xs(){let t=this.currentTime;for(;this.playedTime<t;){let A=this._findFirstEventIndex(),e=this.tracks[A][this.eventIndex[A]];if(this._processEvent(e,A),this.eventIndex[A]++,A=this._findFirstEventIndex(),this.tracks[A].length<=this.eventIndex[A]){if(this.loop){this.setTimeTicks(this.midiData.loop.start);return}this.eventIndex[A]--,this.pause(!0),this.songs.length>1&&this.nextSong();return}let s=this.tracks[A][this.eventIndex[A]];if(this.playedTime+=this.oneTickToSeconds*(s.ticks-e.ticks),this.midiData.loop.end<=e.ticks&&this.loop&&this.currentLoopCount>0){this.currentLoopCount--,this.setTimeTicks(this.midiData.loop.start);return}else if(t>=this.duration){if(this.loop&&this.currentLoopCount>0){this.currentLoopCount--,this.setTimeTicks(this.midiData.loop.start);return}this.eventIndex[A]--,this.pause(!0),this.songs.length>1&&this.nextSong();return}}}function Ms(){let t=0,A=1/0;return this.tracks.forEach((e,s)=>{this.eventIndex[s]>=e.length||e[this.eventIndex[s]].ticks<A&&(t=s,A=e[this.eventIndex[s]].ticks)}),t}var ze=class{constructor(A){this.timeDivision=A.timeDivision,this.duration=A.duration,this.tempoChanges=A.tempoChanges,this.copyright=A.copyright,this.tracksAmount=A.tracksAmount,this.lyrics=A.lyrics,this.firstNoteOn=A.firstNoteOn,this.keyRange=A.keyRange,this.lastVoiceEventTick=A.lastVoiceEventTick,this.midiPorts=A.midiPorts,this.midiPortChannelOffsets=A.midiPortChannelOffsets,this.usedChannelsOnTrack=A.usedChannelsOnTrack,this.loop=A.loop,this.midiName=A.midiName,this.fileName=A.fileName,this.rawMidiName=A.rawMidiName,this.isEmbedded=A.embeddedSoundFont!==void 0,this.RMIDInfo=A.RMIDInfo,this.bankOffset=A.bankOffset}},Hi={duration:99999,firstNoteOn:0,loop:{start:0,end:123456},lastVoiceEventTick:123456,lyrics:[],copyright:"",midiPorts:[],midiPortChannelOffsets:[],tracksAmount:0,tempoChanges:[{ticks:0,tempo:120}],fileName:"NOT_LOADED.mid",midiName:"Loading...",rawMidiName:new Uint8Array([76,111,97,100,105,110,103,46,46,46]),usedChannelsOnTrack:[],timeDivision:0,keyRange:{min:0,max:127},isEmbedded:!1,RMIDInfo:void 0,bankOffset:0};function k(t,A){let e=0;for(let s=0;s<A;s++)e|=t[t.currentIndex++]<<s*8;return e>>>0}function he(t,A,e){for(let s=0;s<e;s++)t[t.currentIndex++]=A>>s*8&255}function v(t,A){t[t.currentIndex++]=A&255,t[t.currentIndex++]=A>>8}function cA(t,A){he(t,A,4)}function Ae(t,A){let e=A<<8|t;return e>32767?e-65536:e}function Ns(t){return t>127?t-256:t}function Z(t,A,e=void 0,s=!0){if(e){let n=t.slice(t.currentIndex,t.currentIndex+A);return t.currentIndex+=A,new TextDecoder(e.replace(/[^\x20-\x7E]/g,"")).decode(n.buffer)}else{let n=!1,o="";for(let g=0;g<A;g++){let C=t[t.currentIndex++];if(!n){if(C<32||C>127){if(s){n=!0;continue}else if(C===0){n=!0;continue}}o+=String.fromCharCode(C)}}return o}}function RA(t,A,e=0){e>0&&A.length>e&&(A=A.slice(0,e));for(let s=0;s<A.length;s++)t[t.currentIndex++]=A.charCodeAt(s);if(e>A.length)for(let s=0;s<e-A.length;s++)t[t.currentIndex++]=0;return t}var eA=class{constructor(A,e,s){this.header=A,this.size=e,this.chunkData=s}};function X(t,A=!0,e=!1){let s=Z(t,4),n=k(t,4),o;return A&&(o=new Y(t.buffer.slice(t.currentIndex,t.currentIndex+n))),(A||e)&&(t.currentIndex+=n),n%2!==0&&t[t.currentIndex]===0&&t.currentIndex++,new eA(s,n,o)}function nA(t,A=void 0){let e=8+t.size;t.size%2!==0&&e++,A&&(e+=A.length);let s=new Y(e);return A&&(s.set(A,s.currentIndex),s.currentIndex+=A.length),RA(s,t.header),cA(s,e-8-(A?.length||0)),s.set(t.chunkData,s.currentIndex),s}function DA(t,A){return t.find(e=>e.header!=="LIST"?!1:(e.chunkData.currentIndex=0,Z(e.chunkData,4)===A))}function je(t){let A=0;for(;t;){let e=t[t.currentIndex++];if(A=A<<7|e&127,e>>7!==1)break}return A}var $e={name:"INAM",album:"IPRD",artist:"IART",genre:"IGNR",picture:"IPIC",copyright:"ICOP",creationDate:"ICRD",comment:"ICMT",engineer:"IENG",software:"ISFT",encoding:"IENC",midiEncoding:"MENC",bankOffset:"DBNK"};var At=class{constructor(){this.timeDivision=0,this.duration=0,this.tempoChanges=[{ticks:0,tempo:120}],this.copyright="",this.tracksAmount=0,this.lyrics=[],this.firstNoteOn=0,this.keyRange={min:0,max:127},this.lastVoiceEventTick=0,this.midiPorts=[0],this.midiPortChannelOffsets=[0],this.usedChannelsOnTrack=[],this.loop={start:0,end:0},this.midiName="",this.fileName="",this.rawMidiName=void 0,this.embeddedSoundFont=void 0,this.format=0,this.RMIDInfo={},this.bankOffset=0,this.tracks=[]}};function Qe(t,A){let e=0;for(;t>0;){let s=A.tempoChanges.find(o=>o.ticks<t),n=t-s.ticks;e+=n*60/(s.tempo*A.timeDivision),t-=n}return e}var Ho=new Uint8Array([65,16,69,18,16,0,0]),et=class extends At{constructor(A,e=""){super(),yA("%cParsing MIDI File...",r.info);let s=new Y(A),n,o=!1,g=!1,C=!1,Q=Z(s,4);if(s.currentIndex-=4,Q==="RIFF"){s.currentIndex+=8;let S=Z(s,4,void 0,!1);if(S!=="RMID")throw V(),new SyntaxError(`Invalid RMIDI Header! Expected "RMID", got "${S}"`);let D=X(s);if(D.header!=="data")throw V(),new SyntaxError(`Invalid RMIDI Chunk header! Expected "data", got "${S}"`);for(n=D.chunkData;s.currentIndex<=s.length;){let w=s.currentIndex,J=X(s,!0);if(J.header==="RIFF"){let R=Z(J.chunkData,4).toLowerCase();R==="sfbk"||R==="sfpk"||R==="dls "?(m("%cFound embedded soundfont!",r.recognized),this.embeddedSoundFont=s.slice(w,w+J.size).buffer):T(`Unknown RIFF chunk: "${R}"`),R==="dls "&&(C=!0)}else if(J.header==="LIST"&&Z(J.chunkData,4)==="INFO"){for(m("%cFound RMIDI INFO chunk!",r.recognized),this.RMIDInfo={};J.chunkData.currentIndex<=J.size;){let U=X(J.chunkData,!0);this.RMIDInfo[U.header]=U.chunkData}this.RMIDInfo.ICOP&&(o=!0,this.copyright=Z(this.RMIDInfo.ICOP,this.RMIDInfo.ICOP.length,void 0,!1).replaceAll(`
|
|
9
|
+
`}},kt=960,wt=QA.concave;function YA(t,A,e,s,n){return t<<10|A<<9|e<<8|s<<7|n}var Oe=[new j({srcEnum:YA(wt,0,1,0,O.noteOnVelocity),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:129,dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:YA(wt,0,1,1,y.mainVolume),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:13,dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:526,dest:a.fineTune,amt:12700,secSrcEnum:16,transform:0}),new j({srcEnum:650,dest:a.pan,amt:500,secSrcEnum:0,transform:0}),new j({srcEnum:YA(wt,0,1,1,y.expressionController),dest:a.initialAttenuation,amt:kt,secSrcEnum:0,transform:0}),new j({srcEnum:219,dest:a.reverbEffectsSend,amt:200,secSrcEnum:0,transform:0}),new j({srcEnum:221,dest:a.chorusEffectsSend,amt:200,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,0,0,0,O.polyPressure),dest:a.vibLfoToPitch,amt:50,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,0,0,1,y.tremoloDepth),dest:a.modLfoToVolume,amt:24,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.releaseTime),dest:a.releaseVolEnv,amt:1200,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.brightness),dest:a.initialFilterFc,amt:6e3,secSrcEnum:0,transform:0}),new j({srcEnum:YA(QA.linear,1,0,1,y.timbreHarmonicContent),dest:a.initialFilterQ,amt:250,secSrcEnum:0,transform:0})];var gA=128,Ve=147,Ft=new Int16Array(Ve).fill(0),dA=(t,A)=>Ft[t]=A<<7;dA(y.mainVolume,100);dA(y.balance,64);dA(y.expressionController,127);dA(y.pan,64);dA(y.timbreHarmonicContent,64);dA(y.releaseTime,64);dA(y.attackTime,64);dA(y.brightness,64);dA(y.soundController6,64);dA(y.soundController7,64);dA(y.soundController8,64);dA(y.soundController9,64);dA(y.generalPurposeController6,64);dA(y.generalPurposeController8,64);dA(gA+O.pitchWheel,64);dA(gA+O.pitchWheelRange,2);var aA={channelTuning:0,channelTransposeFine:1,modulationMultiplier:2,masterTuning:3,channelTuningSemitones:4},Rt=Object.keys(aA).length,Gt=new Float32Array(Rt);Gt[aA.modulationMultiplier]=1;var fA={Idle:0,RPCoarse:1,RPFine:2,NRPCoarse:3,NRPFine:4,DataCoarse:5,DataFine:6};function ks(t=!1){let A={midiControllers:new Int16Array(Ve),lockedControllers:Array(Ve).fill(!1),customControllers:new Float32Array(Rt),NRPCoarse:0,NRPFine:0,RPValue:0,dataEntryState:fA.Idle,voices:[],sustainedVoices:[],cachedVoices:[],preset:this.defaultPreset,presetUsesOverride:!1,channelTransposeKeyShift:0,channelOctaveTuning:new Int8Array(12),keyCentTuning:new Int16Array(128),channelVibrato:{delay:0,depth:0,rate:0},velocityOverride:0,lockGSNRPNParams:!1,holdPedal:!1,isMuted:!1,drumChannel:!1,lockPreset:!1};for(let e=0;e<128;e++)A.cachedVoices.push([]);this.workletProcessorChannels.push(A),this.resetControllers(this.workletProcessorChannels.length-1),this.sendChannelProperties(),t&&this.callEvent("newchannel",void 0)}function jA(t,A){t.lockPreset||(t.bank=A)}function PA(t){return t.drumChannel?128:t.bank}var xt={velocityOverride:128};var Ze={addMapping:0,deleteMapping:1,clearMappings:2},Xe=class{_keyMappings=[];handleMessage(A,e){switch(A){default:return;case Ze.addMapping:this.addMapping(...e);break;case Ze.clearMappings:this.clearMappings();break;case Ze.deleteMapping:this.deleteMapping(...e)}}addMapping(A,e,s){this._keyMappings[A]===void 0&&(this._keyMappings[A]=[]),this._keyMappings[A][e]=s}deleteMapping(A,e){this._keyMappings[A]?.[e]!==void 0&&(this._keyMappings[A][e]=void 0)}clearMappings(){this._keyMappings=[]}setMappings(A){this._keyMappings=A}getMappings(){return this._keyMappings}getVelocity(A,e){let s=this._keyMappings[A]?.[e];return s?s.velocity:-1}hasOverridePatch(A,e){let s=this._keyMappings[A]?.[e]?.patch?.bank;return s!==void 0&&s>=0}getPatch(A,e){let s=this._keyMappings[A]?.[e];if(s)return s.patch;throw new Error("No modifier.")}};var ws="spessasynth-worklet-system",Fs=350,SA=9,We=16,_e="gs";var wA={loadNewSongList:0,pause:1,stop:2,play:3,setTime:4,changeMIDIMessageSending:5,setPlaybackRate:6,setLoop:7,changeSong:8,getMIDI:9,setSkipToFirstNote:10,setPreservePlaybackState:11},FA={midiEvent:0,songChange:1,textEvent:2,timeChange:3,pause:4,getMIDI:5,midiError:6};function $A(t,A){let e=0;for(let s=8*(A-1);s>=0;s-=8)e|=t[t.currentIndex++]<<s;return e>>>0}function Rs(t,A){if(this.ignoreEvents)return;if(this.sendMIDIMessages&&t.messageStatusByte>=128){this.sendMIDIMessage([t.messageStatusByte,...t.messageData]);return}let e=Re(t.messageStatusByte),s=this.midiPortChannelOffsets[this.midiPorts[A]]||0;switch(e.channel+=s,e.status){case F.noteOn:let n=t.messageData[1];if(n>0)this.synth.noteOn(e.channel,t.messageData[0],n),this.playingNotes.push({midiNote:t.messageData[0],channel:e.channel,velocity:n});else{this.synth.noteOff(e.channel,t.messageData[0]);let g=this.playingNotes.findIndex(C=>C.midiNote===t.messageData[0]&&C.channel===e.channel);g!==-1&&this.playingNotes.splice(g,1)}break;case F.noteOff:this.synth.noteOff(e.channel,t.messageData[0]);let o=this.playingNotes.findIndex(g=>g.midiNote===t.messageData[0]&&g.channel===e.channel);o!==-1&&this.playingNotes.splice(o,1);break;case F.pitchBend:this.synth.pitchWheel(e.channel,t.messageData[1],t.messageData[0]);break;case F.controllerChange:this.synth.controllerChange(e.channel,t.messageData[0],t.messageData[1]);break;case F.programChange:this.synth.programChange(e.channel,t.messageData[0]);break;case F.polyPressure:this.synth.polyPressure(e.channel,t.messageData[0],t.messageData[1]);break;case F.channelPressure:this.synth.channelPressure(e.channel,t.messageData[0]);break;case F.systemExclusive:this.synth.systemExclusive(t.messageData,s);break;case F.setTempo:this.oneTickToSeconds=60/(To(t)*this.midiData.timeDivision),this.oneTickToSeconds===0&&(this.oneTickToSeconds=60/(120*this.midiData.timeDivision),T("invalid tempo! falling back to 120 BPM"));break;case F.timeSignature:case F.endOfTrack:case F.midiChannelPrefix:case F.songPosition:case F.activeSensing:case F.keySignature:case F.sequenceNumber:case F.sequenceSpecific:break;case F.text:case F.lyric:case F.copyright:case F.trackName:case F.marker:case F.cuePoint:case F.instrumentName:case F.programName:this.post(FA.textEvent,[t.messageData,e.status]);break;case F.midiPort:this.assignMIDIPort(A,t.messageData[0]);break;case F.reset:this.synth.stopAllChannels(),this.synth.resetAllControllers();break;default:T(`%cUnrecognized Event: %c${t.messageStatusByte}%c status byte: %c${Object.keys(F).find(g=>F[g]===e.status)}`,r.warn,r.unrecognized,r.warn,r.value);break}}function Gs(){for(let t=0;t<16;t++)this.synth.createWorkletChannel(!0),t===SA&&this.synth.setDrums(this.synth.workletProcessorChannels.length-1,!0)}function To(t){return t.messageData.currentIndex=0,6e7/$A(t.messageData,3)}function xs(){let t=this.currentTime;for(;this.playedTime<t;){let A=this._findFirstEventIndex(),e=this.tracks[A][this.eventIndex[A]];if(this._processEvent(e,A),this.eventIndex[A]++,A=this._findFirstEventIndex(),this.tracks[A].length<=this.eventIndex[A]){if(this.loop){this.setTimeTicks(this.midiData.loop.start);return}this.eventIndex[A]--,this.pause(!0),this.songs.length>1&&this.nextSong();return}let s=this.tracks[A][this.eventIndex[A]];if(this.playedTime+=this.oneTickToSeconds*(s.ticks-e.ticks),this.midiData.loop.end<=e.ticks&&this.loop&&this.currentLoopCount>0){this.currentLoopCount--,this.setTimeTicks(this.midiData.loop.start);return}else if(t>=this.duration){if(this.loop&&this.currentLoopCount>0){this.currentLoopCount--,this.setTimeTicks(this.midiData.loop.start);return}this.eventIndex[A]--,this.pause(!0),this.songs.length>1&&this.nextSong();return}}}function Ms(){let t=0,A=1/0;return this.tracks.forEach((e,s)=>{this.eventIndex[s]>=e.length||e[this.eventIndex[s]].ticks<A&&(t=s,A=e[this.eventIndex[s]].ticks)}),t}var ze=class{constructor(A){this.timeDivision=A.timeDivision,this.duration=A.duration,this.tempoChanges=A.tempoChanges,this.copyright=A.copyright,this.tracksAmount=A.tracksAmount,this.lyrics=A.lyrics,this.firstNoteOn=A.firstNoteOn,this.keyRange=A.keyRange,this.lastVoiceEventTick=A.lastVoiceEventTick,this.midiPorts=A.midiPorts,this.midiPortChannelOffsets=A.midiPortChannelOffsets,this.usedChannelsOnTrack=A.usedChannelsOnTrack,this.loop=A.loop,this.midiName=A.midiName,this.fileName=A.fileName,this.rawMidiName=A.rawMidiName,this.isEmbedded=A.embeddedSoundFont!==void 0,this.RMIDInfo=A.RMIDInfo,this.bankOffset=A.bankOffset}},Hi={duration:99999,firstNoteOn:0,loop:{start:0,end:123456},lastVoiceEventTick:123456,lyrics:[],copyright:"",midiPorts:[],midiPortChannelOffsets:[],tracksAmount:0,tempoChanges:[{ticks:0,tempo:120}],fileName:"NOT_LOADED.mid",midiName:"Loading...",rawMidiName:new Uint8Array([76,111,97,100,105,110,103,46,46,46]),usedChannelsOnTrack:[],timeDivision:0,keyRange:{min:0,max:127},isEmbedded:!1,RMIDInfo:void 0,bankOffset:0};function k(t,A){let e=0;for(let s=0;s<A;s++)e|=t[t.currentIndex++]<<s*8;return e>>>0}function he(t,A,e){for(let s=0;s<e;s++)t[t.currentIndex++]=A>>s*8&255}function v(t,A){t[t.currentIndex++]=A&255,t[t.currentIndex++]=A>>8}function cA(t,A){he(t,A,4)}function Ae(t,A){let e=A<<8|t;return e>32767?e-65536:e}function Ns(t){return t>127?t-256:t}function Z(t,A,e=void 0,s=!0){if(e){let n=t.slice(t.currentIndex,t.currentIndex+A);return t.currentIndex+=A,new TextDecoder(e.replace(/[^\x20-\x7E]/g,"")).decode(n.buffer)}else{let n=!1,o="";for(let g=0;g<A;g++){let C=t[t.currentIndex++];if(!n){if(C<32||C>127){if(s){n=!0;continue}else if(C===0){n=!0;continue}}o+=String.fromCharCode(C)}}return o}}function RA(t,A,e=0){e>0&&A.length>e&&(A=A.slice(0,e));for(let s=0;s<A.length;s++)t[t.currentIndex++]=A.charCodeAt(s);if(e>A.length)for(let s=0;s<e-A.length;s++)t[t.currentIndex++]=0;return t}var eA=class{constructor(A,e,s){this.header=A,this.size=e,this.chunkData=s}};function X(t,A=!0,e=!1){let s=Z(t,4),n=k(t,4),o;return A&&(o=new Y(t.buffer.slice(t.currentIndex,t.currentIndex+n))),(A||e)&&(t.currentIndex+=n),n%2!==0&&t[t.currentIndex]===0&&t.currentIndex++,new eA(s,n,o)}function nA(t,A=void 0){let e=8+t.size;t.size%2!==0&&e++,A&&(e+=A.length);let s=new Y(e);return A&&(s.set(A,s.currentIndex),s.currentIndex+=A.length),RA(s,t.header),cA(s,e-8-(A?.length||0)),s.set(t.chunkData,s.currentIndex),s}function DA(t,A){return t.find(e=>e.header!=="LIST"?!1:(e.chunkData.currentIndex=0,Z(e.chunkData,4)===A))}function je(t){let A=0;for(;t;){let e=t[t.currentIndex++];if(A=A<<7|e&127,e>>7!==1)break}return A}var $e={name:"INAM",album:"IPRD",artist:"IART",genre:"IGNR",picture:"IPIC",copyright:"ICOP",creationDate:"ICRD",comment:"ICMT",engineer:"IENG",software:"ISFT",encoding:"IENC",midiEncoding:"MENC",bankOffset:"DBNK"};var At=class{constructor(){this.timeDivision=0,this.duration=0,this.tempoChanges=[{ticks:0,tempo:120}],this.copyright="",this.tracksAmount=0,this.lyrics=[],this.firstNoteOn=0,this.keyRange={min:0,max:127},this.lastVoiceEventTick=0,this.midiPorts=[0],this.midiPortChannelOffsets=[0],this.usedChannelsOnTrack=[],this.loop={start:0,end:0},this.midiName="",this.fileName="",this.rawMidiName=void 0,this.embeddedSoundFont=void 0,this.format=0,this.RMIDInfo={},this.bankOffset=0,this.tracks=[]}};function Qe(t,A){let e=0;for(;t>0;){let s=A.tempoChanges.find(o=>o.ticks<t),n=t-s.ticks;e+=n*60/(s.tempo*A.timeDivision),t-=n}return e}var Ho=new Uint8Array([65,16,69,18,16,0,0]),et=class extends At{constructor(A,e=""){super(),yA("%cParsing MIDI File...",r.info);let s=new Y(A),n,o=!1,g=!1,C=!1,Q=Z(s,4);if(s.currentIndex-=4,Q==="RIFF"){s.currentIndex+=8;let S=Z(s,4,void 0,!1);if(S!=="RMID")throw V(),new SyntaxError(`Invalid RMIDI Header! Expected "RMID", got "${S}"`);let D=X(s);if(D.header!=="data")throw V(),new SyntaxError(`Invalid RMIDI Chunk header! Expected "data", got "${S}"`);for(n=D.chunkData;s.currentIndex<=s.length;){let w=s.currentIndex,J=X(s,!0);if(J.header==="RIFF"){let R=Z(J.chunkData,4).toLowerCase();R==="sfbk"||R==="sfpk"||R==="dls "?(m("%cFound embedded soundfont!",r.recognized),this.embeddedSoundFont=s.slice(w,w+J.size).buffer):T(`Unknown RIFF chunk: "${R}"`),R==="dls "&&(C=!0)}else if(J.header==="LIST"&&Z(J.chunkData,4)==="INFO"){for(m("%cFound RMIDI INFO chunk!",r.recognized),this.RMIDInfo={};J.chunkData.currentIndex<=J.size;){let U=X(J.chunkData,!0);this.RMIDInfo[U.header]=U.chunkData}this.RMIDInfo.ICOP&&(o=!0,this.copyright=Z(this.RMIDInfo.ICOP,this.RMIDInfo.ICOP.length,void 0,!1).replaceAll(`
|
|
10
10
|
`," ")),this.RMIDInfo.INAM&&(this.rawMidiName=this.RMIDInfo[$e.name],this.midiName=Z(this.rawMidiName,this.rawMidiName.length,void 0,!1).replaceAll(`
|
|
11
11
|
`," "),g=!0),this.RMIDInfo.IALB&&!this.RMIDInfo.IPRD&&(this.RMIDInfo.IPRD=this.RMIDInfo.IALB),this.RMIDInfo.PRD&&!this.RMIDInfo.IALB&&(this.RMIDInfo.IALB=this.RMIDInfo.IPRD),this.bankOffset=1,this.RMIDInfo[$e.bankOffset]&&(this.bankOffset=k(this.RMIDInfo[$e.bankOffset],2))}}C&&(this.bankOffset=0)}else n=s;let B=this.readMIDIChunk(n);if(B.type!=="MThd")throw V(),new SyntaxError(`Invalid MIDI Header! Expected "MThd", got "${B.type}"`);if(B.size!==6)throw V(),new RangeError(`Invalid MIDI header chunk size! Expected 6, got ${B.size}`);this.format=$A(B.data,2),this.tracksAmount=$A(B.data,2),this.timeDivision=$A(B.data,2),this.keyRange={min:127,max:0},this.lyrics=[],this.tempoChanges=[{ticks:0,tempo:120}];let d=null,l=null;this.lastVoiceEventTick=0,this.midiPorts=[];let u=0;this.midiPortChannelOffsets=[],this.usedChannelsOnTrack=[],this.tracks=[];for(let S=0;S<this.tracksAmount;S++){let D=[],w=this.readMIDIChunk(n),J=new Set;if(this.midiPorts.push(-1),w.type!=="MTrk")throw V(),new SyntaxError(`Invalid track header! Expected "MTrk" got "${w.type}"`);let R,U=0;for(this.format===2&&S>0&&(U+=this.tracks[S-1][this.tracks[S-1].length-1].ticks);w.data.currentIndex<w.size;){U+=je(w.data);let N=w.data[w.data.currentIndex],i;if(R!==void 0&&N<128)i=R;else{if(!R&&N<128)throw V(),new SyntaxError(`Unexpected byte with no running byte. (${N})`);i=w.data[w.data.currentIndex++]}let tA=us(i),W;switch(tA){case-1:W=0;break;case-2:i=w.data[w.data.currentIndex++],W=je(w.data);break;case-3:W=je(w.data);break;default:if(U>this.lastVoiceEventTick&&(this.lastVoiceEventTick=U),W=ds[i>>4],(i&240)===F.noteOn){J.add(tA);let IA=w.data[w.data.currentIndex];this.keyRange.min=Math.min(this.keyRange.min,IA),this.keyRange.max=Math.max(this.keyRange.max,IA)}R=i;break}let K=new Y(W),$=w.data.slice(w.data.currentIndex,w.data.currentIndex+W);w.data.currentIndex+=W,K.set($,0);let EA=new Ce(U,i,K);switch(D.push(EA),tA){case-2:switch(i){case F.setTempo:this.tempoChanges.push({ticks:U,tempo:6e7/$A($,3)});break;case F.marker:switch(Z(K,K.length).trim().toLowerCase()){default:break;case"start":case"loopstart":d=U;break;case"loopend":l=U}K.currentIndex=0;break;case F.midiPort:let mA=K[0];this.midiPorts[S]=mA,this.midiPortChannelOffsets[mA]===void 0&&(this.midiPortChannelOffsets[mA]=u,u+=16);break;case F.copyright:o||(this.copyright+=Z(K,K.length,void 0,!1)+`
|
|
12
12
|
`);break;case F.lyric:this.lyrics.push(K)}break;case-3:if(K.slice(0,7).every((IA,mA)=>Ho[mA]===IA)){let IA=K.slice(7,$.length-3),mA=Z(IA,IA.length)+`
|
|
@@ -136,7 +136,7 @@ export class WorkletKeyModifierManager
|
|
|
136
136
|
hasOverridePatch(channel, midiNote)
|
|
137
137
|
{
|
|
138
138
|
const bank = this._keyMappings[channel]?.[midiNote]?.patch?.bank;
|
|
139
|
-
return bank !== undefined && bank
|
|
139
|
+
return bank !== undefined && bank >= 0;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
package/utils/buffer_to_wav.js
CHANGED
|
File without changes
|