INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to calculate Q and S  (Read 935 times)

Soundwave

  • Recent member
  • *
  • Posts: 42
How to calculate Q and S
« on: January 17, 2021, 11:45:52 am »

I measured the effect of Q on high/low pass filters in MC and can say that jriver Q = actual Q / sqrt(2)

i.e.

jriver Q= 0.707 is a conventional Q=0.5
jriver Q = 1 is a conventional Q = 0.707
jriver Q = 1.414 is a conventional Q = 1
jriver Q = 2 is a conventional Q = 1.414

and so on

conventional in this case being the RBJ audio cookbook implementation of a variable Q high or low pass filter (assorted references online, one copy can be found at https://github.com/libaudioverse/libaudioverse/blob/master/audio%20eq%20cookbook.txt)

Code: [Select]
    omega = 2*PI*frequency/sampleRate
    cos    = cos(omega)
    sin   = sin(omega)
    alpha = sin/(2*Q)                                   

LPF:            H(s) = 1 / (s^2 + s/Q + 1)

                b0 =  (1 - cos)/2
                b1 =   1 - cos
                b2 =  (1 - cos)/2
                a0 =   1 + alpha
                a1 =  -2*cos
                a2 =   1 - alpha

HPF:            H(s) = s^2 / (s^2 + s/Q + 1)

                b0 =  (1 + cos)/2
                b1 = -(1 + cos)
                b2 =  (1 + cos)/2
                a0 =   1 + alpha
                a1 =  -2*cos
                a2 =   1 - alpha

I do not know how this is implemented in jriver but it's definitely not going to give the results that anyone expects when using an external filter design tool unless they know to scale Q accordingly.

Do you have plug & play formula of how to do the conversion? Maybe like an online calculator or something for us mathematics illiterates :\
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: How to calculate Q and S
« Reply #1 on: January 17, 2021, 12:13:58 pm »

It seems to be:
Code: [Select]
ConventionalQ = JriverQ / Sqrt(2)  = JRiverQ / 1.4142
Conversely:
Code: [Select]
JRiverQ = ConventionalQ * Sqrt(2)  = ConventionalQ * 1.4142
This looks like the difference between Peak vs RMS.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4271
Re: How to calculate Q and S
« Reply #2 on: January 17, 2021, 12:24:42 pm »

Do you have plug & play formula of how to do the conversion? Maybe like an online calculator or something for us mathematics illiterates :\
I posted in the bit you quoted

jriver Q = actual Q / sqrt(2)

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: How to calculate Q and S
« Reply #3 on: January 17, 2021, 12:47:27 pm »

Eh, I missed that as well, I just extrapolated from the values you provided :)
Logged

Soundwave

  • Recent member
  • *
  • Posts: 42
Re: How to calculate Q and S
« Reply #4 on: January 17, 2021, 12:55:36 pm »

I posted in the bit you quoted

jriver Q = actual Q / sqrt(2)

Wow, did I say math illiterate? I probably should have said just illiterate, or more aptly, just blind.. Thank you!

EDIT: Are these Q Values also botched with normal peak filters and such, or just the two mentioned?
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4271
Re: How to calculate Q and S
« Reply #5 on: January 17, 2021, 01:38:39 pm »


EDIT: Are these Q Values also botched with normal peak filters and such, or just the two mentioned?
Peak filters are fine, shelf filters are actually S not Q
Logged

sware

  • Member
  • *
  • Posts: 2
Re: How to calculate Q and S
« Reply #6 on: January 23, 2021, 08:10:21 pm »

I started messing with the Parametric Equalizer. Trying to get my headphones at the Harman curve.
I found some parameters to make it happen. There us a reddit with 100's.

So if I use Low-shelf or High-shelf I need to math Q to S. I just need to plug the numbers below in the formula.
Also why are commas used?

1/((((1/Q)^2-2)/((10^(d/40))+1/(10^(d/40))))+1)

Q = the actual Q Low = 0,9 High = 0,8

d = the required gain Low = 2.8 High = -10,0

1 .607195

1.229886
Thanks to anyone that takes the time to help!!
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4271
Re: How to calculate Q and S
« Reply #7 on: January 24, 2021, 03:16:29 am »

commas in that example are just a different locale (many places use , instead of . - https://en.wikipedia.org/wiki/Decimal_separator#Countries_using_decimal_comma). You can use that formula
or an easier solution is to use my app (latest build here -> https://github.com/3ll3d00d/beqdesigner/releases/tag/0.9.7-beta.17) and its filter edit screen will do the conversion for you (and preview the result). It also has support for importing a jriver dsp file so you can see the filters per channel, haven't got round to saving back edits yet though into dsp file format so it's just for visualisation atm.

Logged

sware

  • Member
  • *
  • Posts: 2
Re: How to calculate Q and S
« Reply #8 on: January 24, 2021, 05:54:44 am »

Thanks for this!
Sorry I could have googled the comma thing. For some reason I thought it was an EQ thing and not a broader world thing. LOL I am dumb.

I used your tool. I was able to see my math was correct for the low pass filter.

I couldn't figure out how to input 11,000 for the high shelf. The input seems limited to 999,00?

I am sure I missed something. I was able to to get the graph out to 20,000.

But anyway. I know my math is correct. And I do need S. So it works out. Be nice if JRiver made this a tad easier.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4271
Re: How to calculate Q and S
« Reply #9 on: January 24, 2021, 09:21:19 am »

I couldn't figure out how to input 11,000 for the high shelf. The input seems limited to 999,00?
I should fix that.... to workaround do the following

click add button in the signal section (top right)
select pulse tab
enter any text in the prefix and press OK

filter freq can now be up to 24kHz

Logged

TheSacredSoul

  • Recent member
  • *
  • Posts: 12
Re: How to calculate Q and S
« Reply #10 on: February 07, 2021, 12:50:47 am »

Do you have plug & play formula of how to do the conversion? Maybe like an online calculator or something for us mathematics illiterates :\

Hi, what is the correct forumla? Is it;

1. jriver Q = actual Q / sqrt(2)
 
OR

2. jriver Q = actual Q * sqrt(2)


Also, there seems to be a separate forumla for high and low shelf?
Logged
Pages: [1]   Go Up