Class: FMOD::Core::SpectrumData
- Defined in:
- lib/fmod/core/spectrum_data.rb
Overview
Describes spectrum values between 0.0 and 1.0 for each “FFT bin”.
Instance Attribute Summary collapse
-
#channel_count ⇒ Integer
readonly
The number of channels in the spectrum.
-
#length ⇒ Integer
readonly
The number of entries in this spectrum window.
-
#spectrum ⇒ Array<Float>
readonly
Values inside the float buffer are typically between 0.0 and 1.0.
Instance Method Summary collapse
-
#initialize(address = nil) ⇒ SpectrumData
constructor
A new instance of SpectrumData.
Methods inherited from Structure
Constructor Details
#initialize(address = nil) ⇒ SpectrumData
Returns a new instance of SpectrumData.
12 13 14 15 16 |
# File 'lib/fmod/core/spectrum_data.rb', line 12 def initialize(address = nil) types = [TYPE_INT, TYPE_INT, [TYPE_FLOAT, 32]] members = [:length, :channel_count, :spectrum] super(address, types, members) end |
Instance Attribute Details
#channel_count ⇒ Integer (readonly)
Returns the number of channels in the spectrum.
|
# File 'lib/fmod/core/spectrum_data.rb', line 23
|
#length ⇒ Integer (readonly)
Returns the number of entries in this spectrum window. Divide this by the output rate to get the hz per entry.
|
# File 'lib/fmod/core/spectrum_data.rb', line 18
|
#spectrum ⇒ Array<Float> (readonly)
Test for proper structure
Values inside the float buffer are typically between 0.0 and 1.0.
Each top level array represents one PCM channel of data.
Address data as spectrum[bin]. A bin is 1 FFT window entry.
Only read/display half of the buffer typically for analysis as the 2nd half is usually the same data reversed due to the nature of the way FFT works.
42 43 44 |
# File 'lib/fmod/core/spectrum_data.rb', line 42 [:length, :channel_count, :spectrum].each do |symbol| define_method(symbol) { self[symbol] } end |