Parent

Frame

A Frame is a container for a collection of audio samples. Unlike a .wav file these will always be 32bit float values. FlowStone is able to take this data and turn it into a mono stream of audio, and has primitives to ensure that frames are kept synchronised with the audio buffers arriving from a soundcard driver or VST host.

Public Class Methods

new(size) → Frame click to toggle source
new(Array) → Frame

Creates a new audio frame. If an Integer size is given as the argument, a Frame consisting of that number of zero's is created. If an Array of Floats is given, the Frame is populated with that data.

Note that although Frames can contain any Float data, it is wise to restrict the values to the range -1.0 to 1.0 if the data will be used as an audio source in order to prevent over-modulation of soundcard outputs.

# File Midi and Audio Classes.rb, line 278
def self.new
  # DUMMY
end

Public Instance Methods

[Integer] → Float/nil click to toggle source

Retreive the sample value as a Float from the given index of the Frame. Returns nil if the index is out of range. To make the above call signature clearer, this example shows the syntax in context...

# Make a new Frame filled with values
@my_frame = Frame.new( [0.1, 0.2, 0.3, 0.4, 0.5] )

# Get the value of the third sample
watch @my_frame[2]
#=> 0.3
# File Midi and Audio Classes.rb, line 328
def [](val)
  #DUMMY
end
[Integer]=(Float) click to toggle source

Set the sample value at the given index of the Frame to the given Float. Does nothing if the index is out of range. To make the above call signature clearer, this example shows the syntax in context...

# Make a new Frame object
@my_frame = Frame.new(10)

# Set the third sample to 0.5
@my_frame[2] = 0.5
# File Midi and Audio Classes.rb, line 346
def []=(idx, val)
  #DUMMY
end
data → Integer click to toggle source

Returns the memory address where the Frame data is currently being stored. This might be used, for example, to create a pointer to the data which could be passed to a DLL - though great care must be taken to ensure that the Frame remains in scope if this is done. If the Frame is garbage collected or re-sized while the pointer is still in use, an Access Violation error could occur which would crash the application or plugin!!

# File Midi and Audio Classes.rb, line 301
def data
  #DUMMY
end
fill_sine click to toggle source

Fills the Frame with sample data representing a single cycle of a sine wave that fills the Frame's current size. The amplitude will be from -1.0 to 1.0 (i.e. full scale for a 'normalised' audio signal).

# File Midi and Audio Classes.rb, line 370
def fill_sine
  #DUMMY
end
resize(Integer) click to toggle source

Resize the Frame to the new size given by the Integer. Do not do this if the Frame's address is currently being used as a pointer by, for example, a DLL. This may invalidate the pointer and lead to an Access Violation error, and crash!!

# File Midi and Audio Classes.rb, line 358
def resize
  #DUMMY
end
size → Integer click to toggle source

Returns the number of samples contained in the Frame.

# File Midi and Audio Classes.rb, line 287
def size
  #DUMMY
end
to_array → Array click to toggle source

Returns an Array of Floats containing a copy of the Frame's data.

# File Midi and Audio Classes.rb, line 310
def to_array
  #DUMMY
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.