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
Re: how to add offset
Thanks. But why to downsample, if input playback goes 2x slower?
Basically, right now I'm trying to combine all these interpolators I found (7 alternatives!) into one single unit, to reduce all these duplicated wavereads and other unneeded stuff, to hear what it sounds like. I will probably use 8x oversampling as well. The noticable difference is not on such sounds as in your example, you would have to take higher ones, like birds. For example - these are only birds (and some EQ and not high reverb) downsampled by (exactly, no retuning) 3 octaves. When I first heard it - well, you can imagine my face.
Basically, right now I'm trying to combine all these interpolators I found (7 alternatives!) into one single unit, to reduce all these duplicated wavereads and other unneeded stuff, to hear what it sounds like. I will probably use 8x oversampling as well. The noticable difference is not on such sounds as in your example, you would have to take higher ones, like birds. For example - these are only birds (and some EQ and not high reverb) downsampled by (exactly, no retuning) 3 octaves. When I first heard it - well, you can imagine my face.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
tester wrote:Thanks. But why to downsample, if input playback goes 2x slower?
It doesn't - it actually goes 2x faster. Oversampling means, that you read more samples (wave wise) per single sample(stream wise). You are NOT converting normally sampled signal into double sampled (upsampling) but vice versa - you sample the sound oversampled (read multiple samples per cycle) and you need to downsample it to normal sampling rate.
BTW those birds sound cool
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: how to add offset
Another quick question.
In these interpolators, there are 4 wave reads per each. Is there any difference on index shifts between them, or it should be just +1 increase in order? I mean - I want to combine them into one unit, all except one have sample index like this:
idx-2
idx-1
idx
idx+1
and one (cubic) like this:
idx-1
idx
idx+1
idx+2
It would be one selector section less if there is no difference.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
...and to summarize, before I'm lost. When oversampling here, there is no need to use the "upsample" part (these oversample modules are in pairs), because wave is being read from mem via precise counter, thus it's enough to shift the stream by 0.5 sample. The "downsample" part can be this "Polyphase IIR" or "Triangular" or "Power Series" (did not found any other type). And in between - waveread can be interpolated by one of these 7 methods. Yes?
I wonder if there will be a signifficant difference on interpolation part.
I wonder if there will be a signifficant difference on interpolation part.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
The output is located between samples idx(0) and idx(-1), so it does matter. You may compensate for that by adding/subtracting 1 form the input index, when needed.
There is nothing to upsample... you are GENERATING the sound in higher sample rate (by reading multiple samples at a time) so you need to downsample it into normal samplerate.
To make it completely true:
in 4x upsampled sample rates, the step in the counter should be 1/4 of original step (as if would be in normal sampling rate). FS doesn't allow you to oversample things in a normal way - you need to do this workaround. You have the counter counting in normal steps, but you have 4 readers:
1. reads the value exactly at index the counter calculates (including the frac part off course)
2. reads from the index-(step/4) (still the index is including the frac part)
3. reads from the index-(2*step/4)
3. reads from the index-(3*step/4)
So you basically read the wave 4 times in quarter steps. Exactly like if the sample rate was 4x higher. Now you just need to downsample them.
Oversampling and downsampling is explained very good at SM wiki. To make long story short - to downsample you need to lowpass the oversampled signal so it doesn't contain anything above the new Nyquist. When that is done all you need to do is to read only every 4th sample without fear of aliasing (aliasing means, that content above Nyquist frequency leaves undesired artifacts, because it fails to recreate in new sample frequency).
And yes, the waveread can be interpolated by one of those methods. My bets are that worse is the round nearest (it basically distorts the wave into staircase), second being the linear (connects samples with straight lines), next being the cubic and best would be Bsplane or the other one. Mathematically perfect interpolation is sinc interpolation (basically a convolution with sinus cardinalis (sinc) function =sin(x)/x, but that takes extremely high CPU load because it needs several hundred samples to read and calculate the sinus and divide), but that one is not given there. However, because of high CPU load, it is useful only for prinnting/offline/non-realtime processing.
tester wrote:...and to summarize, before I'm lost. When oversampling here, there is no need to use the "upsample" part (these oversample modules are in pairs), because wave is being read from mem via precise counter, thus it's enough to shift the stream by 0.5 sample. The "downsample" part can be this "Polyphase IIR" or "Triangular" or "Power Series" (did not found any other type). And in between - waveread can be interpolated by one of these 7 methods. Yes?
There is nothing to upsample... you are GENERATING the sound in higher sample rate (by reading multiple samples at a time) so you need to downsample it into normal samplerate.
To make it completely true:
in 4x upsampled sample rates, the step in the counter should be 1/4 of original step (as if would be in normal sampling rate). FS doesn't allow you to oversample things in a normal way - you need to do this workaround. You have the counter counting in normal steps, but you have 4 readers:
1. reads the value exactly at index the counter calculates (including the frac part off course)
2. reads from the index-(step/4) (still the index is including the frac part)
3. reads from the index-(2*step/4)
3. reads from the index-(3*step/4)
So you basically read the wave 4 times in quarter steps. Exactly like if the sample rate was 4x higher. Now you just need to downsample them.
Oversampling and downsampling is explained very good at SM wiki. To make long story short - to downsample you need to lowpass the oversampled signal so it doesn't contain anything above the new Nyquist. When that is done all you need to do is to read only every 4th sample without fear of aliasing (aliasing means, that content above Nyquist frequency leaves undesired artifacts, because it fails to recreate in new sample frequency).
And yes, the waveread can be interpolated by one of those methods. My bets are that worse is the round nearest (it basically distorts the wave into staircase), second being the linear (connects samples with straight lines), next being the cubic and best would be Bsplane or the other one. Mathematically perfect interpolation is sinc interpolation (basically a convolution with sinus cardinalis (sinc) function =sin(x)/x, but that takes extremely high CPU load because it needs several hundred samples to read and calculate the sinus and divide), but that one is not given there. However, because of high CPU load, it is useful only for prinnting/offline/non-realtime processing.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: how to add offset
I'm not quite sure about one thing. Let me give on example.
If I have a wave played at 1:1 speed, then I have such data:
1
0
1
0
1
0
...
If I have second wave played at 0.5 speed, then at the sample rate I have such data:
1
1
0
0
1
1
0
0
...
Yes, I agree with the 0.5 step. Thus, the wave would be interpolated with itself, and 0's and 1's will depend on interpolation method. To this point we speak with one voice. But...
I'm not so sure why to downsample the thing, and not simply add streams and divide gain by two. Let me explain why. If the wave playback is fixed at 0.5 speed, then interpolation and half-step - will expand the wave to 1:1 accuracy in regards to sample rate so to speak, without artifacts. If the playback was not slower than 1 octave down, then it would introduce aliasing.
By downsampling, in this particular case, it seems to look similar as if generating 24kHz (in terms of sample rate opf course) media at 48kHz sampling rate total. It limits the available band by 2, and returns to the starting point - lower quality, just smoothed slightly differently.
In other words - 2x slower playback compensates 2x upsampling/interpolating. Isn't this right?
If I have a wave played at 1:1 speed, then I have such data:
1
0
1
0
1
0
...
If I have second wave played at 0.5 speed, then at the sample rate I have such data:
1
1
0
0
1
1
0
0
...
Yes, I agree with the 0.5 step. Thus, the wave would be interpolated with itself, and 0's and 1's will depend on interpolation method. To this point we speak with one voice. But...
I'm not so sure why to downsample the thing, and not simply add streams and divide gain by two. Let me explain why. If the wave playback is fixed at 0.5 speed, then interpolation and half-step - will expand the wave to 1:1 accuracy in regards to sample rate so to speak, without artifacts. If the playback was not slower than 1 octave down, then it would introduce aliasing.
By downsampling, in this particular case, it seems to look similar as if generating 24kHz (in terms of sample rate opf course) media at 48kHz sampling rate total. It limits the available band by 2, and returns to the starting point - lower quality, just smoothed slightly differently.
In other words - 2x slower playback compensates 2x upsampling/interpolating. Isn't this right?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
tester wrote:But no idea yet what worth is it. (plus - it oversamples only within 1 octave range).
It's not oversampling at all - it's a very crude PSOLA (Pitch Shift OverLap Add) time stretch algorithm. It only really works well for pitched sounds with a very simple harmonic structure, so I don't think it will help you very much!
tester wrote:And "developer toolkit" (registered area). Is the 0.1.8 the latest version?
Exo has started work again on this toolkit to make it more suitable for FS, it's now hosted on the FlowStone Guru blog site.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: how to add offset
Step 1 done. Interpolation methods. They make audible and signifficant difference (try on voice, 2 octaves lower), but it is not that smooth as it could be (any other interpolation approaches?).
I did not optimized the linear method in this one, because was too tired.
*
As for step 2. I'm not sure if I understand how the concept is mounted in, but when I hear it I know whether it's what it should be.
I did not optimized the linear method in this one, because was too tired.
*
As for step 2. I'm not sure if I understand how the concept is mounted in, but when I hear it I know whether it's what it should be.
- Attachments
-
- interpolations.fsm
- (8.81 KiB) Downloaded 951 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
Step 2 did not brought anything, except for FS crashing when switching things.
Are there any other better methods of interpolation?
//edit:
I finally checked these downsample modes from oversampling thing, and they bring nothing. Only interpolation.
Are there any other better methods of interpolation?
//edit:
I finally checked these downsample modes from oversampling thing, and they bring nothing. Only interpolation.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
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
Found interesting link on interpolation comparisons:
http://kirby.cyberbotx.com/SSEQInterpolation/
http://kirby.cyberbotx.com/SSEQInterpolation/
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Who is online
Users browsing this forum: No registered users and 67 guests