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

BodePlot strange result (Non Linear and Sample Rate Adapt)

For general discussion related FlowStone

Re: BodePlot strange result

Postby Tepeix » Tue Jun 07, 2022 4:46 pm

I get something, but it's a little experimental for now.
(to see what do some filter with different sample rates.)
So i'm not sure it's really a good representation but it seams close.
But it only works with 2x multiple sample rate. (i try to understand why..)
Resampling the array also change the overall level, depending of the filter depth..
So i add the possibility to compare a frequency that is supposed to be unchanged and to adjust the level with it.

I also add another frequency comparator.. But it does'nt seams to be reliable..

Well that's not so good but i will try to see if it's usable or upgradable..
Attachments
Sample rate simulator.fsm
(86.19 KiB) Downloaded 322 times
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby Tepeix » Mon Jun 13, 2022 3:59 pm

Working on a lot of different stuff in chaotic way, i did not test more the precedent plot for now..

But i get the idea for another frequency measurement.

This one is supposed to send any standard (diapason 440hz) notes for some cycles,
from 16,35hz to max 40000, record the max level for each, and send it to an array.

The advantage is that it work with different sample rate. (i hope it work well)
Also it's supposed to work a little for non linear think.
(But non linear could act differently if more than one note is played)
We could test different input level, but i'm not sure i see some change in the test provided..

Also the very high frequency seams buggy. Or is this the true effect of non linear ????
Image

What do you think of this ?
Does it really measure non linear think in some way or is there's more to take into account ?
Also, i suppose it could not works well with high latency filter ?
Attachments
frequency Predictor.fsm
(81.85 KiB) Downloaded 321 times
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby Tepeix » Thu Jun 16, 2022 12:51 pm

A very little upgrade.
Now we could see which frequency or notes are affected.
(just discovering that we could upload a fsm and a png at the same time)
Attachments
Freq Pred2.png
Freq Pred2.png (8.36 KiB) Viewed 8186 times
frequency Predictor2.fsm
(83.63 KiB) Downloaded 331 times
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby adamszabo » Fri Jun 17, 2022 8:18 am

very nice! maybe if you make the frequency output into the sine linear and not exponential the plot will be better? It seems the high frequencies goes up too fast and it cannot do a proper plot thats why it cuts the high frequencies?
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: BodePlot strange result

Postby Tepeix » Fri Jun 17, 2022 3:26 pm

Thanks!
It seams different in frequency from a normal bode plot, and maybe it is a little.
But if you compare with linear filter almost the same curve appear.
I used an exponential to get more faster all note as it take more time to do than a simple impulse then FFT.
Now i think about a parallel processing..
Also, maybe the high frequency need more cycle to be more accurate, Maybe the f8 note is influenced by the e8..

For non linear, the normal bode plot could not give a good result.
It could not take in account the non linear dependency.
So this one is supposed to give something more real.
I tested a little and it's the case !)
It's maybe more an approximation, and in some case they are maybe more event to take into account.
(If we play more than one note, the energy could maybe transfer from bass to high ?)

Also there's a little unexpected result with the non linear test filter provided.
When using a high "feed" value the highest note is offset like this :
Image
Which is very bad.. Effect of aliasing or something else ?
My plot could not take this into account as it measure the max abs value of the signal.
So they are some upgrade to do..
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby martinvicanek » Sun Jun 19, 2022 2:02 pm

Not sure if I understand your goal.

You can measure the frequency response of a device - a biquad low-pass filter in the attached example - by feeding it a broadband signal (for instance a single impulse, a linear or exponential sine sweep, or even a burst of white noise) and analyzing the output. For the analysis, you divide the FFT magnitude of the output by the FFT magnitude of the input. (The division may be omitted for the single impulse because its FFT is equal to 1 for all frequencies.)

For the phase response (not shown in the example), you would subtract the (unwrapped) phase of the input from the (unwrapped) phase of the output.

If you want to trace out the frequency response the pedestrian way, i.e. use as input a sine wave of a given frequency and measure the output amplitude, then do the same for the next frequency, and so on, you have to measure long enough at each step so that the output reaches steady state.

However, Bode analysis strictly applies only to LTI (linear, time independent) systems. A nonlinear device will not only change the amplitude and phase of a sine wave, but also the shape. In the frequency domain, this manifests as higher harmonics of the original (fundamental) frequency of the sine wave, not captured in a Bode analysis.
Attachments
measuring filter response.fsm
(28.91 KiB) Downloaded 312 times
User avatar
martinvicanek
 
Posts: 1318
Joined: Sat Jun 22, 2013 8:28 pm

Re: BodePlot strange result

Postby Tepeix » Mon Jun 20, 2022 12:41 am

I was trying to make a plot that could take in account the sample rate, the classic fft seams fixed to 44100.
It's possible to resize the array before the fft but the result was a little strange so finally i tried to test all
notes in blue.

I find in it an interesting approximation for non linear filter.
The measuring filter you send could also approximate. (did not know other than simple impulse)

Well, there's more to take into account, but using different level before the filter we could get an idea.
For sure, mine measure the volume that will do one note with the harmonics and with aliasing when it occur !)
But from the test i have made the prediction it's not so bad and helpful even if it could depend of others factors.
I'm less blind when trying to add non linear think to an experimental filter.
Seeing if it cut completely some frequency or boost to much others. And what happens with higher input.

I also add more option now, we could test other waveform and even chord.
(but the chord is very imprecise needing more time than allowed to get there max volume)
I also add a record device to compare some response.
Also it's possible to check the offset. (in green)
This way i could see that a saw waveform with high level do very bad thing with the test filter.
Image
Without a fix it would be maybe a little unusable due to this.
Attachments
frequency Predictor3.fsm
(160.48 KiB) Downloaded 322 times
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby martinvicanek » Mon Jun 20, 2022 6:20 pm

Tepeix wrote:...the classic fft seams fixed to 44100.

The FFT as such only shuffles a bunch of numbers around. It does not know or care about the sample rate. Only when you interpret the bin indices as frequencies does the samplerate enter. So it is only a matter of labeling the x-axis correctly.
User avatar
martinvicanek
 
Posts: 1318
Joined: Sat Jun 22, 2013 8:28 pm

Re: BodePlot strange result

Postby Tepeix » Mon Jun 20, 2022 9:46 pm

I was not imaging it could be so simple thanks !)
I will probably try this technique too.

Finally i find that the worst in the test filter was not the offset.
But a tendency to do hard noise on some treble pic.
Using a ff value of 0.9 or less fix a little this but diminish the overdrive.
Also the bass get way less drive...
Not sure it could be usable.
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

Re: BodePlot strange result

Postby Tepeix » Wed Jul 13, 2022 1:13 pm

Finally i find an easy way to adapt this particularly simple filter to sample rate.
(in linear mode)
Martin give me a good inspiration. When the sample rate is multiplied by 2 the filter will be exactly 1 octave up.

So how much did we need to add to the parameter to do 1 octave more ?

First i was trying to use the value of the parameter (x).. It was complex..
Blending x*2 to x with complex formula..

Then i find that it's better to use 1-x.
(the parameter goes from 0 to 1)

So it's very simple to add one octave more, we could simply add to x : (1-x)*0.5.
(Much better than the pow that i was using in some approximation and never exceed 1 !)

2 octave would be (1-x)*0.75. 1/2 octave is (1-x)*(1/3) ..

Finally we could use the sample rate like this : ( (1-(1/(SampleRate/44100))) * (1-x) ) +x.
Attachments
Sample Rate Adapt.fsm
(150 KiB) Downloaded 301 times
Tepeix
 
Posts: 352
Joined: Sat Oct 16, 2021 3:11 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: Majestic-12 [Bot] and 26 guests

cron