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


Groups > comp.lang.javascript > #39634

Re: Making my own midinote sheduler?

Newsgroups comp.lang.javascript
Date 2021-03-13 10:26 -0800
References <8e156cd8-8f07-4fea-98bd-20dceb96c3afn@googlegroups.com> <ib1al4FrhdmU1@mid.individual.net> <3921623d-73b0-4482-b2f6-8a73477e5bdcn@googlegroups.com>
Message-ID <93f0ed6b-e63a-4e73-9015-9c124a50e670n@googlegroups.com> (permalink)
Subject Re: Making my own midinote sheduler?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


lördag 13 mars 2021 kl. 19:22:53 UTC+1 skrev Jonas Thörnvall:
> fredag 12 mars 2021 kl. 15:03:25 UTC+1 skrev Arno Welzel:
> > Jonas Thörnvall: 
> > > function STARTPLAY2(){ 
> > > evTiming=copyEv[0]; 
> > > if (keepGoing) { 
> > > if (copyEv.length) { 
> > > //console.log(performance.now()-oldPerformance); 
> > > if(performance.now()-oldPerformance>evTiming){ 
> > > oldPerformance=window.performance.now(); 
> > > outportarr[outportindex].send(noteMessage.shift(),window.performance.now() + copyEv.shift()); 
> > > } 
> > > } 
> > > STARTPLAY2() 
> > > } 
> > > } 
> > > 
> > > This is my idea, but i do not want to use setTimeout or setInterval fo fire the recursion. Is there any other process i can use. 
> > If 16 ms between two events is fast enough, use 
> > window.requestAnimationFrame(). 
> > 
> > Also see: 
> > <https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame> 
> > 
> > Example for the use to run an animation: 
> > <https://arnowelzel.de/en/projects/example-for-webgl> 
> > 
> > The only downside is, that one frame is not always exactly 16 ms as this 
> > depends on the refresh rate of the display. On displays with 100 or 120 
> > frames per second you only get 10 or 8+1/3 ms. 
> > 
> > 
> > 
> > -- 
> > Arno Welzel 
> > https://arnowelzel.de
> Well i do realise it somehow involve setting playup time to zero and wrap it so outportarr[outportindex].send(noteMessage.shift(),0); 
> But what i do not get is howto make the exact calls using audiocontext to the function, i do find the audiocontext approach convoluted? 
> Could someone show me? 
> 
> function STARTPLAY(){
> evTiming=copyEv[0]; 
> if (keepGoing) { 
> if (copyEv.length) {
> if(performance.now()-oldPerformance>evTiming){ 
> oldPerformance=window.performance.now(); 
> outportarr[outportindex].send(noteMessage.shift()); 
> copyEv.shift(); 
> } 
> } 
> } 
> }
If i use audiocontext how would i settle for a call to STARTPLAY every 10 ms?

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


Thread

Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-11 21:43 -0800
  Re: Making my own midinote sheduler? Arno Welzel <usenet@arnowelzel.de> - 2021-03-12 15:03 +0100
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-12 09:08 -0800
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 05:22 -0800
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 08:59 -0800
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 10:22 -0800
      Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 10:26 -0800
      Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 10:31 -0800
        Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-13 10:35 -0800
          Re: Making my own midinote sheduler? Arno Welzel <usenet@arnowelzel.de> - 2021-03-14 18:22 +0100
            Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-14 11:15 -0700
              Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-14 13:37 -0700
  Re: Making my own midinote sheduler? Silvio <silvio@internet.com> - 2021-03-15 17:49 +0100
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-15 11:06 -0700
    Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-15 11:12 -0700
      Re: Making my own midinote sheduler? Arno Welzel <usenet@arnowelzel.de> - 2021-03-16 00:58 +0100
        Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-15 19:07 -0700
          Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-16 05:19 -0700
            Re: Making my own midinote sheduler? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-16 06:20 -0700
              Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-16 08:10 -0700
              Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-16 08:12 -0700
              Re: Making my own midinote sheduler? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-16 23:02 -0700

csiph-web