Module: DSP
- Defined in:
- lib/dsprb.rb,
lib/dsprb/dct.rb,
lib/dsprb/lpc.rb,
lib/dsprb/wav.rb,
lib/dsprb/yin.rb,
lib/dsprb/mfcc.rb,
lib/dsprb/curve.rb,
lib/dsprb/biquad.rb,
lib/dsprb/energy.rb,
lib/dsprb/errors.rb,
lib/dsprb/scales.rb,
lib/dsprb/window.rb,
lib/dsprb/fourier.rb,
lib/dsprb/framing.rb,
lib/dsprb/version.rb,
lib/dsprb/formants.rb,
lib/dsprb/resolver.rb,
lib/dsprb/spectrum.rb,
lib/dsprb/waveform.rb,
lib/dsprb/decimator.rb,
lib/dsprb/parabolic.rb,
lib/dsprb/pitch_track.rb,
lib/dsprb/mel_filterbank.rb,
lib/dsprb/autocorrelation.rb,
lib/dsprb/spectral_moments.rb,
sig/dsprb.rbs
Defined Under Namespace
Modules: Autocorrelation, Curve, Dct, Energy, Fourier, Framing, Lpc, Parabolic, Resolver, Scales, Wav, Window, _Transform, _WindowFunction
Classes: Biquad, Decimator, Error, Formants, FormatError, MelFilterbank, Mfcc, PitchTrack, SpectralMoments, Spectrum, UnknownStrategyError, Waveform, Yin
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
-
.decimate(waveform, factor) ⇒ Waveform
-
.decode(bytes) ⇒ Waveform
-
.filter(waveform, biquad, sections) ⇒ Waveform
-
.formants(waveform, **options) ⇒ ::Array[::Float]
-
.highpass(waveform, cutoff:, sections: 2) ⇒ Waveform
-
.lowpass(waveform, cutoff:, sections: 2) ⇒ Waveform
-
.mfcc(waveform, size: Mfcc::DEFAULT_SIZE, coefficients: Mfcc::DEFAULT_COEFFICIENTS, window_seconds: Mfcc::DEFAULT_WINDOW_SECONDS, hop_seconds: Mfcc::DEFAULT_HOP_SECONDS, **options) ⇒ Object
-
.pitch(waveform, **options) ⇒ PitchTrack
-
.read(path) ⇒ Waveform
Class Method Details
.decimate(waveform, factor) ⇒ Waveform
52
|
# File 'lib/dsprb.rb', line 52
def decimate(waveform, factor) = Decimator.new(factor).call(waveform)
|
.decode(bytes) ⇒ Waveform
33
|
# File 'lib/dsprb.rb', line 33
def decode(bytes) = Wav.decode(bytes)
|
.filter(waveform, biquad, sections) ⇒ Waveform
62
63
64
|
# File 'lib/dsprb.rb', line 62
def filter(waveform, biquad, sections)
waveform.with(samples: biquad.apply(waveform.samples, sections: sections))
end
|
37
|
# File 'lib/dsprb.rb', line 37
def formants(waveform, **options) = Formants.new(**options).call(waveform)
|
.highpass(waveform, cutoff:, sections: 2) ⇒ Waveform
58
59
60
|
# File 'lib/dsprb.rb', line 58
def highpass(waveform, cutoff:, sections: 2)
filter(waveform, Biquad.highpass(sample_rate: waveform.sample_rate, cutoff: cutoff), sections)
end
|
.lowpass(waveform, cutoff:, sections: 2) ⇒ Waveform
54
55
56
|
# File 'lib/dsprb.rb', line 54
def lowpass(waveform, cutoff:, sections: 2)
filter(waveform, Biquad.lowpass(sample_rate: waveform.sample_rate, cutoff: cutoff), sections)
end
|
.mfcc(waveform, size: Mfcc::DEFAULT_SIZE, coefficients: Mfcc::DEFAULT_COEFFICIENTS, window_seconds: Mfcc::DEFAULT_WINDOW_SECONDS, hop_seconds: Mfcc::DEFAULT_HOP_SECONDS, **options) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/dsprb.rb', line 39
def mfcc(
waveform,
size: Mfcc::DEFAULT_SIZE,
coefficients: Mfcc::DEFAULT_COEFFICIENTS,
window_seconds: Mfcc::DEFAULT_WINDOW_SECONDS,
hop_seconds: Mfcc::DEFAULT_HOP_SECONDS,
**options
)
Mfcc
.for(sample_rate: waveform.sample_rate, size: size, coefficients: coefficients, **options)
.sequence(waveform, window_seconds: window_seconds, hop_seconds: hop_seconds)
end
|
.pitch(waveform, **options) ⇒ PitchTrack
35
|
# File 'lib/dsprb.rb', line 35
def pitch(waveform, **options) = Yin.new(**options).call(waveform)
|
31
|
# File 'lib/dsprb.rb', line 31
def read(path) = Wav.read(path)
|