Goblin Speaks Example
The Goblin Speaks fortune teller is the first machine built on the framework, and the one it takes its name from. It pairs a Goblin Speaks Body and Head with a Card Dispenser: the head speaks a fortune while the body animates, then the dispenser hands the player a card to take home.
Configuration
The machine is driven by this configuration file, which consists of three main sections:
audio_player— configures the sound banks used by the machine.components— defines the machine's physical components and what software they run.sequences— defines the named sequences the machine can run.
audio_player:
sound_banks:
pre_fortune:
mode: random
fortune:
mode: sequential
post_fortune:
mode: random
activation:
mode: random
components:
goblin_body:
type: animatronic
class: gs_body
card_dispenser:
type: dispenser
class: single_stepper
dispense_steps: 2048
step_delay: 0.0015
sequences:
fortune:
- component: audio
action: play_sequence
args:
sound_types: [pre_fortune, fortune, post_fortune]
output: duration
- component: goblin_body
action: animate
args:
duration: $duration
- component: card_dispenser
action: dispense
Sound Banks
The Audio Player is set up with four sound banks, each holding a different kind of sound:
activation— a sound played when the machine is activatedpre_fortune— a general intro voice line, played inrandomorder so it varies between activations.fortune— the fortune voice line itself, played insequentialorder so every fortune gets told before any repeat.post_fortune— a line asking the player to play again, played inrandomorder so it varies between activations.
These sound banks are used later in the fortune sequence to allow the machine to combine random pre_fortune and post_fortune lines with a sequentially selected fortune.
Components
Two components are declared:
goblin_body— a Goblin Speaks Body, using thegs_bodyanimatronic class.card_dispenser— a Goblin Speaks Card Dispenser, using thesingle_stepperdispenser class.dispense_stepsandstep_delaytune how far and how fast the stepper motor turns to push out a single card.
See the Configuration page for the full set of component types and fields.
Sequence
The fortune sequence runs through three steps:
audio.play_sequenceplays one sound from each ofpre_fortune,fortune, andpost_fortunein order, and captures the total playback duration as$duration.goblin_body.animateruns the body's animation routine for$duration, so the goblin's mouth and arm move for exactly as long as it's speaking.card_dispenser.dispensepushes out a single fortune card once the show finishes.