Method: WaveFile::Buffer#samples
- Defined in:
- lib/wavefile/buffer.rb
#samples ⇒ Object (readonly)
Public: Returns the sample data contained in the Buffer as an Array. If the Format has 1 channel, the Array will be a flat list of samples. If the Format has 2 or more channels, the Array will include sub arrays for each sample frame, with a sample for each channel.
Examples
samples = mono_buffer.samples
# => [-0.5, 0.3, 0.2, -0.9, ...]
samples = stereo_buffer.samples
# => [[-0.2, 0.5], [0.1, 0.2], [-0.4, 0.7], [0.1, 0.2], ...]
samples = three_channel_buffer.samples
# => [[0.3, 0.5, 0.2], [-0.1, 0.2, -0.9], [0.2, 0.3, -0.4], [0.1, 0.2, -0.8], ...]
142 143 144 |
# File 'lib/wavefile/buffer.rb', line 142 def samples @samples end |