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


Groups > comp.lang.javascript > #34965

Re: Bad timing

Newsgroups comp.lang.javascript
Subject Re: Bad timing
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References (4 earlier) <9cc97d1c-9625-47c0-9fa4-acbc3a8f4a19@googlegroups.com> <8b31acbd-5858-4496-9698-4aaf934ff452@googlegroups.com> <809123f9-7988-438e-baf0-9c79ce06f3e0@googlegroups.com> <XnsA8D56AAC37D86eejj99@194.109.6.166> <8393b918-3835-4958-a8ac-0b48f58d4a46@googlegroups.com>
Date 2018-05-02 11:29 +0200
Message-ID <XnsA8D674D0F71ADeejj99@194.109.6.166> (permalink)

Show all headers | View raw


=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 01
May 2018 in comp.lang.javascript: 

> Den tisdag 1 maj 2018 kl. 10:29:16 UTC+2 skrev Evertjan.:
>> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on
>> 01 May 2018 in comp.lang.javascript: 
>> 
>> > The last midiMess is never played i guess it is inherent to the use
>> > of if array.length and shift()
>> > 
>> > And if i do write if (copyEv.length+1), it play last but i get
>> > undefined which i guess is from try to shift something that isn't
>> > there.... Correct? 
>> > 
>> 
>> Methinks you guess 'wrongly', to quote Trumpian.
>> 
>> Instead of guessing, you should modularly debug your code:
>> 
>> <script type='text/javascript'> 'use strict'
>> 
>> let pyp = 0;
>> let copyEv = [2001,2002,2003,2004];
>> 
>> doPlayup();
>> 
>> function doPlayup() {
>>     if (copyEv.length) {
>>       var waittime = copyEv.shift();
>>       if(pyp>-1) {
>>             //noteOnMessage = [....]; 
>>             //output.send(noteOnMessage);
>>            console.log(pyp, waittime);
>>       }; 
>>       //document.getElementById("keystream").value+=waittime+"\n";
>>       pyp++;
>>       setTimeout(doPlayup, waittime); 
>>     };
>> };
>> </script>
>> 
>> console output:
>> 
>> test.html:17 0 2001
>> test.html:17 1 2002
>> test.html:17 2 2003
>> test.html:17 3 2004
>> 
>> So shift is not the culprit.
> 
> I probably should/can render a dummy "note off" at time zero, maybe that
> is what you suggest? 

No!

I suggested that you debug your modules seperately,
intead of guessing how it works.

Then, if you are satisfied, you treat them as black boxes, and debug only 
the input and output paramreters [and other effects like midi].

I see you now understand more about thee module [function] in question,
but don't even realize the step you made.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


Thread

Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-29 17:27 -0700
  Re: Bad timing JJ <jj4public@vfemail.net> - 2018-04-30 10:43 +0700
    Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-04-30 00:24 -0700
      Re: Bad timing "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-04-30 13:01 -0700
        Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-04-30 17:04 -0700
          Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-05-01 04:33 -0700
        Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:24 -0700
          Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:32 -0700
            Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:44 -0700
              Re: Bad timing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-01 10:29 +0200
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 14:48 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 14:54 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 22:12 -0700
                Re: Bad timing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-02 11:29 +0200
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:35 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:38 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:53 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-04 00:49 -0700
                Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 23:11 -0700
    Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 00:43 -0700
      Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 00:47 -0700
        Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 06:20 -0700

csiph-web