![]() |
Forum Index : Microcontroller and PC projects : Speech in MMBasic for Windows
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
I haven't implemented SAM in MMB4W as you can use the OS for Text2Speech. Here is how: q$=chr$(34) a$="powershell -command "+q$+"Add-type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak" t$="Hello world" s$="('"+t$+"');"+q$ system a$+s$ do loop Lines 2 and 3 are one line with a space between them. Tested on W11. Make sure you have TTS enabled through system settings (choose the voice you like). Any questions use google. Edited 2022-07-19 04:32 by matherp |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Peter, For what it's worth (possibly very little) even thought this solution provides ostensibly better results I would have done otherwise and implemented PLAY TTS as close to the CMM2 as possible. Why ? Given the other "superior" BASICs (and other development environments) available on Windows it is my opinion that if MMB4W has any purpose* beyond keeping you entertained for the first few months of this year then it is as a simulator of the CMM2 which means trying to simulate the function of the CMM2 as best as possible. In this particular case I know that Lance was trying to run a CMM2 game written by @TimD for the MMBasic Programming Challenge and I suspect using the SYSTEM method would produce significantly different (though possibly better) results. * Excluding being used as the eccentric front-end for a geothermal heating system. Just my 2p, it is after all your wheelhouse and I have my own windmills to tilt at, Tom Edited 2022-07-19 19:00 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
sub playtts(t$) static q$=chr$(34) static a$="powershell -command "+q$+"Add-type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('" static s$="');"+q$ system a$+t$+s$ end sub |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Peter, My grandmother thanks you for the egg sucking lesson ![]() Also the "built-in" Windows TTS is much more capable than that of the CMM2 so the workaround isn't an accurate simulation. That aside, that is pretty cool; it never occurred to me that you could do that sort of sh*t ... but then I never was a Windows (or for that matter Linux) aficionado. Best wishes, Tom Edited 2022-07-19 19:30 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Thank you Tom and Peter. Yes, I am using MMBasic for Windows as a CMM2 simulator, and yes, I'm trying to run @TomD's FactorFracture.bas with its Text To Speech, and, yes, when I've worked through the challenge '22 programs, I'll get back to Paul_L's geothermal controller. FWIW, we both think this version with a mashup of MMBasic for Windows and PicoMite is much closer to a solution than what we've tried before, in part because it enables the biggest screen possible to suit Paul's eyesight. And yes, it's eccentric. The whole thing, working now for many years but without feedback as to exact temperatures and timings, was designed and built by Paul. It's quite the apparatus without any microcontroller at all. He wants to provide intelligence and real-time monitoring, and that's where MMBasic comes in. (By the way, Peter's TTS code worked perfectly and I've moved on to what may be another issue with how perfectly mMMBasic for Windows simulates the CMM2.) Edited 2022-07-20 01:17 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 949 |
You can download a Windows executable SAM here: S.A.M. Does this perhaps help? The TTS in the Picomite is based on this code... Frank |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Thanks for the link Frank ... doesn't really help, except possibly as to what I will use if I ever get around to adding sound to MMB4L. I guess this was really a conversation about what MMB4W is ... it is of course what Peter decides it is since he is the only one contributing to it (likewise me c.f. MMB4L). According to it's source code the PicoMite does not have PLAY TTS; I suspect you mean the CMM2. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Speaking of MMB4L, you can easily get TTS by installing 'espeak' and then in MMBasic it is just: SYSTEM "espeak 'Hello World'" ... but if I ever add PLAY TTS it will have the option to use the same "8-bit" speech engine as the CMM2. Best wishes, Tom Edited 2022-07-20 18:00 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |