Class: DSP::Lpc::Model
- Inherits:
-
Data
- Object
- Data
- DSP::Lpc::Model
- Defined in:
- lib/dsprb/lpc.rb,
sig/dsprb.rbs
Instance Attribute Summary collapse
-
#coefficients ⇒ Object
readonly
Returns the value of attribute coefficients.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Class Method Summary collapse
Instance Method Summary collapse
-
#envelope(points:) ⇒ ::Array[::Float]
Magnitude of the all-pole transfer function 1 / |A(e^w)|^2 sampled over [0, pi], the spectral envelope the predictor implies.
- #order ⇒ ::Integer
Instance Attribute Details
#coefficients ⇒ Object (readonly)
Returns the value of attribute coefficients
10 11 12 |
# File 'lib/dsprb/lpc.rb', line 10 def coefficients @coefficients end |
#error ⇒ Object (readonly)
Returns the value of attribute error
10 11 12 |
# File 'lib/dsprb/lpc.rb', line 10 def error @error end |
Class Method Details
.new ⇒ Model
232 |
# File 'sig/dsprb.rbs', line 232
def self.new: (coefficients: ::Array[::Float], error: ::Float) -> Model
|
Instance Method Details
#envelope(points:) ⇒ ::Array[::Float]
Magnitude of the all-pole transfer function 1 / |A(e^w)|^2 sampled over [0, pi], the spectral envelope the predictor implies.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dsprb/lpc.rb', line 15 def envelope(points:) raise ArgumentError, "points must be at least two, got #{points}" unless points >= 2 span = points - 1 Array.new(points) do |index| real, imaginary = response(Math::PI * index / span) denominator = (real * real) + (imaginary * imaginary) denominator < DENOMINATOR_FLOOR ? UNBOUNDED_MAGNITUDE : 1.0 / denominator end end |
#order ⇒ ::Integer
11 |
# File 'lib/dsprb/lpc.rb', line 11 def order = coefficients.length - 1 |