Thursday, 18 October 2012

Hacking out an audio amplifier for a text-to-speech puppet voicebox

@Twitr_janus needs a voicebox. This will do two things:

  • Amplify the Processing text-to-speech output from  a feeble PC audio speaker to a dedicated speaker in the puppet 
  • Provide a voltage level that is high ebough to use as an analog input to be detected by the Arduino board, to power the speech to jaw motion sync
In the top left photo, is a standard PC audio amplifier rigged up to an iphone as a test source. In the right photo is a standard phono plug, which will provide the output..
Hacking open audio amplifier Hacking open audio amplifier













Below left is where is he output plug comes out of the amplifier. The output cable was cut to expose the wires (below right)

Hacking open audio amplifier Hacking open audio amplifier













This cable is coaxial. The outer sheath copper mesh is the earth level, with a sheathed inner copper core

Hacking open audio amplifier Hacking open audio amplifier














Below left is what the stripped cable looks like. Below right with the oscilloscope lead attached

Hacking open audio amplifier Hacking open audio amplifier













And on the left here is the signal trace. Each square is 1V.

Hacking open audio amplifier
This is what will be used to drive the Arduino. The output which is here driving the oscilloscope will be attached to the Arduino analog input. The Arduino will convert the analog audio level into digital data. In fact a number between 0 and 1024.

The Arduino script will send pulses to a relay if the signal peak is higher than a preset threshold level.

In practise the jaw will trigger to move, if there is a peak speech output (e.g. a plosive B, etc)



This is done in Arduino with a function that polls the analog input, something like this. (This example uses variables that would normally be declared elsewhere in the sketch.)

void jawTrigger () { //  jawTrigger is a function to be called in the Arduino loop()


jawPeakVol = analogRead(analogPin); // turns voltage from amplifier signal wire into a number between 0 and 1024
  if (jawPeakVol >= jawThresholdVol) {
  digitalWrite (jawRelayPin, HIGH); 
// trigger the relay to make the jaw motor move if the voltages peaks above a preset threshold (jawThresholdVol)
     }   // end if
  else if (jawPeakVol < jawThresholdVol) {
      digitalWrite (jawRelayPin, LOW); 
// trigger the relay to make the jaw motor return to default rest position if the voltage drops below the threshold
  }  // end else if
}   // end jawTrigger

This is not able to simulate how a real mouth looks when speaking, which will change shape depending on the phonemes in the speech. Here the mouth movement is synced to an audible peak, which the audience will hear as they see movement, and the brain will believe it is speaking the words.

The speaker is stereo. There are two outputs

Hacking open audio amplifierThe PC amplifer has two speaker boxes. One master speaker with an amplifier in it and one slave speaker that is driven by it.

The lead above  is the feed from the master box to the slave box.
Inside the master box is the speaker that will be the voicebox itself. This was removed from the box, and the box was then cut up to use as a mount






Old long-handled, sheet-metal-cutting shears make light work of even such a thick plastic casing (below left)
Below right is the amplifier extracted from the box

Hacking open audio amplifier Hacking open audio amplifier

No comments:

Post a Comment