Class: Sox

Inherits:
Object
  • Object
show all
Defined in:
lib/sox.rb

Class Method Summary collapse

Class Method Details

.load_samples(path) ⇒ Object

load the WAV file at ‘path` and turn it into a list of samples, -1 to 1 in value



4
5
6
7
8
9
10
11
12
# File 'lib/sox.rb', line 4

def self.load_samples(path)
  `sox "#{path}" -t dat -`.
    lines.
    reject {|l| l.start_with?(';')}.
    map(&:strip).
    map(&:split).
    map(&:last).
    map(&:to_f)
end