# Teddy Ruxpin Rebuild

## Overview

https://youtu.be/89OPQwlKc18

Come Dream with Me Tonight...

Teddy Ruxpin is a very cool animatronic talking teddy bear toy, originally from the 1980s and re-released in 2017. Kids absolutely love this guy -- he tells stories, sings songs, and captivates kids' attention for hours.

These days, Teddy Ruxpin toys are available on eBay for a fraction of their original cost. The animatronics work great, and there's no other source we've found for a complete animatronic system for such an affordable price.&nbsp;

The amazing engineers at Adafruit have figured out how to unpack Teddy's code and upload our own voice files and eye graphics. And since he's such a standard size for a stuffy, his skin is changeable too. I've put my Teddy Ruxpin's insides into a Figment the Dragon stuffy, and he fits almost perfectly.&nbsp;

I have two baby nieces who love dragons, so I got their grandparents to record audio files for this toy, so they can hear a story read by Grandma or Grandpa whenever they wish.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/662/medium800/hacks_friends.jpg?1692384493)

## Parts Needed

- A [Teddy Ruxpin from 2017](https://www.ebay.com/sch/i.html?_nkw=teddy+ruxpin+2017) -- these are easy to find on eBay
- A 10" stuffy with a similar shape to Teddy: I used [Figment the Dragon](https://www.shopdisney.com/figment-big-feet-plush-small-10-412303397181.html)
- A USB micro cable
- Scissors, a thread ripper, and a needle & thread
- Accessories to cover any scars

![](https://cdn-learn.adafruit.com/assets/assets/000/123/663/medium800/hacks_figment_done.jpg?1692384666)

# Teddy Ruxpin Rebuild

## Creature Build

Find or make a stuffy that's about the same size as Teddy. I used this [Figment the Dragon](https://www.shopdisney.com/figment-big-feet-plush-small-10-412303397181.html) stuffy. He's also 10" tall, and his mouth lines up almost perfectly with Teddy's mouth.&nbsp;

Take Teddy's vest off and cut the zip tie that holds his shirt in place.

![hacks_01_teddy_takedown.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/698/medium640/hacks_01_teddy_takedown.jpg?1692656536)

There are two JST connectors that lead to the switches inside Teddy's paws. Unplug these, then use a thread ripper to open him up until you can get the main part of the body out.

![hacks_02_jst_unplug.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/700/medium640/hacks_02_jst_unplug.jpeg?1692656696)

![hacks_02_teddy_threadrip.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/701/medium640/hacks_02_teddy_threadrip.jpeg?1692656737)

Turn Teddy's paws inside out and use a thread ripper to remove the switch. Also remove the piece of muslin fabric that's sewn to the inside of his paw to hold the switch in place. We'll use this same bit of fabric to install the switch into Figment's paws.

![hacks_03_teddy_paw.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/702/medium640/hacks_03_teddy_paw.jpeg?1692656797)

![hacks_07_teddy_paw_out.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/703/medium640/hacks_07_teddy_paw_out.jpeg?1692656891)

Open Figment in the same way, starting at the back of the neck. You'll need to remove a fair amount of stuffing. Set it aside for now, we'll tuck some of it back in so he stays nice and huggable.

I made a small hole at first and widened it bit by bit, to minimize the amount of sewing I needed to do at the end.

![hacks_05_figment_unstuff.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/705/medium640/hacks_05_figment_unstuff.jpeg?1692656951)

Turn Figment's paws inside out and hand-stitch the muslin pieces you pulled out of Teddy's paws onto the front side&nbsp; Figment's paws. Slip the switches inside and sew them in place, making sure the button presses from the front of the paws when they're turned right-side out again.

![hacks_12_figment_sewpaw.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/706/medium640/hacks_12_figment_sewpaw.jpeg?1692657044)

Use a utility knife to carefully cut Figment's pupils out. I stayed just inside the black section, to keep the fabric from unraveling and to give him a bit of "eyeliner".&nbsp;

I colored the inside of his eyes with a sharpie to cover up any white threads that were showing.

![hacks_18_figment_eyecut.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/711/medium640/hacks_18_figment_eyecut.jpeg?1692657732)

![hacks_19_figment_sharpie.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/712/medium640/hacks_19_figment_sharpie.jpeg?1692657755)

Make sure all the stuffing is out of Figment's face and slide the animatronic body into Figment's skin. Once it's inside, plug the JST connectors from the hands back in and adjust the face so that Teddy's mouth aligns with Figment's mouth.&nbsp;

Stuff Figment's stuffing back inside his head around the back, so his head skin fits tightly around the animatronics and the stuffing presses the mouth tightly against the front of Figment's face.

![hacks_14_insertion.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/707/medium640/hacks_14_insertion.jpeg?1692657184)

![hacks_15_mouth_aligned.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/708/medium640/hacks_15_mouth_aligned.jpeg?1692657370)

Sew Figment back up, starting with the back seam and finishing with the neck. He doesn't close fully around the animatronics, but that's fine - we need to leave the back open so we can reach the on/off switch and change the batteries. Just stitch him up as best as you can.&nbsp;

![hacks_16_figment_sewup.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/709/medium640/hacks_16_figment_sewup.jpeg?1692657381)

![hacks_17_back_stillopen.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/710/medium640/hacks_17_back_stillopen.jpeg?1692657489)

Figment's eyes are slightly closer together than Teddy's and I couldn't quite get them to line up. I fixed this by cutting a slit with my utility knife in between his eyes. I later covered this up by gluing on some purple jewels. Now he feels fancy, and his eyes line up perfectly with Teddy's.

![hacks_20_figment_headsplit.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/713/medium640/hacks_20_figment_headsplit.jpeg?1692657872)

![hacks_21_figment_jewels.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/714/medium640/hacks_21_figment_jewels.jpeg?1692657942)

Finally, I added a few stitches around the corners of his mouth to tighten up the fit around Teddy's mouth. This gave him a bit of a "facelift" and made the animatronic movement look a lot better.

![hacks_21_figment_facelift.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/123/715/medium640/hacks_21_figment_facelift.jpeg?1692657963)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/718/medium800/hacks_figment_done.jpg?1692658056)

# Teddy Ruxpin Rebuild

## Creating Audio Files

## What Files Do I Need?
Plug Teddy into your computer with a USB cable and a drive wil appear called **NO\_NAME**. On that drive is a folder called **Books** , and in that folder are all the story files, in .bin format.

**intro.bin** is the file that plays when Teddy starts up. It's the one where he sings "Come Dream with Me Tonight.."&nbsp; I replaced mine with a short recording that says "Hi Billie and Daisy! Would you like to hear a story?"

![hacks_teddy_contents.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/651/medium640/hacks_teddy_contents.jpg?1692377841)

There are 10 story files, but stories 4-10 are "locked" -- the manufacturers added these as a paid in-app purchase. Worlds of Wonder has long since gone out of business, so we couldn't figure out any way to unlock these stories. But we can access and replace the first three, which were included with the original purchase.

So, we have three spaces for stories: **Story01.bin** , **Story02.bin** , and **Story03.bin**. Each of these stories can be pretty long -- the original stories are close to 20 minutes in length so there's plenty of space. I kept mine to about 5 minutes.

## Creating Content

For the audio recordings for this project, I wanted to use voices that my baby nieces will recognize and love. I got their grandparents to send me recordings of about 5 minutes long, reading stories and nursery rhymes the kids will love.

My mom has an iPhone, so I asked her to make her recording using the Voice Memos app. After recording she clicked the "share" button in the app, and emailed me the audio file she created.&nbsp;

Their Australian Grandpa couldn't think of what to read, so I used [ChatGPT](https://chat.openai.com/) to write a personalized story using my nieces' names, and telling all about the animals in Australia. Here's the prompt I used:

Please write me a rhyming 800 word story in the style of Mother Goose about Australian animals who become friends with little girls named Daisy and Billie.

ChatGPT did not let me down! Here are the first two paragraphs of this delightful tale:

In a land Down Under, where kangaroos hop,   
And kookaburras laugh atop a gum tree's top,   
Lived creatures unique, full of life and zest,   
In a tale of friendship, we're about to invest.

Daisy and Billie were two little mates,   
With hearts full of joy, they'd frolic in fates,   
Through the bushland they wandered, their spirits so free,   
Meeting critters and creatures, as happy as could be.

## Converting Audio Files

This project requires the audio files to be in 16 bit WAV file format. I used [Audacity](https://sourceforge.net/projects/audacity/), a free audio editing program, to convert the files.

Here's a complete guide on how to get the files into the correct format: [Convert Sound Files in Audacity](https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion)&nbsp;

I still had some trouble getting all the correct boxes checked - my audio files were just not working for some reason. So as a workaround, I stared with a known good 16-bit audio WAV file project, and opened my voice recording directly into that project. Then when I exported, the project already had the correct settings.&nbsp;

Here's a working .wav file to use as a starting point.

[intro-16bit.wav](https://cdn-learn.adafruit.com/assets/assets/000/123/822/original/intro-16bit.wav?1692732458)
Save your files as **Intro.wav** , **Story01.wav** , etc - this will make it easier to keep everything straight in the next few steps.

# Teddy Ruxpin Rebuild

## Building a new story file

Within the `mouthCues` section, you can add or delete lines, adjust `start` or `end` times, or change the mouth shape, called `value`.

While doing so, you need to make sure that:

- json syntax is respected
- the `start` times are in ascending order
- each `end` time is no later than the next "start" time
- the `value` is one of the following 9 uppercase letters: A, B, C, D, E, F, G, H, X

The letters A, F, and X correspond to a closed mouth; B, C, G, and H to a partially open mouth, and D and E to a fully open mouth.

You'll need some software for this:

- [Rhubarb Lip Sync](https://github.com/DanielSWolf/rhubarb-lip-sync/releases) (version 1.13.0 was used while creating this guide)
- The modified g722.1 encoder, available [from pypi](https://pypi.org/project/g722-1-mod/) and [github](https://github.com/jepler/g722_1_mod) for Windows, Linux and Mac with `pip3 install g722-1-mod`
- The Python scripts for creating a new **.bin** file, currently at [https://github.com/adafruit/snxrom](https://github.com/adafruit/snxrom)
- A program for re-sampling audio files. If you don't already have a program for doing this, one open source option is [Audacity](https://en.wikipedia.org/wiki/Audacity_(audio_editor)). [There's a dedicated guide for sample rate conversion in Audacity](https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion), but for this project you will be converting to 16kHz or 32kHz.

Grab the file **Intro.bin** from your Teddy Ruxpin's original files and save it as **orig\_Intro.bin**. It is used as the basis for the modified (patched) story file.

Record your new story in the audio format of your choice. Then, create a downsampled version in **wav** format at **16kHz or 32kHz** sample rate and **mono** (one channel) audio. If you don't already have a program for doing this, one open source option is [Audacity](https://en.wikipedia.org/wiki/Audacity_(audio_editor)).&nbsp;[There's a dedicated guide for sample rate conversion in Audacity](https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion), just remember that the supported sample rates for this project are **16kHz** (16000 Hz) or **32kHz** (32000 Hz)

The text below will refer to the original audio file as **story.wav** and the downsampled version as **story32k.wav**.

Create the mouth position json file with rhubarb using a commandline like:

> `rhubarb -f json -o mouth.json story.wav`

Now, you have all the files needed to run **earpatch** from **snxrom.git**.

> `python3 earpatch.py  --wav story32k.wav --rhubarb-json mouth.json orig_Intro.bin new_Intro.bin`

Copy **new\_Intro.bin** back to the **Books** folder as **Intro.bin** (the name must match exactly), eject/safely remove the USB device, then turn Teddy's power off and back on. Teddy will begin with your story, the mouth movements detected by Rhubarb, and eye animations occurring on average once every 30 seconds.

## Rhubarb json files

The file produced by rhubarb looks something like the following:

```auto
{
  "metadata": {
    "soundFile": "story.wav",
    "duration": 23.64
  },
  "mouthCues": [
    { "start": 0.00, "end": 0.34, "value": "A" },
    { "start": 0.34, "end": 1.12, "value": "B" },
    { "start": 1.12, "end": 1.68, "value": "D" },
    { "start": 1.68, "end": 1.82, "value": "C" },
    { "start": 1.82, "end": 2.17, "value": "B" },
```

# Teddy Ruxpin Rebuild

## Mouth Movement

We're using **earpatch.py** to automatically create mouth movements from our .wav files. It does a fairly good job. It's not quite perfect, but it's possible to modify the file it creates to improve synching of the words and mouth.&nbsp;

On my Mac, I created a Rhubarb folder in my home directory, since Python on Mac requires a typing full file path, I got a bit tired of typing seven nested folder names. You can install all your software into this folder so it can work together.

Save your 16-bit .wav audio files into this folder as well.

![hacks_Rhubarb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/660/medium640/hacks_Rhubarb.jpg?1692380940)

## Songs & Music Files

I wanted to play a song for my nieces as Story03.bin, but this posed a tricky problem: the **earpatch.py** script can't tell the difference between music and speech, so it continues to move the mouth during instrumental sections. It is also really coded for speech, not song, and it seems to get lost during singing where a vowel is held longer than it would be when speaking.&nbsp;

To get around this, I created two different .wav files: one with my song, and then another where I clearly spoke the lyrics in time with the song. I created the **mouth.json** file using the spoken .wav file, and then created the final .bin file using the singing-and-playing .wav file.&nbsp;

## Create the Mouth Movement File

Open a terminal window and create the mouth file using a command like:

```terminal
/Users/erin/Rhubarb/rhubarb -f json -o mouth_intro.json intro.wav
```

where the file path points to your Rhubarb folder, and **intro.wav** is the audio file you're converting. The script will create a file called **mouth\_intro.json** , which we'll use when we create the .bin file on the next page of the guide.

## Modifying Mouth Movement Files

Open up **mouth\_intro.json** using a text editor and take a look at it. It should look something like this:

```auto
{
  "metadata": {
    "soundFile": "/Users/erin/Rhubarb/intro.wav",
    "duration": 6.09
  },
  "mouthCues": [
    { "start": 0.00, "end": 1.23, "value": "X" },
    { "start": 1.23, "end": 1.29, "value": "C" },
    { "start": 1.29, "end": 1.48, "value": "E" },
    { "start": 1.48, "end": 1.58, "value": "A" },
    { "start": 1.58, "end": 2.28, "value": "B" },
    { "start": 2.28, "end": 2.40, "value": "A" },
    { "start": 2.40, "end": 2.51, "value": "D" },
    { "start": 2.51, "end": 2.72, "value": "B" },
    { "start": 2.72, "end": 2.86, "value": "C" },
    { "start": 2.86, "end": 3.21, "value": "B" },
    { "start": 3.21, "end": 3.83, "value": "X" },
    { "start": 3.83, "end": 4.06, "value": "F" },
    { "start": 4.06, "end": 4.13, "value": "C" },
    { "start": 4.13, "end": 4.27, "value": "F" },
    { "start": 4.27, "end": 4.62, "value": "B" },
    { "start": 4.62, "end": 4.76, "value": "E" },
    { "start": 4.76, "end": 4.97, "value": "B" },
    { "start": 4.97, "end": 6.09, "value": "X" }
  ]
}
```

Within the&nbsp;`mouthCues`&nbsp;section, you can add or delete lines, adjust&nbsp;`start`&nbsp;or&nbsp;`end`&nbsp;times, or change the mouth shape, called&nbsp;`value`.

While doing so, you need to make sure that:

- json syntax is respected
- the&nbsp;`start`&nbsp;times are in ascending order
- each&nbsp;`end`&nbsp;time is no later than the next "start" time
- the&nbsp;`value`&nbsp;is one of the following 9 uppercase letters: A, B, C, D, E, F, G, H, X

The letters A, F, and X correspond to a closed mouth; B, C, G, and H to a partially open mouth, and D and E to a fully open mouth. With Teddy's animatronics, we don't really need this many options -- A, F, and X all do the same thing: close the mouth. I found it easier to understand and edit this file by using just one letter from each category:

- X = closed mouth
- B = partially open&nbsp;
- E = fully open

I opened my .wav file in Audacity to see the time points of each section, so I could find the corresponding lines in the code and modify the movements as needed.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/661/medium800/hacks_mouth_grandma.jpg?1692382031)

I spent a lot of time on my **intro.wav** mouth file since that's the first thing kids will see, and it will get watched a lot. I didn't worry too much about the longer story files since it can get really tricky to figure out which lines need to be edited.

It helps to play the .wav file in Audacity at the same time Teddy is speaking to find the time points that need editing.

# Teddy Ruxpin Rebuild

## Story Files

Grab the file&nbsp; **Intro.bin** &nbsp;from your Teddy Ruxpin's original files and save it as&nbsp; **orig\_Intro.bin**. It is used as the basis for the modified (patched) story file.

Now, you have all the files needed to run&nbsp; **earpatch** &nbsp;from&nbsp; **snxrom.git**.

Back in your terminal window, type a command like:

```terminal
python3 earpatch.py  --wav Intro.wav --rhubarb-json mouth_intro.json orig_Intro.bin new_Intro.bin
```

A file called **new\_Intro.bin** will be created. Rename this to **Intro.bin** and copy to your Teddy's **NO\_NAME/Books** drive, replacing the existing **Intro.bin** file.

Eject Teddy and turn him off with the switch on his back. Unplug the USB cable and turn him on again. Your new Intro file will play in place of the original intro.&nbsp;

Do the same with **Story01.bin** , **Story02.bin** and **Story03.bin**. If the mouth movements don't quite match up to your liking, head back to the Mouth Movement page of this guide for instructions on how to edit the mouth.json files, then create another .bin file using the edited .json file.

## Troubleshooting

One error I got a few times looked like this:&nbsp;

```terminal
File "/Users/erin/Rhubarb/earpatch.py", line 109, in earpatch
    assert wav_params.framerate in (16000, 32000)
AssertionError
```

This is telling me that my .wav file is formatted incorrectly. The script needs a 16-bit WAV file and my framerate is too high. Try again using our sample Audacity project on the previous page of this guide. If that one works, try opening your audio file into the same Audacity project and export it using the existing settings.

Be sure you've named your new files to be exactly the same as Teddy's original files. **Intro.bin** is not the same as **intro.bin** -- make sure the name and case match exactly.


## Related Guides

- [Hacking Holiday Animatronics](https://learn.adafruit.com/hacking-holiday-animatronics.md)
- [See N Say Brain Transplant](https://learn.adafruit.com/see-n-say-brain-transplant.md)
- [Adafruit CAN Pal](https://learn.adafruit.com/adafruit-can-pal.md)
- [Controlling a Classic Nintendo R.O.B. Robot Using Circuit Playground Express](https://learn.adafruit.com/controlling-a-classic-nintendo-r-o-b-robot-using-circuit-playground-express.md)
- [Wizzy: A Needle Felted Cat](https://learn.adafruit.com/wizzy-a-needle-felted-cat.md)
- [Matrix 2 Mod](https://learn.adafruit.com/matrix-2-mod.md)
- [AI 3D Printed Figure](https://learn.adafruit.com/ai-figure.md)
- [DC, Servo, Stepper Motors and Solenoids with the Pico](https://learn.adafruit.com/use-dc-stepper-servo-motor-solenoid-rp2040-pico.md)
- [Use Docker to Compile Linux for ESP32-S3](https://learn.adafruit.com/docker-esp32-s3-linux.md)
- [micro:bit Crickit Robot](https://learn.adafruit.com/microbit-crickit-robot.md)
- [Using an External Drive as a Raspberry Pi Root Filesystem](https://learn.adafruit.com/external-drive-as-raspberry-pi-root.md)
- [A Quick Linux VM on Windows with Vagrant](https://learn.adafruit.com/a-quick-linux-vm-on-windows-with-vagrant.md)
- [DIY Welded Bike Stand](https://learn.adafruit.com/diy-welded-bike-stand.md)
- [Fisher-Price USB Controller](https://learn.adafruit.com/fisher-price-usb-controller.md)
- [CRICKIT WobblyBot](https://learn.adafruit.com/crickit-wobblybot.md)
