Category Archives: Little Robots

Posts and materials about Little Robots

Exit Structured Audio, Enter Home Grown

In a previous blog post, I had explored using MPEG4 Structured Audio to produce the sounds that my robots will make in future animation.  A few weeks later, I find that the learning curve for the tools is a bit too steep for my liking… so I decided to start from scratch… and write my own.

Yeah, I understand that people of far greater sound knowledge and experience put a LOT of effort into Structured Audio, but that doesn’t help me now.  Maybe this tool that I’m building (which doesn’t quite have a name yet) will iterate toward the stuff I’m giving up… but I’m sure I’ll learn quite a bit about audio programming along the way.

As it turns out, most of the tool chain that I had previously built still works! I’m just replacing sfront with something that I’ve written… and if you’re curious what a program looks like which generates .wav files? here it is!


use strict;

my $filename = shift @ARGV;
die "You must specify an output file." unless $filename;

my %aliases = (
   C4 => 261.626,
   D4 => 293.665,
   E4 => 329.628,
   F4 => 349.228,
   G4 => 391.995,
   A4 => 440.000,
   B4 => 493.883,
   C5 => 523.251

my @song = qw(B4 A4 G4 A4 B4 B4 B4 A4 A4 A4 B4
              D4 D4 B4 A4 G4 A4 B4 B4 B4 B4 A4 A4 B4 A4 G4);
my $duration = (scalar @song) * 0.5 + 0.5;
my $volume = 8000;

my @notes;
push @notes, $aliases{$_} for @song;

my $channels = 1;
my $samplerate = 44100;
my $bitspersample = 16;
my $byterate = $channels * $samplerate * $bitspersample / 8;
my $blockalign = $channels * $bitspersample / 8;
my $samples = $samplerate * $duration;
my $dataChunkSize = $samples * $bitspersample / 8;
my $chunkSize = 36 + $dataChunkSize;

my @values;
for (my $i = 0; $i < $samples; $i++) {
   my $note = int($i / $samplerate * 2);
   my $freq = $notes[$note];
   my $x = $i * $freq / $samplerate * 3.14159 * 2;
   push @values, int($volume * sin($x));

open(FILE, "> $filename") || die "could not open $filename";
print FILE pack('NVN', 0x52494646, $chunkSize, 0x57415645);
print FILE pack('NVvvVVvv', 0x666d7420, 16, 1, $channels, $samplerate,
     $byterate, $blockalign, $bitspersample);
print FILE pack('NV', 0x64617461, $dataChunkSize);
for my $sample (@values) {
    print FILE pack('v', $sample);


Yup. That’s the whole thing.  No libraries. No weird complexity.

I decided to write the thing in perl for the practice.  I use an awful lot of perl at work, so as this project grows, it’ll force me to learn the proper perl patterns.

If you’re curious what that program produces? Here’s the converted MP3:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Submediant, the voice of robots

This past weekend, I spent some time honing the script from last blog post into a framework that could be used to give voice to my Little Robots.  Okay, so what’s changed since I published that awesome .wav generating perl script? Well, first let’s listen to something rendered by the new script…

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

You can hear that the sound is far more refined.  I took the time to add some basic attack and decay to the sine waveform.  Even though it’s one of the most audible changes… it’s probably one of the least significant.   One major change from the previous script is the movement of all data to external data files…

Here is the data file that generated the MP3 that you just listened to:

@SONGTITLE:Minuet in G
@ALBUMNAME:Let Them Eat Test
@ARTIST:Little Robots

D4,1/4 G3,1/8 A3,1/8 B3,1/8 C4,1/8
D4,1/4 G3,1/4 G3,1/4
E4,1/4 C4,1/8 D4,1/8 E4,1/8 F#4,1/8
G4,1/4 G3,1/4 G3,1/4

B2,1/2 A2,1/4

C4,1/4 D4,1/8 C4,1/8 B3,1/8 A3,1/8
B3,1/4 C4,1/8 B3,1/8 A3,1/8 G3,1/8
F#3,1/4 G3,1/8 A3,1/8 B3,1/8 G3,1/8

D3,1/4 B2,1/4 G2,1/4
F#2,1/4 D2,1/4 F#2,1/4

D4,1/4 G3,1/8 A3,1/8 B3,1/8 C4,1/8
D4,1/4 G3,1/4 G3,1/4
E4,1/4 C4,1/8 D4,1/8 E4,1/8 F#4,1/8
G4,1/4 G3,1/4 G3,1/4

B2,1/2 A2,1/4

C4,1/4 D4,1/8 C4,1/8 B3,1/8 A3,1/8
B3,1/4 C4,1/8 B3,1/8 A3,1/8 G3,1/8
A3,1/4 B3,1/8 A3,1/8 G3,1/8 F#3,1/8

C2,1/4 D2,1/4 D2,1/4
G2,1/4 D2,1/4 G0,1/4

You can see, both the notes and metadata about the song are found all in one place, completely apart from the code.  At the very top of the file are attributes which are denoted with an ‘@’.  Notes are comma separated tuples where the first field is the note itself and the 2nd field is its duration.   Notes are divided into sections attributed to instruments (set off by an &).  Multiple sections for a single instrument simply append notes.

In this particular example, we have two instruments, one called lefthand and the other called righthand.  They simulate the left and right hands when playing the very simplified version of Minuet in G from the Easiest Book of Piano Favorites.

Both the notes and the durations are defined in a file.  The notes get mapped to frequencies and the durations get mapped to fractions of beats.  In my notation, 1/2 means half note, 1/4 means quarter note, etc… and if it ends in a period, that’s a dotted note.

Like all great projects, this one needed a name… and so I scoured Wikipedia‘s audio/sound entries for the first cool sounding term that I had no real understanding of… and that became the name of the project… Submediant. Even after trying to read the wiki page… I still have no idea what a Submediant is… but I’m sticking to it.

Get it Together – Animation Planning

It’s been a little while since I’ve actually opened the modeler… and I’m really craving some actual work in 3D.   Time lately has started to become quite a commodity… I just can’t seem to find more than an hour or so per day to dedicate to these projects… sigh.

Plodding forward though, The first animation that I want to put together for Little Robots is a sequence where Seña is first activated and is interacting with her creator for the first time .

The perspective is from the creator who will probably be voiced by me.  The whole scene will be done while looking through a large magnifying lamp because well… the little robot is little!  The setting is a cluttered wooden work desk where the robot is being assembled. There are a variety of little doodads that need to get modeled that sit on the desk, so… I’m sure we’ll end up with a few blog posts about individual items.  The overall point of the animation is to exercise the rigging with a variety of interactions which instill an emotional response from the robot.

Assuming that this animation has a good feel to it, I’ll probably do a similar “Getting it together” animation for each of the other robots.  I’m toying with the idea of making the owner of the next robot, Hakko, speak completely in Japanese. I’ve always wanted to mess with subtitles!


What’s on my desk..?

… stays on my desk…

This image is just me showing off the new desk model that I created in blender.  This is based on my actual desk layout at home… although the objects resting on the desk in this case are fictional.  This is the first of many models necessary to bring about the scene described in a previous blog post… essentially where my first little robot will be born.

You aught to be able to click to get the original rendering.  Probably the most complex bit of this rendering is the lighting.  There’s a mix of yellowish artificial light coming from spotlights located behind the turret… and then a slightly blueish “natural” light from behind.

New Desk Accessories

This weekend I went through and added a couple new models to my desk scene..

First off, I wanted to model out a computer.  This is my rendition of a mac mini (older model).  Right now it’s really just the basic shape and a little bit of texturing… but it’ll do.  The power light is always on, even if it’s not plugged in.  It occurred to me while I was modeling this, I have no real idea how to make lights switch on/off… this is probably something I need to look into.

Along with the computer, it seemed pretty obvious that I’d need a monitor of some kind.  This is a pretty generic looking monitor.  I took the basic shape/button layout from a Dell 17″ LCD but stretched it out a little to make it wide screen.  At the moment, the buttons are all blank, but at some point in the future, I’ll add the UV mapping for a power switch, +, -, and source.  The base isn’t very inspiring, but I didn’t really want to spend a great deal of time on it…


Here’s a real rendering with the new computer components.  I still need to add cables, but in proper lighting both of these models look pretty good… you should be able to click for the full sized image.

Books and Book Covers

Creating book covers, particularly when you don’t really care about how well the book will actually sell… is a lot of fun.  For the first Little Robots animation, I need to come up with a *TON* of books…. here are the first two…

These are both hard cover books… I still have to build out a soft cover model as well as a Schaum’s outline style workbook model.  I’m sure that the softcover and workbooks will be more challenging than one might think… Sure, you could model it like just a box… but unlike hard cover books, the covers of their lighter weight counterparts tend to lift up on their own… plus there’s the possibility of the covers kinking and creasing.

If you’d like to use any of these book covers in your own models.. or are just curious what the images I built for them look like… here you go! Click for larger version.

I designed this one last night at like 1am.  It’s a pretty stoic design… and really was meant to be just the template image to use for future books.  I ended up liking the way it came out… so It’ll probably get used in the actual animation.

This second book I took a little more time with.  The image that you see on the front and back covers was taken with my iPhone.  I had a couple of old 1GB DIMMs from my Mac Mini.  I placed them side by side and snapped the image being careful not to have any company logos or names showing.

I need maybe 4 or 5 more tech related books to have laying around on my desk.  Any ideas?


The way you model cables in Blender involves is summarized with this video: Making a Cable in Blender.

The thing is, that tutorial was created using the older interface… and it’s a bit tough to find in the new one.  After struggling with it a little bit… I came up with the cable you see to the right.

I can now begin to create lots and lots of cable… which is good because cables make the world go round!

Something to write with

Adding to the list of random things on my desk, we have a pen and a piece of paper.

The piece of paper is about as trivial to model as you might thing.  I decided to UV Map it so that I could have both a front and back side of the page (though you can’t see it here).  It also means that the stuff on the page itself will deform properly if I decide to wrinkle or otherwise mess with the page.

The pen was trickier to model than I thought.  There are some funny curves and you have to cinch the subdivision surfaces at the right places for them to look right.  For some reason the label that I applied to the pen refuses to show up in this rendering. I’ll have to dig into that later.

Workbench Concept Art

Over the weekend, I was having serious trouble modeling out what I thought the assembly area on the desk would look like.

Originally I had envisioned an aligator clip contraption, sets of tweezers, and a magnifier lamp.  That all seemed kind of boring though.  I then came up with a stepper motor kind of arm contraption that would be used in place of the aligator clips.   As it turns out, this is a hard thing to model without some kind of visual reference… and since it’s a fictional piece of equipment… well… I had to go back to the drawing board… literally.

The actual size of this armature would be pretty small as what it held would be the primary focal point of the magnifier lamp.  Since it’d be pretty small, it’s impractical to adjust the thing by hand, so I came up with a set of dials which will connect via wires to the robotic armature.

Here you see three knobs, which ostensibly control three axis of adjustment that the arm can move in.  The larger, shorter section of the knob is used for “course” movement and the smaller, longer inner knob is for “fine” movement.

My first stab at drawing this thing had all 3 knobs lined up in space, but it occurred to me that if I did that, the gearing of the knobs within the housing would all intersect.  Because of that, they’re all offset from each other slightly in the drawing… and will also be in the model.

Computer Setup in Scene

This drawing represents how the main computer in the animation will be arranged.  It’s loosely based on my actual computer layout.  Yes, voicing the Richard character from the script isn’t going to be a stretch for me!

In real life, my center display is an iMac and I have a my Mini set up to be a shell server.  I don’t think that the Richard in the animation would need a set up like this… instead he probably has a couple of home made linux servers under his desk.

So, what needs to happen next… I have to model a set of headphones, customize the monitors so that three distinct monitor models exist.  I have to model a mouse and my Griffin Powermate… and I need to start working on the videos that will make up the monitor content.  The latter will be the most challenging, I’m sure.  I honestly don’t know how video as a texture will render.