Class: RLBFilter

Inherits:
IIRFilter show all
Defined in:
lib/Loudness/RlbFilter/RLBFilter.rb

Overview

RLB filter implementation

Instance Method Summary collapse

Methods inherited from IIRFilter

#FilterSample, #SetCoefs

Constructor Details

#initialize(fs) ⇒ RLBFilter

Initialize RLB Filter implementation

Parameters:

  • fs (int)

    sets the sampleing frecuency. It is used to compute the filter coeficients according to the RLB Filter definition in ITU-R BS.1770



10
11
12
13
14
# File 'lib/Loudness/RlbFilter/RLBFilter.rb', line 10

def initialize(fs)
  super 2 
  
  SetFreqSampling(fs)
end

Instance Method Details

#InfoString

Gets filter information

Returns:

  • (String)

    filter information



38
39
40
# File 'lib/Loudness/RlbFilter/RLBFilter.rb', line 38

def Info
  return "RLB Filter--------\nFs = #{@fs} Hz\n#{super}\n------------------\n"
end

#SetFreqSampling(fs) ⇒ Object

Sets RLB Filter sampleing frecuency

Parameters:

  • fs (int)

    sets the sampleing frecuency. It is used to compute the filter coeficients according to the RLB Filter definition in ITU-R BS.1770



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/Loudness/RlbFilter/RLBFilter.rb', line 18

def SetFreqSampling (fs) 
  @fs = fs
  
  #RLB FILTER - Order 2 = 3coefs
  #Coefs Fs = 48KHz (ITU 1770 published coefs for fs = 48KHz)
  mACoefs = [1.0, -1.99004745483398, 0.99007225036621]
  mBCoefs = [1.0, -2.0, 1.0]

  if (@fs != 48000)
    #Parameters of second order HPF
    dFc = 60 #Center freq

    mBCoefs , mACoefs = CalcCoefs fs,dFc
  end

  SetCoefs mBCoefs,mACoefs
end