Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37572

Re: Signal boundary problem and how to correct it.

Newsgroups comp.lang.javascript
Date 2019-10-17 00:30 -0700
References (3 earlier) <6ee24bac-6fbf-42be-b934-dc0ab2c7ee03@googlegroups.com> <a50c6f57-768d-4f2e-ba26-4c7035fd695a@googlegroups.com> <6a95bf34-e9a0-436b-913e-88007f2c7078@googlegroups.com> <25ea52ae-7494-4441-8e5a-981aaed9ab81@googlegroups.com> <176b8a97-f98e-4c48-8a96-4510e9f3e539@googlegroups.com>
Message-ID <93a233ae-5ee8-40bb-ad7b-bcfe7a7beb93@googlegroups.com> (permalink)
Subject Re: Signal boundary problem and how to correct it.
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den söndag 13 oktober 2019 kl. 09:47:40 UTC+2 skrev Jonas Thörnvall:
> Den söndag 13 oktober 2019 kl. 09:31:27 UTC+2 skrev Jonas Thörnvall:
> > Den söndag 13 oktober 2019 kl. 09:07:30 UTC+2 skrev Jonas Thörnvall:
> > > 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++;
> > > 		}
> > > }
> > 
> > Realise now i solved same problem a different way earlier, either you find the early notes and set them all to time zero. But now i find the noneclosed notes and make a start for them....
> > 
> > But then i would first have to remove the early notes...
> > Well the first approach i did do seem much simpler.
> > 
> > I guess i step back to the earlier solution.
> 
> Just realised it will be even more cumbersome i will have to first find the interval recorded on track and only check with those notes. Probably should have a default empty recording track and then move the notes into the "real track".

Well i fixed so that all recordings go to a separate track, and "after correction applied" move it to "recording" track.

Problem is that i must program the correction...
I think i know in principle howto to it. It is just a bit of a mental excersize to actually do it. So i keep implementing other things, just implemented a quantizer. When you actually understand how they work they are simple just prerender timevalues and move the note to the nearest.

https://midisequenser.000webhostapp.com

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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