Confusing results from message delay?
-
How do I delay or pause the code then?
When I do this it just ignores the delay (it plays and prints immediately):
-
@VirtualVirgin said in Confusing results from message delay?:
The note on is delayed
I think you're misunderstanding it. The event is delayed, the callback is unaffected.
You can't pause execution, if you want something to happen after two seconds then you need to use a timer or there is a function which I think is called callAfterDelay
-
@d-healey said in Confusing results from message delay?:
@VirtualVirgin said in Confusing results from message delay?:
The note on is delayed
I think you're misunderstanding it. The event is delayed, the callback is unaffected.
You can't pause execution, if you want something to happen after two seconds then you need to use a timer or there is a function which I think is called callAfterDelay
I did see the callAfterDelay when searching for solutions, but it won't be suitable:
A) it says here that it is not reliable for real-time
B) it is expecting a value of 1ms or higher, but I need to pause/delay in a range starting with 1 sample lengthHow would I implement a timer on code statements?
I need to create a pause window, similar to writing a macro where you leave some time to let the previous step(s) process before proceeding to the next step. -
@VirtualVirgin For realtime stuff you need to use the Synth timer.
-
@d-healey said in Confusing results from message delay?:
@VirtualVirgin For realtime stuff you need to use the Synth timer.
Ok :)
Thanks. Watching now. -
@d-healey
This says
"the timer frequency is limited to 40ms":Is that the lower limit for the timer interval?
-
@VirtualVirgin Unless my maths is wrong it will actually go down to 4ms.
Synth.startTimer(0.004);
This is working for me. -
@d-healey said in Confusing results from message delay?:
@VirtualVirgin Unless my maths is wrong it will actually go down to 4ms.
Synth.startTimer(0.004);
This is working for me.Ah, thanks.
This method will not work for me then, as I need to implement delays/pauses starting with a lower limit of 1 sample.
I will have to find something else to do that. -
@VirtualVirgin What is your end goal?
-
@d-healey said in Confusing results from message delay?:
@VirtualVirgin What is your end goal?
This is for a voice exploder. The delay is the processing window for chord input from an arbitrary amount of voices up to 16. They need to all get written to an array before proceeding to the next step of sorting and allocating the voices to independent channels.
The reason for starting with a 1 sample delay window is to allow for quick turnaround for chord inputs where the notes arrive at the same sample (such as the output of harmonizer plugins that output to only one channel).
4ms is way too much budget for such a task.
I may be close to a solution. -
@VirtualVirgin I have a chord detector script which adds notes to an array as they come in and then processes them. Sounds like a similar thing.
Here's a simple snippet that adds note numbers to an array in on note on and removes them in on note off. Works with notes played at the same time and sequentially.
HiseSnippet 731.3ocsUstSaCCE1tzfV6tngzd.xOKSHTaoEnBMMfdYqaqP0JCMooIjiiSiEI1QNNrUMs248FrcbRfFfJtTokeTky8udNemSFqjTVbrTgvUOYVDCgel0jYBseWeBWfF1Cgeg0HRrloryTc3rHRbLyEgwq7NiBbkxnzm+71CIADAkMWEBcpjSYehGx0y0Nd+OxCBFPbYmvCK3cq8GRkhtx.YBfmUrpihHzyISYGQLtUxB8dRrOB+ZKGhScB0ya6lN65UuUy1McbZ41Bz3rSmNc7Z2fzdqcnTDd09tbsTMQSzrXHoGJcmMwW9CQVANkGycBXFgFnIPkyTi55yCbGeYyIFgvkGOuUsRVq5UVi3t7qzOuk8xTC1yinXSCW5tfTiGAjvEfT4LHsl0DphGomawfmmZMT.SPOBLaJBkLeQk9.1pqD7Pn2LjbNafBDtJhZaWu9F1vOquW0pJ1TagDvs8ar+122yKQP0bovVJNBzdrn15U+U0JARJIvV.9LB.AL.2bJSab3njPGlplISURSylQIw9C8.aGDnXD2Ym3yTrZBvieW09lo2y6QmeEKTdwhRn4OrRFDXb2jyaX1vLWrk7.qIRq0F1WPBRXW4HLIt93c0G13kl0+K3nTLTv0GGwxkGHCbMiMy62lLfxGfvaeYXOhlX3G45.+hXJM2.GbO1EvFYFaohUOV74ZYDrSdKpDPhktIAD80Y1lc9bCP+3ZzICkQDy0yJdS3QP2qemz8GJDWyZLWS8WLFKs.LBcp+GXL+Hwys564wn54.rr0futrWDtmx+YYhlKlNhnU7ehvVv9vD3XJkAUWHXAPxsvkLrkL45FYSGXBS3lJ7W3I2XCiLN2XiKMhBITk7LZ1Vf4LzSR0.XRjdltB78BP1tAJcynXeNDtJdl4pbwTcq.atrAt0xFXqkMv1KafaurAtyxF3t2eflOZcPhVFls1fPiF2O8TBF2WP.FXJaE8OLLOJoG
-
@d-healey said in Confusing results from message delay?:
@VirtualVirgin I have a chord detector script which adds notes to an array as they come in and then processes them. Sounds like a similar thing.
Here's a simple snippet that adds note numbers to an array in on note on and removes them in on note off. Works with notes played at the same time and sequentially.
HiseSnippet 731.3ocsUstSaCCE1tzfV6tngzd.xOKSHTaoEnBMMfdYqaqP0JCMooIjiiSiEI1QNNrUMs248FrcbRfFfJtTokeTky8udNemSFqjTVbrTgvUOYVDCgel0jYBseWeBWfF1Cgeg0HRrloryTc3rHRbLyEgwq7NiBbkxnzm+71CIADAkMWEBcpjSYehGx0y0Nd+OxCBFPbYmvCK3cq8GRkhtx.YBfmUrpihHzyISYGQLtUxB8dRrOB+ZKGhScB0ya6lN65UuUy1McbZ41Bz3rSmNc7Z2fzdqcnTDd09tbsTMQSzrXHoGJcmMwW9CQVANkGycBXFgFnIPkyTi55yCbGeYyIFgvkGOuUsRVq5UVi3t7qzOuk8xTC1yinXSCW5tfTiGAjvEfT4LHsl0DphGomawfmmZMT.SPOBLaJBkLeQk9.1pqD7Pn2LjbNafBDtJhZaWu9F1vOquW0pJ1TagDvs8ar+122yKQP0bovVJNBzdrn15U+U0JARJIvV.9LB.AL.2bJSab3njPGlplISURSylQIw9C8.aGDnXD2Ym3yTrZBvieW09lo2y6QmeEKTdwhRn4OrRFDXb2jyaX1vLWrk7.qIRq0F1WPBRXW4HLIt93c0G13kl0+K3nTLTv0GGwxkGHCbMiMy62lLfxGfvaeYXOhlX3G45.+hXJM2.GbO1EvFYFaohUOV74ZYDrSdKpDPhktIAD80Y1lc9bCP+3ZzICkQDy0yJdS3QP2qemz8GJDWyZLWS8WLFKs.LBcp+GXL+Hwys564wn54.rr0futrWDtmx+YYhlKlNhnU7ehvVv9vD3XJkAUWHXAPxsvkLrkL45FYSGXBS3lJ7W3I2XCiLN2XiKMhBITk7LZ1Vf4LzSR0.XRjdltB78BP1tAJcynXeNDtJdl4pbwTcq.atrAt0xFXqkMv1KafaurAtyxF3t2eflOZcPhVFls1fPiF2O8TBF2WP.FXJaE8OLLOJoG
Thanks :)
I'll check this out tomorrow.
I did end up solving for the delay problem by moving the rest of the code into a child container with another script processor.
The notes from the note recorder get delayed by 1 sample, and that gives room for the array to record all of the voices before sorting the order in the next module.
The basic problem that the delay solves is that the array cannot be sorted and reversed until all of the notes are in.It is working so far:
I have a stray note off that I will try to clean up, but at the moment is not effecting the function.