how to remake this counter?

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

how to remake this counter?

Post by tester »

Attaching a counter module, that was created by KG some time ago (with waveread code, that works correctly for audio files longer than few minutes).

The counter works fine, i.e. can go forwards, backwards, supports starting offset and step size.

I recently started a project, in which I noticed, that it eats memory like black hole, but I found what the problem was (wave was recompiled from mem to floats in order to isolate fractions, and then it was compiled back again to mem), and now I need some solution for that. Unfortunately I have no clue what to modify, to make this work.

Generally, I need to set up a startpoint and endpoint for this counter. While I know how to make the endpoint (i.e. just by manipulating the number of samples), I have no clue how to define the startpoint.

By startpoint I mean an initial point, from which this counter should restart, after reaching the endpoint. Not to confuse with offset nodes, which tells, where from to start counting in general (within the range between startpoint and endpoint).
Attachments
counterproblem.fsm
(3.03 KiB) Downloaded 957 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to remake this counter?

Post by tester »

I think I solved it, or at least - it seems to work fine on longer audios.
Attachments
counter solved.fsm
(3.32 KiB) Downloaded 925 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to remake this counter?

Post by tester »

another puzzle to solve.

I need the ability to reset this counter to initial state (which is offset plus range start) via some input node.

Changing (temporarily) values on other inputs during counting cycle has no effect, using selector on output does not reset it too.

Using "clear audio" prim is not an option.

Any help with this one?

(plus switch for looped/single count would be very useful).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to remake this counter?

Post by tester »

I think I fugured out the general concept that would solve the problem of using reset and loop/single mode at once.

In code, general counter goes like this.

i=i+1

So let's add an input "in", that can be either 0 or 1. Then:

i=(i+1)*in

Thus, if in is set to 0, it shuts down the counter to 0, and if it's 1, then the counter starts to count again, and from 0. When used as reset that comes from greenery, time delay should be used (approx 100ms should do) between de/reactivation, and when used as loop/single - just switch between 0 and 1.

Now, my question is related to asm part attached in earlier post. To which section should this additional operation relate? I see in 2 places something like this:

paddd xmm1,Itemp;
movaps c,xmm1;

paddd xmm1,c;
movaps c,xmm1;

should I multiply (normal? special? I ask in context of this paddd operator here) the xmm1 with this additional input (prior to the "c" line), or put this somewhere else?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to remake this counter?

Post by tester »

Generally, the sync node is either 0 or 1, so I thought this shortcut could work.

In two places I added a line:

mulps xmm1,sync;
[then "movaps c,xmm1;" follows]

The good news: it seems to work, also when operating on a longer audio in its further time section (remembering that rounding related limit).

There is no bad news.

However I'd like to know if this approach is correct, or should there be some problem with it. ASM gurus?

*

New node can be used to reset the counter (timer in greenery is needed, probably due to how the greens are updated in regards to streams). In order to use it as a looped/single parameter switch... I forgot what was the idea. Probably some workaround on comparing regular counter with Nsamples node, and outputing trigger to flip that input node to 0. But I'd like to know how to make it in this asm kit, to avoid trigger misses.
Attachments
counter solved expanded.fsm
(3.28 KiB) Downloaded 937 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply