Hardware Reference
In-Depth Information
The 100-line script is left as an exercise for you! 9
Although the programming is comparatively simple, the record processing is not so. You need to get your voice
talent to record a few samples of the whole phrase to get a feeling for the rhythm patterns in their speech. You should
then sample all the words 10 and trim the individual phrases to leave no dead space at the start, while still leaving a
suitable gap at the end that matches the speakers' rhythm when a second word is concatenated directly to the end.
Having them say sample phrases first gives you an idea on their pacing so that in some cases you can ask them to leave
a longer pause than normal after each item. With this in mind, ask them to read a longer list than you actually need.
So for a number list ending at 60, ask them for 61. Unless they're experienced actors, humans naturally drop their
voice when reading the last element in a list, which sounds unnatural when it is suffixed with another digit.
This whole process can take several hours for recording, rerecording, and editing. But it is worth having a
personalized alarm clock for a distant partner or as a quirky 22nd-century gadget. If you record other phrases at the
same time (such as “Good morning,” “Good night,” or “Oy, get out of my house!”), you can trigger the samples at other
times and for other reasons.
On the Arduino
Playback of the samples is straightforward on all Linux machines, including the Raspberry Pi. But even this seemingly
simple task is a lot for the Arduino to handle. It is possible. But it does require you to do a little more work and, in all
cases, will only ever manage a single file playing at once.
Software Solutions
With just an Arduino and a speaker it is possible to playback samples of a recorded voice. Given the output levels on
the Arduino, it can manage a reasonable volume without an amplifier—scoring above the humble Pi!
To achieve this minor miracle of engineering, you will need to be aware of the limitations:
u
A maximum playback frequency of 8KHz, meaning the highest frequency sound which can be
accurately portrayed is 4KHz (this is the Nyquist limit)
u
The standard memory will allow for only four seconds of sample data
u
You will have to preformat the samples into a suitable format, so no dynamic samples
(or real-time update) are possible
u
While using the sample player, the Arduinos duty cycle for PWM is directly manipulated in order
to provide the 8KHz sample rate. This means that no other analogue output will be possible.
If these limitations have yet to dissuade you, then suitable code and samples (pardon the pun) are available from
http://hlt.media.mit.edu/?p=1963 .
However, with such a short sample memory, you will either need to use an external memory shield, or utilize it
as more basic clock than detailed above. Or maybe use it as a virtual dog.
Hardware Solutions
One of the great benefits of the Raspberry Pi is that the chips are fast enough to handle sample playback out of the
box. It is, after all, a true computer. However, in those cases in which a micro-controller is the preferred solution, it is
always possible to add a “wave shield” to permit the playback of samples from an attached SD card. This will handle
a maximum bandwidth of sounds that are monaural 16-bit waves at 22 Khz.
4HEVOCALTIMESCRIPTISAVAILABLEINTHE-INERVAPACKAGEAS vtime
!UDACITYISTHESTILLDEFACTOSTANDARDFORAUDIOSAMPLINGANDEDITINGIN,INUXINMYOPINION
Search WWH ::




Custom Search