Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

how to add offset

For general discussion related FlowStone

how to add offset

Postby tester » Tue Aug 05, 2014 1:08 am

I have a little fellow here, taken from wave player.

What I'd like to do - I'd like to add an offset (through additional node) to this circular counter, so that it starts counting somewhere in between (and ends exactly at this point). In practice, this should give a way to manipulate the starting point of the playback within a loop.

Offset would be calculated in percents, from total amount of samples, but this is a minor detail.
Attachments
offset.fsm
(1.7 KiB) Downloaded 1036 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 add offset

Postby tester » Tue Aug 05, 2014 2:56 pm

What I'm stuck with is - how to make it sample accurate, or to be more precise - how to not exceed boundaries, and keep the looping - sample accurate. The problem is - code component acts in float precision (clip lenght is provided with int), and clips to be used are 5 or 10 or more minutes long. Which means rounding if I understand correctly. Which means problems...

Any help?
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 add offset

Postby Exo » Tue Aug 05, 2014 3:23 pm

I have just uploaded a sample player with start and end loop points on Flowstone Guru HERE.

Maybe that helps, I don't think it does exactly what you want. It doesn't ever loop beyond the end of the sample but I think that should be a good starting point for you.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: how to add offset

Postby KG_is_back » Tue Aug 05, 2014 3:48 pm

First thing comes to my mind is to add this peace of code after the counter:

Code: Select all
streamin i; //the counter output
streamin length; //of the loop
streamin offset; //in samples
streamout j;

j=(i+offset)%length;


You shouldn't worry about precision. float mantissa is 23bit (+1bit the significant one) = 16777216 is the max integer value stored looselesly. That is over 380seconds in 44.1K which is roughly 6minutes.
Stock wave read prim also uses float as index input.
I can make an alternative counter (and wave read) if you what which will use int format for indexing and float for fractions (for interpolation). Would you like that?
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Postby tester » Tue Aug 05, 2014 5:13 pm

I will definately have long files here, probably typical range between 8 to 20 minutes (or more), and at higher sampling rates. Second thing - files will be mixed at various speeds, up to 32x faster I guess (which means that 32 minutes long loop will last for 1 minute only in such case). Exports rounded to c.a. 1-3 hours.

While I can prepare input files to be loopable, what worries me - are the crosspoints.

If you would be so kind to remake the counter (it will work in mono4 mode), to accept initial offset, I would be grateful.

BTW, the waveplayer I use, is like this. Is this what you have in mind?
Attachments
waveread.fsm
(885 Bytes) Downloaded 1067 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 add offset

Postby KG_is_back » Tue Aug 05, 2014 8:07 pm

the stock sampler counter works as following:
Code: Select all

c=c+step;
index=rndint(c+0.5);
frac=c-index;

As c grows, the frac is less and less precise, because is calculated as a difference between two big numbers.
My works differently. Here is a code version. Note that in provided ASM version the index, c and length are handled as doubleword integers, not floats.

Code: Select all
streamin length;
streamin step;
streamin start;
streamout index;
streamout frac;

float temp=0;
float c=0;

stage(0){
frac=-step;
c=start;
//because of this, after the first sample frac is 0 and index is start;

}
stage(2){
temp=frac+step;
frac=temp%1; //the fractional part;
temp=temp-frac; //the integer part;
c=c+temp;
c=c-length & (index>=length);
index=c;
}

because the index and fractional part are calculated separately, fraction retains maximum precision (because is in 0-1 range and no rounding is happening) while index can be of any size, because is calculated separately from frac.
Attachments
counteerInt.osm
(1.96 KiB) Downloaded 1050 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Postby tester » Tue Aug 05, 2014 11:06 pm

Thanks. Question - did you do something to the ASM version, that it is not working in mono4 mode? When I connect ints directly - it works with offset, when through mono4 mixer - it works as if there was no offset.

//edit: okay, I have that part.

Hmm... It works a little bit funny. I need to restart blue routing twice in order to get the right offset. Any ideas why?
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 add offset

Postby KG_is_back » Tue Aug 05, 2014 11:45 pm

The offset is set at stage(0) ...try moving all of your offset calculation into stage(0). Note that wave read primitives work also in stage2, so this will not work with them at all.

Here is a version that does it in stage(2);
for a very small cpu cost. Basically it first checks a variable "firstsample" if it's zero. if not then it does the thing and sets the "firstsample=0". if not then skips the part.
This will not work properly in poly though. (should be fine in mono and mono4)

If that doesn't help then maybe the offset is not calculated at that time yet (greenery stuff perhaps). In that case It will need to either reset every time the offset changes, or update the offset every time it changes.
Attachments
counteerInt.osm
(2.46 KiB) Downloaded 1085 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Postby tester » Wed Aug 06, 2014 12:46 am

I will check tomorrow, thanks. Generally offset is set before starting the playback, so the whole blue wiring (counters and player separately) is being reset by selector.

CPU isn't a big problem right now, consumption is around windows error. I guess the whole thing will eat not more than 5-10% before adding FFT filtering.
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 add offset

Postby tester » Wed Aug 06, 2014 1:01 am

Offset works. But it looks, that additionally some sort of retrig would be required when the counter starts (restarting via selector isn't helping here).
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

Next

Return to General

Who is online

Users browsing this forum: No registered users and 89 guests