Using HOP in flowstone

For general discussion related FlowStone
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Using HOP in flowstone

Post by kortezzzz »

There were several posts that mentioned HOP during the years, but still none of them really explained why, when and where you can get the advantage out of this HOP method. I would love to hear a little about it or get any link to a relevant information. I've tried google, but couldn't find a detailed explanation that refers to the audio section.

Thanks.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Using HOP in flowstone

Post by martinvicanek »

It’s about cpu load.
Dsp code is carried out once every sample (e.g. 44100 times each second). But not all operations need such frequent updating. For instance the coefficients of an EQ filter will not change at all most of the time. It would be wasteful to update those at sample rate. With hop(1024) you update only each 1024th pass, i.e. 50x per second, which is still sufficient but at much lower cpu.
User avatar
guyman
Posts: 207
Joined: Fri Mar 02, 2018 8:27 pm

Re: Using HOP in flowstone

Post by guyman »

Is it possible to create a dspcode layout that enables/disables hop? like in one instance I might have a static set of parameters, and then after hitting a switch those parameters would become dynamic. Would it increase efficiency / save cpu - to implement a switch in a block of code, going from some hop (x) setting to updating every sample when dynamic parameters are active?

If so, how?
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Using HOP in flowstone

Post by kortezzzz »

Thank you very much for the explaination, Martin. That's a very understandable. How would you determine hop which in charge of sample\stream reading? is the best settings for that would be just 1 (since it's dynamic on every key note press)? or it's better to go up to 1024 with it?
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Using HOP in flowstone

Post by martinvicanek »

Not sure what you mean by sample/stream reading. Key press events will hardly be accurate to 1 milisecond, so you could hop(32) the detection (and processing) of such events.
User avatar
guyman
Posts: 207
Joined: Fri Mar 02, 2018 8:27 pm

Re: Using HOP in flowstone

Post by guyman »

@Martin I think you got what he asked. Maybe to reword it for detail.. What hop(x) is appropriate for what tasks?
What is you logic when determining how many samples you are hopping?

I just started implementing hop the other day, and I just run a sine wave through my schematic, and if I hear too much noise when there are moving parameters, I reduce hop.... I personally found filters need NO HOP if am going to be moving them...

Is there an assembly > dspcode translator? I went to remove hop(x) from a martin filter in assem, and could only hope I was snipping at the code correctly...
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Using HOP in flowstone

Post by martinvicanek »

guyman wrote:Is there an assembly > dspcode translator?
No, but there is the opposite. If you connect a text box to the uppermost right pin of a code box you'll get the ASM code. This may be useful to understand what is going on under the hood. It is also a good starting point for optimization.

I went to remove hop(x) from a martin filter in assem, and could only hope I was snipping at the code correctly...

The following DSP code

Code: Select all

hop(32){
    <hopped code block>
    }
translates to this ASM code:

Code: Select all

mov eax,ecx;
and eax,31;    // note this is not a typo!
cmp eax,0;
jnz continue;
    <hopped code block>
continue:
To unhop comment the following lines:

Code: Select all

//mov eax,ecx;
//and eax,31;    // note this is not a typo!
//cmp eax,0;
//jnz continue;
    <hopped code block>
//continue:
Last edited by martinvicanek on Sat Nov 02, 2019 7:45 pm, edited 1 time in total.
User avatar
guyman
Posts: 207
Joined: Fri Mar 02, 2018 8:27 pm

Re: Using HOP in flowstone

Post by guyman »

Thanks Martin !
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Using HOP in flowstone

Post by kortezzzz »

Thanks Martin,
I understood. By the way, does hop somehow effects performance? like increasing latency or such?
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Using HOP in flowstone

Post by martinvicanek »

Latency, well yes, sort of. If you process external events at hop(1024), say, then in the worst case you may have a delay of 23 ms. On average it will be half that value, so you could call it latency.

Basically the decision whether or not to hop and how much includes the following considerations:
Is it worth it? Does the code block in question contain cpu-heavy operations to worry about?
How often does the result need to be updated?
Post Reply