Little Robot Friends
Arduino Library Reference  version 1.1
LRFSoundStruct Struct Reference

Detailed Description

This tightly-packed data structure contains all the information require to speak a single sound instance. We approached the LRF capability for sound as if we were designing a library for robot speech. Each data structure contains:

  • 'note' and 'octave' values for selecting a frequency (tone)
  • an 'intonation' value for bending the frequency during playback
  • 'duration' and 'pause' values for controlling how long the note plays and how long to pause after it finishes playing

By combining these sounds into sets (using arrays) you can make your robot express in an almost infinite number of ways.

Sounds can be created in a single line of code:

LRFSoundStruct mySound = { LRFNote_C, LRFOctave_4, LRFIntonation_Rising, LRFDuration_Medium, LRFDuration_None };

Or using multiple lines of code:

LRFSoundStruct mySound;
mySound.note = LRFNote_C;
mySound.octave = LRFOctave_4;
mySound.intonation = LRFIntonation_Rising;
mySound.duration = LRFDuration_Medium;
mySound.pause = LRFDuration_None;

You can play around with the various values to find sounds that are happy, sad, angry, excited... almost anything! Since the data packs tightly into a 16-bit integer (with 1 bit to spare), we can store a lot of custom sounds for your Little Robot Friend.

Definition at line 273 of file LRFUtils.h.

#include <LRFUtils.h>

Public Attributes

LRFNote note:4
 musical note (base frequency)
 
LRFOctave octave:3
 musical octave (scale the frequency)
 
LRFIntonation intonation:3
 bend applied to the frequency (over duration_
 
LRFDuration duration:3
 time the note is played
 
LRFDuration pause:3
 time that we rest after the note is played
 

The documentation for this struct was generated from the following file: