Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37539
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-10-13 00:07 -0700 |
| References | <73c2a298-a543-4096-a642-47c5c9a19a84@googlegroups.com> <qnsn4u$vjo$1@gwaiyur.mb-net.net> <93e5326f-a355-43c6-aa85-d5d637dfd395@googlegroups.com> <6ee24bac-6fbf-42be-b934-dc0ab2c7ee03@googlegroups.com> <a50c6f57-768d-4f2e-ba26-4c7035fd695a@googlegroups.com> |
| Message-ID | <6a95bf34-e9a0-436b-913e-88007f2c7078@googlegroups.com> (permalink) |
| Subject | Re: Signal boundary problem and how to correct it. |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den söndag 13 oktober 2019 kl. 08:55:19 UTC+2 skrev Jonas Thörnvall:
> Den lördag 12 oktober 2019 kl. 19:34:16 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 12 oktober 2019 kl. 19:31:58 UTC+2 skrev Jonas Thörnvall:
> > > Den lördag 12 oktober 2019 kl. 16:15:00 UTC+2 skrev Jan Bruns:
> > > > Jonas Thörnvall:
> > > >
> > > > > This is an on and off problem. The general rule for midi is there should
> > > > > be an on "for the specific note, before there is an off for it".
> > > > > Otherwise weird things happen when you playup. One other thing to know,
> > > > > it is the interval between on and off that is played.
> > > > >
> > > > > This problem is due to the musician "user", may push midi notes outside
> > > > > the boundaries of the specified recording time/ slot .
> > > >
> > > > var t=track[rectrack].midiMess;
> > > >
> > > > while (t[i].data0 || undefined && (t[i].data0==144 && t[i].time>=rs)){
> > > >
> > > >
> > > > // So for any midi event related to controller 0, you append a note-off
> > > > event for controller 0, after previous attempts to stop after the first
> > > > non-Note-On Message for Controller 0 (found in a backwards search)
> > > > revealed that you didn't catch many cases?
> > > >
> > > >
> > > >
> > > >
> > > > var savetime=t[0].time;
> > > > var i=0;var j=0;
> > > > earlyfound=false;
> > > >
> > > > while (t[i].time<t[i+1].time && i<t.length-2){
> > > > console.log("savetime "+savetime+"> midimess "+t[i+1].time);
> > > > i++;
> > > > }
> > > >
> > > > if (savetime>t[i+1].time) {earlyfound=true;console.log("found early");}
> > > >
> > > > // earlyfound==(t[0].time>t[t.length-1].time)
> > > >
> > > > j=i+1; // == length-1
> > > > i=0;
> > > > if (earlyfound==true){
> > > > console.log("found early note");
> > > > while (i<j) {
> > > > t[i].time=rs+1;
> > > > i++;
> > > > }
> > > > }
> > > >
> > > > // So, if the last Message in MidiMess has a timestamp before the first
> > > > Message in MidiMess, all Messages except the last get the same timestamp?
> > >
> > > Oh, sorry right now i crossed out the function calls i think?, and for some reason i can not upload updates to host. Refuse me to login.
> > >
> > > But as i said code to scroll thru all must be written i though i done that, but not sure.I do not think i have because you would have to have an array with all "notes" and cross them of after you matched. I think i just do the early cases the ones before any note on....
> > >
> > > So i think i know what is wrong, it just took a time to realise that "starting" off notes could come anywhere in stream.
> > >
> > > Implementing it well not that fun, because i have to keep track of which one that is cleared....
> > >
> > > Was a long time since i did a matching with a conditional loop looking into extra array "if in cleared notes do nothing" else "early case fix it".
> > >
> > > And it have to be done from both side, Start "offs" and end "ons"
> >
> > bascily i am thinking using an array for both cases at start they are filled with unmatched, and you keep going until "all notes matched". Then there can be no more wandering notes.
>
> Well now i see why i thought this indeed will be even more cumbersome then i remembered, had not had my coffee.
Ok i had my coffee, i think this is it "for the early notes case", a bit weird but is seems like the order of the conditions do matter??????
function earlyNotesFix() {
//Note on = 144 Note off = 128
var i=0;
while (track[rectrack].midiMess[i].data0 != undefined && track[rectrack].midiMess[i].time<=re-1)){
var j=0;
while (track[rectrack].midiMess[i].data0!=matchArray[j] && (track[rectrack].midiMess[i].data0==144 || track[rectrack].midiMess[i].data0==128){
if (matchArray[j]==false && track[rectrack].midiMess[i].data0==128){
matchArray[j]=true;
track[rectrack].midiMess.unshift({
time: 0,
data0: 144,
data1: track[rectrack].midiMess[i].data1,
data2: 0
});
console.log("Yeah man");
}
else if (matchArray[j]==true && track[rectrack].midiMess[i].data0==128) {}
else if (matchArray[j]==false && track[rectrack].midiMess[i].data0==144) {matchArray[j]=true;}
else if (matchArray[j]==true && track[rectrack].midiMess[i].data0==144) {}
j++;
}
i++;
}
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-09 08:48 -0700
Re: Signal boundary problem and how to correct it. Jan Bruns <ebay@abnuto.de> - 2019-10-12 14:14 +0000
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-12 10:19 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-12 10:31 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-12 10:34 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-12 23:26 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-12 23:55 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-13 00:07 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-13 00:31 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-13 00:47 -0700
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-17 00:30 -0700
Re: Signal boundary problem and how to correct it. Arno Welzel <usenet@arnowelzel.de> - 2019-10-17 10:34 +0200
Re: Signal boundary problem and how to correct it. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-17 10:08 -0700
csiph-web