Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
MIDI Buffer Fill Commands
Changes: BFvb.i0=(fill,count), Bfvb.i0=(fill,count)
The Buffer Fill (BF) command allows a MIDI Changes script to initialize or modify a section of an input buffer by replacing each note with a constant value. Typically, you would initialize the buffer using the Buffer Copy command, then replace a few notes with the repeated value... think of adding "cha, cha, cha" to the end of a phrase as an accent.
The format for Buffer Fill is BFvb.i0=(fill,count), where v is Voice number 1-8, and b is buffer number 1-4. i0 is the index (position) where the fill should start, fill is a the MIDI note number to fill with, and count is the number of notes to be affected.
i0, fill, and count may use any unsigned integer or valid expression, including current MIDI control values, random values, current computer keyboard states or mouse position, input or buffered notes, oscillators, and User Variables.
i0 will be limited to the 0-255 buffer range, fill will be limited to the 0-127 MIDI note range, with the exception that 255 may be used for silence. The count value will be limited such that the 256-note buffer size is not exceeded.
The normal Buffer Fill BF command computes the fill value once, and uses it to fill all buffer positions.
Alternatively, you can use a shortened form to fill only the value at the index position. BFvb.i0=n is equivalent to the above form where count = 1. This simplifies using the buffer as an array of arbitrary MIDI values that you can set individually and later use via Buffer Note Values. (Use Direct Array Access to set individual values for other purposes like random selection from a list, including 8, 16 and 32-bit values.)
There is also a Bf variant that recomputes fill for each position. If fill is an expression that includes oscillators or random values, each position may get a different value. This is useful for creating arbitrary bass, rhythm, or melody lines.
For example, Bf21.0=($a(48,72),8) would fill Voice 2, buffer 1 starting from the 0th position, with 8 points from the oscillator $a output.
The oscillator in this example is scaled such that a full cycle would swing between MIDI notes 48 (C3) and 72 (C5). The actual range covered by the 8 points used here would depend upon the frequency of the oscillator.
A use-based (lower case) oscillator $a to $h is usually best for inclusion in fill, because the current output is computed on every use. A frequency-based oscillator $1 to $8 or a beat-based oscillator $A to $H will act as a constant whose value is the current output of the oscillator at the beat when the command is processed.
Although the constant BF command allows a fill value of 255 to set silence, the Bf version limits to the 0-127 range.
For a Note Pattern, the fill value is stored as-is. For example, 60 is stored as MIDI note 60, which is C4. This is also the default Pattern Key for each voice. When played, however, the current Pattern Key is used; if it is D4 instead of C4 then all notes will be played 2 semitones higher.
Velocity and Chord pattern fills use Velocity and Chord Maps to translate the fill value into a Velocity or Chord Pattern character. You must provide the relevant Map before the fill. Otherwise, an empty map will cause only nulls to be used for filling the pattern.
You may fill a Percussion Velocity Pattern by using A to F instead of a Voice number.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved