Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37309 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2019-09-20 05:38 -0700 |
| Last post | 2019-09-21 05:40 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.javascript
Write to two separate arrays in realtime. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-20 05:38 -0700
Re: Write to two separate arrays in realtime. Arno Welzel <usenet@arnowelzel.de> - 2019-09-21 11:48 +0200
Re: Write to two separate arrays in realtime. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-21 05:40 -0700
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-09-20 05:38 -0700 |
| Subject | Write to two separate arrays in realtime. |
| Message-ID | <6df2cfcb-3e7a-4a51-90d0-0b21474b77c8@googlegroups.com> |
I write to an array in realtime to record keystrokes.
I would like an array with identical "elements", that i can also edit in realtime and use for rendering purpose.
How do i achieve this, tried to call "write" sequential to another function workArray but it seem flaky do not work?
//RECORD ANY MESSAGE SENT OR KEY PRESSED
function record(message) {
clock = performance.now()-browserLoadTIME+rs;
midievent++;
track[rectrack].midiMess.push({
time: clock,
data0: message.data[0],
data1: message.data[1],
data2: message.data[2]
});
}
function workArray(message){
holdEvents.push({
time: clock,
data0: message.data[0],
data1: message.data[1],
data2: message.data[2]
});
}
[toc] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2019-09-21 11:48 +0200 |
| Message-ID | <guma04F9qicU1@mid.individual.net> |
| In reply to | #37309 |
Jonas Thörnvall: > I write to an array in realtime to record keystrokes. > I would like an array with identical "elements", that i can also edit in realtime and use for rendering purpose. > > How do i achieve this, tried to call "write" sequential to another function workArray but it seem flaky do not work? You can't - JavaScript running in a browser is not suitable for realtime applications as even processing an event will take 10-20 ms. You need align the events to "time slots" e.g. 1/10th or 1/20th of a second. -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-09-21 05:40 -0700 |
| Message-ID | <329c1bc1-dccd-4b55-a57c-de42c3c3d7d9@googlegroups.com> |
| In reply to | #37313 |
Den lördag 21 september 2019 kl. 11:48:58 UTC+2 skrev Arno Welzel: > Jonas Thörnvall: > > > I write to an array in realtime to record keystrokes. > > I would like an array with identical "elements", that i can also edit in realtime and use for rendering purpose. > > > > How do i achieve this, tried to call "write" sequential to another function workArray but it seem flaky do not work? > > You can't - JavaScript running in a browser is not suitable for realtime > applications as even processing an event will take 10-20 ms. You need > align the events to "time slots" e.g. 1/10th or 1/20th of a second. > > > -- > Arno Welzel > https://arnowelzel.de Well i would say it is pretty good, i do not think it is 20 ms, for example the midiloopback is very fast. And push the notes to array seem very fast, even recording notes while playing will not result in "hearable latency" 20 ms you may not hear but 30-40 ms then you notice. It could be a coincidence that the playup just happen to have same relation to the recording of notes, then i am just lucky. Because i really can't hear or feel any mismatch/latency from either realtime playing, nor from recording ***while at same time playing***.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web