Class: NoyesJava::MelFilter

Inherits:
Object
  • Object
show all
Includes:
JavaFilter
Defined in:
lib/java_impl/mel_filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JavaFilter

#<<, ensure_jarray

Constructor Details

#initialize(srate, nfft, nfilt, lowerf, upperf) ⇒ MelFilter

Returns a new instance of MelFilter.


6
7
8
# File 'lib/java_impl/mel_filter.rb', line 6

def initialize srate, nfft, nfilt, lowerf, upperf
  @filter = Java::talkhouse.MelFilter.new srate, nfft, nfilt, lowerf, upperf
end

Class Method Details

.make_bank_parameters(srate, nfft, nfilt, lowerf, upperf) ⇒ Object


9
10
11
12
13
# File 'lib/java_impl/mel_filter.rb', line 9

def self.make_bank_parameters srate, nfft, nfilt, lowerf, upperf
  parameters = Java::talkhouse.MelFilter.make_bank_parameters srate, nfft,
                                                    nfilt, lowerf, upperf
  parameters.map {|array|array.to_a}
end

.make_filter(left, center, right, init_freq, delta) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/java_impl/mel_filter.rb', line 14

def self.make_filter left, center, right, init_freq, delta
  filters = Java::talkhouse.MelFilter.make_filter left, center, right,
                                                  init_freq, delta
  filters = filters.to_a
  indefilters = filters.shift
  [indefilters, filters]
end

.to_linear(mel) ⇒ Object


24
25
26
# File 'lib/java_impl/mel_filter.rb', line 24

def self.to_linear mel
  Java::talkhouse.MelFilter.melinv JavaFilter.ensure_jarray mel
end

.to_mel(f) ⇒ Object


21
22
23
# File 'lib/java_impl/mel_filter.rb', line 21

def self.to_mel f
  x = Java::talkhouse.MelFilter.mel JavaFilter.ensure_jarray f
end