how to add offset

For general discussion related FlowStone
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Post by KG_is_back »

Here you go...
I have just added a few lines of code that will add length to counter if it's smaller than 0; Now the looping works in both directions.
To reverse, you just make the step negative.
Attachments
counteerInt.osm
(2.62 KiB) Downloaded 1143 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to add offset

Post by tester »

Thanks. Now I need to wire a little bit of stuff and check if there are no errors.
But reverse speech sounds cool. :mrgreen:
.looc sdnuos hceeps esrever tuB :mrgreen:
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

Post by tester »

Quick question. If the audio is played back at such slower speeds (several octaves) - is there a way smooth them a little bit, to remove these digital sounding artifacts? Would it be some sort of oversampling or some stuff like that useful here?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Post by KG_is_back »

You need better interpolation. With linear interpolation the algorithm simply connects the points with straight lines - however real wave is smooth, so it is distorting it, creating aliasing which results in nasty artifacts you are mentioning. With pitch shifting down, they become rather obvious because you are basically "zooming in" on the wave or upsampling it.

You need better interpolation algorithm that interpolates the waves "smoother" (closer to original). Many such algorithms exist and many were implemented in FS/SM. Just search for "interpolation".

The difference between interpolation and oversampling is, that interpolation is an operation of calculating "inbetween" values in sampled signal, while oversampling is increasing number of samples per section of sampled signal. Basically you oversample using interpolation to make up the missing samples.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to add offset

Post by tester »

As I thought, thanks for confirming.

So oversampling modules for interpolation, yes? As far I remember, there were triangular and polyphase modules for that. Since I work on octaves here, it would fit 1:1 at the end.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Post by KG_is_back »

If you are working in octaves, then the oversampling will do the task quite good (basically the points you are looking for are identical with those that the oversampling provide).
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to add offset

Post by tester »

I found two things, but I'm not sure how to use it in this design (waveplayer).

If I understand correctly, there is only upsample part needed if oversampling is used. In wav player (almost the same as the stock one), there is the counter (yours), something called interpolated "read" that takes mem (audio) and stream values according to counter.

My understanding tells me, that if I use oversampling modules, then it should be placed after that "interpolated read" module, to mess with the stream. But if so, then I'm not sure how to combine these two outputs into single one. Just mix them? Delay one output by one sample?

On the other hand, in "interpolated read" part there is a module responsible for some sort of simple interpolation, but it relies on counter. But again - there might be the problem with the counter itself (fractions).
Attachments
oversampling.fsm
(43.03 KiB) Downloaded 928 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

Post by tester »

Hehe, I found even Trogs notes:

http://synthmaker.co.uk/forum/download/file.php?id=5232

:mrgreen:

and something like this. But no idea yet what worth is it. (plus - it oversamples only within 1 octave range).

And "developer toolkit" (registered area). Is the 0.1.8 the latest version?
Attachments
OversampledWaveplayerDemo.osm
(156.41 KiB) Downloaded 929 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

Post by tester »

Okay, give me few moments to combine my findings. I will need to know whether I did not made mistakes there.

For more than 1 octave, should there be more oversampling than 2x?

//edit:
what worries me about these oversampled examples is, what happens with fract part of the index...
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: how to add offset

Post by KG_is_back »

The "interpolated read" modules within should be of your main interest. Copy them into your schematic and test them.

For oversampling you may use two in tandem. One will be fed by normal counter and one will be fed with counter -(step/2). then the two must go into downsampling. For 4x oversampling you need 4 interpolated reads in tandem each delayed by step/4 more than the previous. And the downsample those 4.

You can actually hear the dramatic drop of aliasing within this schematic, if you use step 8 (basically 8*playback speed = 3 octaves up). I hear no difference on slowing things down though... I would definitely go with better interpolated read modules (provided in that schematic you posted) for improving that.
Attachments
oversampled wave player.fsm
(479.53 KiB) Downloaded 950 times
Post Reply