Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38128
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2020-01-23 14:54 -0800 |
| References | <974481a0-2ccc-43e4-aee3-5075ca956e5c@googlegroups.com> <d7a252f7-f2e0-45cf-aacc-c5a137873897@googlegroups.com> <4d4533cb-fd89-4d89-80e2-1d8c947a4615@googlegroups.com> <358946e6-68d2-4b21-af10-9fdcc4e3a4d8@googlegroups.com> |
| Message-ID | <83be6bc0-68fe-477d-ada7-bbf26bdb5c17@googlegroups.com> (permalink) |
| Subject | Re: Approach to find out parsed values that goes wrong? |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den torsdag 23 januari 2020 kl. 20:48:19 UTC+1 skrev Michael Haufe (TNO):
> On Thursday, January 23, 2020 at 8:55:40 AM UTC-6, Jonas Thörnvall wrote:
> > Den torsdag 23 januari 2020 kl. 13:50:49 UTC+1 skrev Michael Haufe (TNO):
> > > On Wednesday, January 22, 2020 at 11:25:57 PM UTC-6, Jonas Thörnvall wrote:
> > > > I am oarsing a file following a format, even made some what an editor for it.
> > > > However sometimes the values not expected "bad parsed" at some instance.
> > > > But it seem to screw up my listing of the values so i can not even see what the values it goes wrong is, although i see the "events/array element" missing.
> > > >
> > > > Unfortunately for me what ever value that is there prevents me from sorting, the eventlist on time. And since there is several instruments pretty much layed out sequential aftereachother on same channel.
> > > >
> > > > I noticed this because a guy had layed out left and right hand as separate "instruments". So basicly all things played with left hand comes after the ones played with right hand and since there seem to be NaN values in the event list the sort seem to bug out?
> > > >
> > > > I really must say i do hate to parse midi even that the thing i parse from have neatly tied up the 70-style bit structure with labeled objects.
> > > > I still bomb out try to reparse it for my sequenser.
> > > >
> > > > Seeing that i miss event 3289,3290 in list do not help me that much.
> > > > I somehow must find out what they contain.
> > >
> > > Remember that time when I told you to use JSON.parse()?
> >
> > Your a genius Michael it works, thanks!
>
> So I've heard, but not relevant here.
>
> What does reparseMidi() look like now?
Well actually the parsing is still riddled with bugs and really only work "perfect" with single track, single instrument like classical piano pieces or Bach organs. Of course i should write a real parser myself but the bitfiddling so f***ing boring, and take so much time.
The changes was minimal... I do not think i will work more on midi parsing unless someone have suggestion for howto improve it. Can't say for sure that all bugs come from my reparsing "but probably do", that is another aspect of it all.
Here is the minimal changes to file.
// THIS IS THE MAIN FUNCTION FIRST CALLED WHEN PARSING A MIDI FILE
function reparseMidi(){
console.log("reparseMidi");
document.getElementById("keystream").value="";
track=[];
makeTrack();
document.getElementById("keystream").value=importedMidi;
myChannels = importedMidi.split("channel");
parseInfo();
for (var i=1;i<myChannels.length;i++){
//EXTRACT EACH CHANNEL
console.log("****** NEW CHANNEL *********");
channelStart=myChannels[i].indexOf(":");
channelEnd=myChannels[i].indexOf(",");
importChannel=myChannels[i].substring(channelStart+1,channelEnd);
importChannel=parseInt(importChannel);
activetrack=importChannel+1;
document.getElementById("track").value=activetrack;
console.log("ActiveTrack= "+activetrack);
//There can be more "channel posts/objects" then one, on same channel
//alert("Number of parts="+myChannels.length+" This channel="+activetrack+" ChPart ="+myChannels[i]);
parseCC(i);
parsePitchBend(i);
parsePrograms(i);
parseNotes(i);
track[activetrack].midiMess.sort(dynamicSort("time"));
}
maxtrack=16;
for(var i=0;i<maxtrack; i++){
for (var j=0;j<track[i].midiMess.length;j++){
if (track[i].midiMess[j].time===false || Number.isNaN(track[i].midiMess[j].time)){
track[i].midiMess.splice(j, 2);
}
}
}
for (var i=0;i <maxtrack; i++){
track[activetrack].midiMess.sort(dynamicSort("time"));
}
downMixALLEventList();
getNoteTicks(activetrack);
console.log("****** Finished import *********");
//Set to track 1 and close menu
document.getElementById("track").value=1;
changeTrack();
MA();
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 21:25 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 22:05 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 22:10 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 22:41 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 23:12 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-22 22:27 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-23 04:50 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 06:12 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 06:33 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 06:55 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-23 11:48 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 14:54 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 14:58 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 15:00 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-23 15:20 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-23 17:59 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-24 01:03 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-24 05:38 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-24 11:23 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-24 17:12 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-25 06:48 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-26 11:22 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-26 14:17 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-26 22:38 -0800
Re: Approach to find out parsed values that goes wrong? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-28 05:13 -0800
Re: Approach to find out parsed values that goes wrong? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-28 17:35 -0800
Re: Approach to find out parsed values that goes wrong? luserdroog <luser.droog@gmail.com> - 2020-01-24 21:32 -0800
csiph-web