User Guide
Ruby Component
Writing Samples
In the same way that you can read a single sample you can also write to a single sample:
myFrame[i] = 3.0 – assigns 3.0 to the sample at index i in myFrame
If you want to assign an array of Ruby Floats to a Frame then you'll need to create a new Frame object. Here's how you do it:
f = Frame.new smpls – creates a new Frame from the array called smpls
Frame To Mono
The Frame To Mono component takes Frames and passes them back into the Mono stream. Using this component in conjunction with the
Mono To Frame component allows you to apply Ruby processing within a Mono section.
In the example above we're taking a sine wave signal and halving the amplitude before passing it back into the Mono stream. The Frame is
converted to a Ruby array and then each element in the array is multiplied by 0.5. The resulting array is passed out.
Note that we didn't pass out a new Frame object. This is because the Mono To Frame component can take a Ruby array as input too.
We could easily have created a Frame object too by replacing the “output a” by “output (Frame.new a)”.
166 of 212