Module: NoyesFilterDSL

Included in:
Noyes::Compression, Noyes::DCT, Noyes::DoubleDeltaFilter, Noyes::Filter, Noyes::HammingWindow, Noyes::LiveCMN, Noyes::LogCompressor, Noyes::MelFilter, Noyes::PowerSpectrumFilter, Noyes::Preemphasizer, Noyes::Segmenter
Defined in:
lib/common/noyes_dsl.rb,
lib/common/serial_filter.rb,
lib/common/parallel_filter.rb

Overview

This portion is still highly experimental. It allows filters to be combined in complicated ways using a syntax similar to Backus Naur Form.

Defined Under Namespace

Classes: ParallelFilter, SerialFilter

Instance Method Summary (collapse)

Instance Method Details

- (Object) +(other)

Combines two filters into a single serial filter. That is A + B results in a filter S such that filtering through S is the identical to filtering through A and then B.



15
16
17
18
# File 'lib/common/noyes_dsl.rb', line 15

def + other
  other_filters = other.kind_of?(SerialFilter) ? other.filters.clone : other
  SerialFilter.new [self, other].flatten
end

- (Object) |(other)

Combines two filters into a single parallel filter. That is A | B creates a new filter P such that filtering through P is identical to filtering row 0 of an array through filter A and row 1 of an array through filter B. Typically P would be used with an array of arrays. This filter can be used with more than two filters.



25
26
27
28
# File 'lib/common/noyes_dsl.rb', line 25

def | other
   other_filters = other.kind_of?(ParallelFilter) ? other.filtes.clone : other
   ParallelFilter.new [self, other].flatten
end