Make Your BeagleBone Speak- BeagleBone Cookbook Lesson 3.9

Опубликовано: 22 Март 2025
на канале: Einsteinium Studios
1,086
19

Make your beaglebone speak with flite! A written tutorial for this episode can be found at einsteiniumstudios.com/speak.html


Commands used in this tutorial:

ssh [email protected]

apt-get install flite

nano ~/.asound.rc

Contents to put in this file:

pcm.!default {
type plug
slave {
pcm "hw:1,0"
}
}
ctrl.!default {
type hw
card 1
}

(Exit the nano editor by pressing ctrl+x, then pressing 'y' to save the file)

arecord -l

flite -t "Shall we play a game?"

nano speak.js

The code to be put into this file:

#!/usr/bin/env node

var exec = require('child_process').exec;

function speak(phrase) {

exec('flite -t "' + phrase + '"', function (error, stdout, stderr) {

console.log(stdout);

if(error) {
console.log('error: '+ error);
}
if(stderr) {
console.log('stderr: '+ stderr);
}
});
}

speak("Hello, My name is Borris. "+
"I am BeagleBone Black, " +
"A true open hardware, " +
"community-supported embedded computer for developers and hobbyists. " +
"I am powered by a 1 Giga Hertz Sitara ARM Cortex-A8 processor. " +
"I boot Linux in under 10 seconds. " +
"You can get started on developement in " +
"less than 5 minutes with just a single USB cable. " +
"Bark, Bark!");

node speak.py