This is a MakeCode extension based on a port of SAM by Sebastian Macke.
SAM "Software Automatic Mouth" itself is a legendary text to speech algorithm from 1982 for the Commodore C64
This repository can be added as an extension in MakeCode.
- Open https://makecode.microbit.org
- Click on New Project
- Click on Extensions under the gearwheel menu
- Search for https://github.com/adamish/pxt-billy and import it
Basic usage
input.onButtonPressed(Button.A, function () {
billy.say("Hello World")
})
input.onButtonPressed(Button.B, function () {
billy.say("I am a DALEK - EXTERMINATE")
})
The voice can be configured from an existing preset
input.onButtonPressed(Button.A, function () {
billy.configureVoice(VoicePreset.Dalek)
billy.say("I am a DALEK - EXTERMINATE")
})
The voice can be configured with individual values for speed, pitch, throat and mouth Each value is in the range of 0 to 255
- speed - how quickly the voice talks - low value slow, high value fast
- pitch - how high or low the voice sounds
- throat - how relaxed or tense is the tone of voice
- mouth - how tight-lipped the voice sounds
input.onButtonPressed(Button.A, function () {
billy.configureVoice(92, 60, 190, 190);
billy.say("I am a robot")
})
Advanced pronounciation can be achieved with direct use of phonemes
See original SAM manual for full details of the syntax
input.onButtonPressed(Button.A, function () {
billy.pronounce("/HEHLOW WERLD")
})
- for PXT/microbit
(The metadata above is needed for package search, update it with the targets you support)
- Icon from Text to speech icons created by Freepik - Flaticon
- Sebastian Macke - author of the C port of SAM
- Authors of BBC micro:bit MicroPython speech module for inspiration
MIT