Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39625 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2021-03-11 21:43 -0800 |
| Last post | 2021-03-16 23:02 -0700 |
| Articles | 20 on this page of 22 — 4 participants |
Back to article view | Back to comp.lang.javascript
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
Page 1 of 2 [1] 2 Next page →
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-11 21:43 -0800 |
| Subject | Making my own midinote sheduler? |
| Message-ID | <8e156cd8-8f07-4fea-98bd-20dceb96c3afn@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2021-03-12 15:03 +0100 |
| Message-ID | <ib1al4FrhdmU1@mid.individual.net> |
| In reply to | #39625 |
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
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-12 09:08 -0800 |
| Message-ID | <f2bb4c7a-507f-482b-b324-e20043a54b29n@googlegroups.com> |
| In reply to | #39626 |
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 finally found an example of audiocontext.currenttime, and i will see if i can just it as a trigger for my own function which i thought was rather clever.
It is said to be very exact. "audiocontext.currentime"
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 05:22 -0800 |
| Message-ID | <acdf8452-bee6-4f9f-bca6-6c6c332b2293n@googlegroups.com> |
| In reply to | #39626 |
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
I spent night trying to figure out how the audiocontext scheduler really works but i must say i am not sure why it does what it does and why the approach so convoluted.
It seem that the scheduler is not the code responsible for the actual interval? because if you replace playSound() with a drawOut() "of interval" nothing happen the loop just spinn?.
So then i look at the stepadd function, i see there is a frequensy set not important, i can see the osc start at specific time of stepAdd in the loop.
But what i just can't figure out from the loops how often is stepAdd actually called from scheduler.
currentTime is just the timer running along timeline? It seem to me stepAdd looping +=0.5 would immediately be bigger then currentTime and playSound called infinttely many times?
I really do not understand the concept, do you, or anyone else?
1. Is playSound really just called one time every 0.5 second, if so why? because when i render instead of playsound nothing happen.
2. If its actually playSound itself that cause the interval of calss, how i can not read it out in code?
3. If i missunderstood it all and playSound really got nothing todo with the interval of calls, please show me replace it with something rendered out.
function playSound(stepAdd) {
var osc = audioContext.createOscillator();
osc.connect(audioContext.destination);
osc.frequency.value = 500;
osc.start(stepAdd);
osc.stop(stepAdd + 0.1);
};
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext();
var stepAdd = audioContext.currentTime;
var nextNote = document.getElementById("nextNote");
var startBtn = document.getElementById("startBtn");
var stopBtn = document.getElementById("stopBtn");
var timerID;
function scheduler() {
while(stepAdd < audioContext.currentTime + 0.1) {
stepAdd += 0.5;
playSound(stepAdd);
}
timerID = window.setTimeout(scheduler, 100.0);
}
scheduler();
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 08:59 -0800 |
| Message-ID | <bf21ccef-97bd-4eea-86b3-8d51678b260an@googlegroups.com> |
| In reply to | #39626 |
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
Right now i stripped down my laggy play to a minimum, but i do not quite see how to adapt it to audioContext calls in intervals.
I simply use two arrays and shift them after each note played. I really need a playup that keep time and probably could do it if i just understand how the audioContext timer work.
function STARTPLAY(){
if (keepGoing) {
if (copyEv.length) {
outportarr[outportindex].send(noteMessage.shift(),copyEv.shift());
}
stopRec=setTimeout(STARTPLAY,copyEv[0]);
}
}
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 10:22 -0800 |
| Message-ID | <3921623d-73b0-4482-b2f6-8a73477e5bdcn@googlegroups.com> |
| In reply to | #39626 |
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();
}
}
}
}
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 10:26 -0800 |
| Message-ID | <93f0ed6b-e63a-4e73-9015-9c124a50e670n@googlegroups.com> |
| In reply to | #39633 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 10:31 -0800 |
| Message-ID | <1c48627e-7802-4a97-9833-ad2c41dc3131n@googlegroups.com> |
| In reply to | #39633 |
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();
> }
> }
> }
> }
Well ideally i would want to make the calls to STARTPLAY using the audiocontext timer be dependent on evTiming is that possible?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-13 10:35 -0800 |
| Message-ID | <3c2bca94-38f9-4797-a4ea-dfdc8d7f7e6en@googlegroups.com> |
| In reply to | #39635 |
lördag 13 mars 2021 kl. 19:31:36 UTC+1 skrev Jonas Thörnvall:
> 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();
> > }
> > }
> > }
> > }
> Well ideally i would want to make the calls to STARTPLAY using the audiocontext timer be dependent on evTiming is that possible?
So dynamic calls using audiocontext timer anyone?
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2021-03-14 18:22 +0100 |
| Message-ID | <ib6v2oFh1jU1@mid.individual.net> |
| In reply to | #39636 |
Jonas Thörnvall: [...] > So dynamic calls using audiocontext timer anyone? No. And it would be MUCH easier to read your posts if you would not write down every single thought you had - because one can never know if this is your final question or if you want to post another 5-10 posts with your thoughts before finally getting the the point! Your posts about this topic just before this question: 2021-03-12 18:08 2021-03-13 14:22 2021-03-13 17:59 2021-03-13 19:22 2021-03-13 19:26 2021-03-13 19:31 This is not a chat! Even Google Groups is not a chat! -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-14 11:15 -0700 |
| Message-ID | <91a27f87-48b5-4ceb-b251-2cb6f5bb2621n@googlegroups.com> |
| In reply to | #39639 |
söndag 14 mars 2021 kl. 18:22:40 UTC+1 skrev Arno Welzel: > Jonas Thörnvall: > > [...] > > So dynamic calls using audiocontext timer anyone? > No. > > And it would be MUCH easier to read your posts if you would not write > down every single thought you had - because one can never know if this > is your final question or if you want to post another 5-10 posts with > your thoughts before finally getting the the point! > > Your posts about this topic just before this question: > > 2021-03-12 18:08 > 2021-03-13 14:22 > 2021-03-13 17:59 > 2021-03-13 19:22 > 2021-03-13 19:26 > 2021-03-13 19:31 > > This is not a chat! Even Google Groups is not a chat! > -- > Arno Welzel > https://arnowelzel.de Its become one know, you don't have to like my post not even answer them.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-14 13:37 -0700 |
| Message-ID | <576eb266-fd2a-41c0-9d54-a97f05aeec83n@googlegroups.com> |
| In reply to | #39640 |
söndag 14 mars 2021 kl. 19:15:40 UTC+1 skrev Jonas Thörnvall:
> söndag 14 mars 2021 kl. 18:22:40 UTC+1 skrev Arno Welzel:
> > Jonas Thörnvall:
> >
> > [...]
> > > So dynamic calls using audiocontext timer anyone?
> > No.
> >
> > And it would be MUCH easier to read your posts if you would not write
> > down every single thought you had - because one can never know if this
> > is your final question or if you want to post another 5-10 posts with
> > your thoughts before finally getting the the point!
> >
> > Your posts about this topic just before this question:
> >
> > 2021-03-12 18:08
> > 2021-03-13 14:22
> > 2021-03-13 17:59
> > 2021-03-13 19:22
> > 2021-03-13 19:26
> > 2021-03-13 19:31
> >
> > This is not a chat! Even Google Groups is not a chat!
> > --
> > Arno Welzel
> > https://arnowelzel.de
> Its become one know, you don't have to like my post not even answer them.
Well one thing for sure the internal, midi queing "timer"
Isn't exactly steady, does marvelous for ending time, but make music sound totally weird and out of sync.
oldTime=0;
seqTimers=[];
function STARTPLAY(){
for (var i=0;i<copyEv.length;i++) {
oldTime=oldTime+copyEv[i];
seqTimers[i]=oldTime;
}
recurseTime();
}
function recurseTime(){
if(noteMessage.length){
outportarr[outportindex].send(noteMessage.shift(),seqTimers.shift());
recurseTime();
}
}
[toc] | [prev] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2021-03-15 17:49 +0100 |
| Message-ID | <604f8fff$0$13956$e4fe514c@newszilla.xs4all.nl> |
| In reply to | #39625 |
On 3/12/21 6:43 AM, Jonas Thörnvall wrote:
> 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.
>
Since you keep blabbing on about this I finally typed "javascript
midiplayer timing" in Google and one of the first hits was a page
mentioning the WebAudio API and how that has a precise scheduling system.
Stop firing off questions to this NG if you have not tried finding the
requested information yourself. And above all: try to find and process
documentation about programming in general, doing so in JavaScript and
possibly specific APIs that might be designed to solve exactly your
problems. You think you are very smart but you behave like an idiot
doing the same thing over and over expecting different results every time.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-15 11:06 -0700 |
| Message-ID | <eab9d43a-fc80-48a9-b63d-84437ac85290n@googlegroups.com> |
| In reply to | #39656 |
måndag 15 mars 2021 kl. 17:49:21 UTC+1 skrev Silvio:
> On 3/12/21 6:43 AM, Jonas Thörnvall wrote:
> > 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.
> >
> Since you keep blabbing on about this I finally typed "javascript
> midiplayer timing" in Google and one of the first hits was a page
> mentioning the WebAudio API and how that has a precise scheduling system.
>
> Stop firing off questions to this NG if you have not tried finding the
> requested information yourself. And above all: try to find and process
> documentation about programming in general, doing so in JavaScript and
> possibly specific APIs that might be designed to solve exactly your
> problems. You think you are very smart but you behave like an idiot
> doing the same thing over and over expecting different results every time.
Well since you found it isn't it weird that you omit the link to it?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-15 11:12 -0700 |
| Message-ID | <09d3a1fc-ed27-4a3a-b557-2b38be4b9ef7n@googlegroups.com> |
| In reply to | #39656 |
måndag 15 mars 2021 kl. 17:49:21 UTC+1 skrev Silvio:
> On 3/12/21 6:43 AM, Jonas Thörnvall wrote:
> > 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.
> >
> Since you keep blabbing on about this I finally typed "javascript
> midiplayer timing" in Google and one of the first hits was a page
> mentioning the WebAudio API and how that has a precise scheduling system.
>
> Stop firing off questions to this NG if you have not tried finding the
> requested information yourself. And above all: try to find and process
> documentation about programming in general, doing so in JavaScript and
> possibly specific APIs that might be designed to solve exactly your
> problems. You think you are very smart but you behave like an idiot
> doing the same thing over and over expecting different results every time.
There is nothing precise about any of the halfbaked attempts the so called self professional offers. They are even more miserable then my halfbaked attempts.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2021-03-16 00:58 +0100 |
| Message-ID | <ibaalvFklsbU1@mid.individual.net> |
| In reply to | #39661 |
Jonas Thörnvall: > There is nothing precise about any of the halfbaked attempts the so > called self professional offers. They are even more miserable then > my halfbaked attempts. Maybe this helps if your goal is to play MIDI via JavaScript: <https://github.com/rism-digital/midi-player> -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-15 19:07 -0700 |
| Message-ID | <279032ba-6f19-436f-8e32-06521bedba53n@googlegroups.com> |
| In reply to | #39662 |
tisdag 16 mars 2021 kl. 00:59:03 UTC+1 skrev Arno Welzel: > Jonas Thörnvall: > > There is nothing precise about any of the halfbaked attempts the so > > called self professional offers. They are even more miserable then > > my halfbaked attempts. > Maybe this helps if your goal is to play MIDI via JavaScript: > > <https://github.com/rism-digital/midi-player> > -- > Arno Welzel > https://arnowelzel.de No i already play midi i want any type of timer that can fire function calls with a precision of at least 2.5 ms. "Real" old days midi used 96 PPQ, that is 96 timesteps per quarter note and probably real bad quantisation. So a bar is 4/4 equals 384 timesteps and given 100 BPM a bar is 2.4 second long. So 384/2.4=160 timesteps per second. And that is 0.00625 equal 6.25 ms. Today sequensers use 960 PPQ so 3840 timesteps per bar, which would result 0.625 ms A resolution of 6.25 ms is just not good enough when notes tightly played/packed, especially since from what i know only single notes can be triggered during an event. Probably a resolution <2.5 ms would sound ok it is hard to say.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-16 05:19 -0700 |
| Message-ID | <5c382ca8-0a84-48c9-aaad-715e290893cen@googlegroups.com> |
| In reply to | #39663 |
tisdag 16 mars 2021 kl. 03:07:51 UTC+1 skrev Jonas Thörnvall: > tisdag 16 mars 2021 kl. 00:59:03 UTC+1 skrev Arno Welzel: > > Jonas Thörnvall: > > > There is nothing precise about any of the halfbaked attempts the so > > > called self professional offers. They are even more miserable then > > > my halfbaked attempts. > > Maybe this helps if your goal is to play MIDI via JavaScript: > > > > <https://github.com/rism-digital/midi-player> > > -- > > Arno Welzel > > https://arnowelzel.de > No i already play midi i want any type of timer that can fire function calls with a precision of at least 2.5 ms. > "Real" old days midi used 96 PPQ, that is 96 timesteps per quarter note and probably real bad quantisation. > So a bar is 4/4 equals 384 timesteps and given 100 BPM a bar is 2.4 second long. So 384/2.4=160 timesteps per second. > And that is 0.00625 equal 6.25 ms. > > > Today sequensers use 960 PPQ so 3840 timesteps per bar, which would result 0.625 ms > A resolution of 6.25 ms is just not good enough when notes tightly played/packed, especially since from what i know only single notes can be triggered during an event. > Probably a resolution <2.5 ms would sound ok it is hard to say. setInterval using 1 ms call have a delay of 500%
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2021-03-16 06:20 -0700 |
| Message-ID | <7aabf4e0-814d-4a83-92a4-aa04ecd42e23n@googlegroups.com> |
| In reply to | #39665 |
On Tuesday, March 16, 2021 at 7:19:23 AM UTC-5, jonas.t...@gmail.com wrote: > setInterval using 1 ms call have a delay of 500% You've been told multiple times now that you can't set a delay that low: <https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval#delay_restrictions>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-03-16 08:10 -0700 |
| Message-ID | <5edf95bc-9160-48c0-ab23-a1ffd6c7e714n@googlegroups.com> |
| In reply to | #39666 |
tisdag 16 mars 2021 kl. 14:20:40 UTC+1 skrev Michael Haufe (TNO): > On Tuesday, March 16, 2021 at 7:19:23 AM UTC-5, jonas.t...@gmail.com wrote: > > > setInterval using 1 ms call have a delay of 500% > You've been told multiple times now that you can't set a delay that low: > > <https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval#delay_restrictions> And then i asked what is the cure ,for latency building up, i had ideas splitting up setInterval into seconds or 10 th of seconds and just play the notes within interval, Before next set interval called but already at 1 sec intervals a song of 4-5 minutes fluctuate with seconds and with 10th of second intervals the length fluctuate with some 10% of the song...... Then we have not accounted for the internal fluctuation of notes within interval, because it is overall as shitty outer weither you use setinterval or settimout there. Probably setTimout is less call causing less latency. Because why bother quantize with such lag within a second or 10th of second. The midiAPI is tragic that is my final verdict, you will have to extrapolate for the latency caused by bad timing by doing a heuristic model playing up notes, And if you have alot of things happening within under 5 ms and building up tough luck there is no way around it. Yeah it is pretty shitty.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web