COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 03-10-2018, 01:14 PM   #1
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 181
Default How to process for all SampleRates?

Hello,

I'm working on a eq.It's working correct with 96kHz SampleRate.But can't getting half value with 48kHz SampleRate as normal.

My code has no SampleRate input.So i need to get SampleRate for all code.How can i do that?

Thanks.
Tunca is offline   Reply With Quote
Old 03-16-2018, 12:51 AM   #2
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 282
Default

I don't know what you mean by, "But can't getting half value with 48kHz SampleRate as normal", but you ask how to get the sampleRate. If you do a search on "sampleRate", you'll see that the plugin base has an accessor "GetSampleRate()".
earlevel is offline   Reply With Quote
Old 03-16-2018, 01:24 AM   #3
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 181
Default

Quote:
Originally Posted by earlevel View Post
I don't know what you mean by, "But can't getting half value with 48kHz SampleRate as normal", but you ask how to get the sampleRate. If you do a search on "sampleRate", you'll see that the plugin base has an accessor "GetSampleRate()".
Hi,

Thanks.

Yes,i know how can i use samplerate.But i have a filter without samplerate input.So when i change samplerate,frequency shifting.So i need to use samplerate with my filter without samplerate input.Like samplerate affecting all process...
Tunca is offline   Reply With Quote
Old 03-16-2018, 01:32 AM   #4
Anomaly
Human being with feelings
 
Anomaly's Avatar
 
Join Date: Sep 2007
Posts: 642
Default

EDIT: never mind. Just saw your another reply.

So you have designed your filter coefficients without samplerate input? In other words your coefficients are kind of "constant"?
Maybe there are some filter experts who can offer some guidance, but I suspect you should present some code.
__________________
___________________________
Sonic Anomaly | free JSFX & VST Plugins

Last edited by Anomaly; 03-16-2018 at 01:41 AM.
Anomaly is offline   Reply With Quote
Old 03-16-2018, 02:17 AM   #5
Tunca
Human being with feelings
 
Join Date: Apr 2016
Posts: 181
Default

Quote:
Originally Posted by Anomaly View Post
EDIT: never mind. Just saw your another reply.

So you have designed your filter coefficients without samplerate input? In other words your coefficients are kind of "constant"?
Maybe there are some filter experts who can offer some guidance, but I suspect you should present some code.
Yes,i designed filter coeffs without samplerate input.So i believe they are constant.

Actually my codes hard to understand...But i'm sharing...

Codes FAUST generated.

Code:
      float fTemp0 = ((((fRec1[0] * ((fRec2[0] * ((2.53244472f * fRec2[0]) + -2.52782989f)) + -2.55191851f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * (2.39224625f - (2.3966136f * fRec2[0]))) + 2.41504288f)) + (fRec2[0] * ((2.97997594f * fRec2[0]) + -3.00986648f))) + -2.542557f))) + (fRec2[0] * (3.17996812f - (3.14868951f * fRec2[0])))) + 2.68679452f);
      fRec0[0] = (*in1 - ((((fRec0[1] * ((((fRec1[0] * ((fRec2[0] * (3.28740835f - (3.29274011f * fRec2[0]))) + 3.31676102f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * ((3.15546703f * fRec2[0]) + -3.15034962f)) + -3.17850184f)) + (fRec2[0] * (3.82386899f - (3.85928059f * fRec2[0])))) + 3.35960817f))) + (fRec2[0] * ((4.02680874f * fRec2[0]) + -3.9897368f))) + -3.50551343f)) + (fRec0[2] * ((((fRec1[0] * ((fRec2[0] * (0.934723735f - (0.937751412f * fRec2[0]))) + 0.947525024f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * ((0.874959588f * fRec2[0]) + -0.872106731f)) + -0.884132981f)) + (fRec2[0] * (1.14007628f - (1.10832298f * fRec2[0])))) + 0.928419292f))) + (fRec2[0] * ((1.18686604f * fRec2[0]) + -1.22009742f))) + -0.994844198f))) + (fRec0[3] * ((((fRec1[0] * ((fRec2[0] * ((1.6980468f * fRec2[0]) + -1.69430232f)) + -1.71236753f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * (1.63021028f - (1.63381302f * fRec2[0]))) + 1.64759207f)) + (fRec2[0] * ((1.98766482f * fRec2[0]) + -1.95411611f))) + -1.74550831f))) + (fRec2[0] * (2.03056645f - (2.06568694f * fRec2[0])))) + 1.81427062f))) / fTemp0));
      float fTemp1 = (1.0f - fRec2[0]);
      float fTemp2 = (fRec2[0] * fTemp1);
      *out1 = ((((((fRec0[0] * ((((fRec1[0] * ((2.07792711f * fTemp2) + 2.08234882f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * (0.0f - (1.96647441f * fTemp1))) + -1.97065902f)) + (fRec2[0] * (2.40981579f - (2.44513631f * fRec2[0])))) + 2.1027143f))) + (fRec2[0] * ((2.58356977f * fRec2[0]) + -2.54655361f))) + -2.22175026f)) + (fRec0[1] * ((((fRec1[0] * ((fRec2[0] * (0.0f - (2.0410006f * fTemp1))) + -2.04461694f)) + (fRec3[0] * (((fRec1[0] * ((1.96380627f * fTemp2) + 1.96729732f)) + (fRec2[0] * ((2.38908958f * fRec2[0]) + -2.41825509f))) + -2.04841661f))) + (fRec2[0] * (2.51309466f - (2.4825294f * fRec2[0])))) + 2.12845993f))) + (fRec0[2] * ((((fRec1[0] * ((fRec2[0] * (0.0f - (2.07951403f * fTemp1))) + -2.08538675f)) + (fRec3[0] * (((fRec1[0] * ((1.96798885f * fTemp2) + 1.97355795f)) + (fRec2[0] * ((2.44698095f * fRec2[0]) + -2.41166043f))) + -2.10574365f))) + (fRec2[0] * (2.54816365f - (2.58517957f * fRec2[0])))) + 2.22460103f))) + (fRec0[3] * ((((fRec1[0] * ((2.04258776f * fTemp2) + 2.04765487f)) + (fRec3[0] * (((fRec1[0] * ((fRec2[0] * (0.0f - (1.96532071f * fTemp1))) + -1.97019613f)) + (fRec2[0] * (2.42013574f - (2.39097047f * fRec2[0])))) + 2.0514822f))) + (fRec2[0] * ((2.48482394f * fRec2[0]) + -2.51538897f))) + -2.13199639f))) / fTemp0));
      fRec1[1] = fRec1[0];
      fRec2[1] = fRec2[0];
      fRec3[1] = fRec3[0];
      for (int j0 = 3; (j0 > 0); j0 = (j0 - 1)) {
        fRec0[j0] = fRec0[(j0 - 1)];

Last edited by Tunca; 03-16-2018 at 02:36 AM.
Tunca is offline   Reply With Quote
Old 03-20-2018, 06:46 AM   #6
Andi!
Human being with feelings
 
Andi!'s Avatar
 
Join Date: Nov 2015
Location: Germany
Posts: 79
Default

To change the generated faust code doesn't make sense, the coeffs are different for different sample rates. Look at your(?) original dsp code, somewhere you define the cut off or band frequency in PI or 0..1
0. is 0Hz and 1. is the sample rate. A filter at 11025 would be 0.25 at 44100 sample rate but somewhere around 0.1 at 96k sample rate.
Andi! is offline   Reply With Quote
Old 03-21-2018, 01:47 PM   #7
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 591
Default

The best solution would be to write a filter that accepts sample rate.

The next best solution would be to just map the frequency to the new sample rate. If you have a LPF at 10kHz at 96kHz sample rate, then to get a LPF of 10kHz at 44.1kHz, you need to set the LPF freq to 21768Hz, and it should be correct.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 03-21-2018, 04:35 PM   #8
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Similarly, if you go back to the original filter design it should express the filter coefficients in terms of Fs (sample rate) so you can scale them according to what Sample rate is actually in use.
Guod3 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.