Songs | LRFSong
The LRFSong
data type is a collection of properties that represent a song in the Little Robot Friends library. LRFSongs consist of four properties: length
is the number of sounds in the song. octaveShift
is the number of octaves to shift the frequency, if desired. pattern
is the eye pattern that will animate while the robot sings. sounds
is where we enter the array of sounds or notes that make up the song, this is the bulk of the structure.
The value of length
should match the number of sounds/notes in the sounds
array.
Example
LRFSong mySong = {
.length = 9,
.octaveShift = 0,
.pattern = {LRFColor_Green,LRFColor_Purple,LRFTransform_Boomerang},
.sounds = {
{ LRFNote_E, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_DS, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_E, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_DS, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_E, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_B, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_D, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_C, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Medium, LRFDuration_DoubleShort},
{ LRFNote_A, LRFOctave_3, LRFIntonation_Flat, LRFDuration_Long, LRFDuration_DoubleShort}
}
};
Syntax
LRFSong mySong = {
.length = ,
.octaveShift = ,
.pattern = ,
.sounds =
}
Parameters
length
: uint8_t - The number of sounds in the song.octaveShift
: int8_t - The number of octaves to shift up or down. Negative values shift downward, positive upward.pattern
: LRFPattern type - The eye pattern that will animate during the expression.sounds
: Array of LRFSound type - The sounds that will play during the song.