hotword engines
Jun. 10th, 2020 09:45 pmSo, I have a long-term goal of writing my own smart speaker program using publicly-available software. And I've met the intermediate goal of making essentially a version of the old Eliza chatbot that you can converse with aloud. I downloaded an Eliza implementation in Python from Github, and used one of those cloud speech recognition engines, and combined them in a way where I can swap the speech engine for a text engine -- meaning I can switch to a different speech engine, too. And I can swap out Eliza for a chatbot of my own design, once I get all the glue in place...
one of these glue elements is, I want this chatbot to have a wake word. like it shouldn't start listening for actual sentences until it hears its name. There's an engine called Snowboy that everyone seems to use... except that it's impossible to install on my Mac or my Raspberry Pi. The python bindings all fail and crash and burn. ...there's another one called Porcupine which seems to work better, but it's complicated to start using... and also seems to have some limitations. like, I'm stuck with the default wake words until I can get a commercial license to use it. so I guess I'll rename it to "bumblebee" or something instead of "Annette" which isn't a good wake word anyway; it's only four phonemes long.
a problem I'm running into with speech/AI/cloud stuff is that I keep finding things that look like they're going to work great, but they're at end-of-life. Snowboy is one of them, that's probably why I can't get it to compile on anything. Six months ago it was Kalliope, which you were supposed to run locally but program through the cloud, somehow. Now there's wit.ai, an intent detection engine, which isn't shutting down... but as I asid before, it's been bought by Facebook, which means I can't get my API token with my Github account anymore, I have to use my Facebook account. Gah.
this is going pretty slowly, I hope I can get past these dumb obstacles and get to writing the conversations soon... even then i'll probably get bogged down in data structures...
one of these glue elements is, I want this chatbot to have a wake word. like it shouldn't start listening for actual sentences until it hears its name. There's an engine called Snowboy that everyone seems to use... except that it's impossible to install on my Mac or my Raspberry Pi. The python bindings all fail and crash and burn. ...there's another one called Porcupine which seems to work better, but it's complicated to start using... and also seems to have some limitations. like, I'm stuck with the default wake words until I can get a commercial license to use it. so I guess I'll rename it to "bumblebee" or something instead of "Annette" which isn't a good wake word anyway; it's only four phonemes long.
a problem I'm running into with speech/AI/cloud stuff is that I keep finding things that look like they're going to work great, but they're at end-of-life. Snowboy is one of them, that's probably why I can't get it to compile on anything. Six months ago it was Kalliope, which you were supposed to run locally but program through the cloud, somehow. Now there's wit.ai, an intent detection engine, which isn't shutting down... but as I asid before, it's been bought by Facebook, which means I can't get my API token with my Github account anymore, I have to use my Facebook account. Gah.
this is going pretty slowly, I hope I can get past these dumb obstacles and get to writing the conversations soon... even then i'll probably get bogged down in data structures...
SpeedScript
Sep. 17th, 2019 09:03 amI feel the need to put a finer point on this SpeedScript thing.
SpeedScript had no idea where the cursor was on the screen, only in memory. So in order to blink the cursor, it had to blink the actual letter in the document, and then redraw the screen.
This was already a problem on the c64; where I can now type faster than the screen redraws. The Vic-20 probably didn't have this problem because it had fewer letters to draw. The Commander X-16 prototype runs at 8 MHz so it's lightning fast in 40-column mode, but 80-column mode also has 60 rows. So it has to redraw 4120 characters every time anything on the screen changes.
It'd probably be worth my while to optimize it, like maybe store a line length table or something. But every optimization means I'll have to track something that SpeedScript for the C64 never had to track. It never scrolled the screen, for example; it just moved the top-of-screen pointer before redrawing.
I already tried to track the cursor position on the screen, but that's easier said than done. I can catch the cursor position when the screen is redrawn, but that means if they move the cursor, SpeedScript will have no idea where the cursor is until it redraws again. so I need to find some cheaper way of locating the cursor.
I'll probably need a lookup table or something.
SpeedScript had no idea where the cursor was on the screen, only in memory. So in order to blink the cursor, it had to blink the actual letter in the document, and then redraw the screen.
This was already a problem on the c64; where I can now type faster than the screen redraws. The Vic-20 probably didn't have this problem because it had fewer letters to draw. The Commander X-16 prototype runs at 8 MHz so it's lightning fast in 40-column mode, but 80-column mode also has 60 rows. So it has to redraw 4120 characters every time anything on the screen changes.
It'd probably be worth my while to optimize it, like maybe store a line length table or something. But every optimization means I'll have to track something that SpeedScript for the C64 never had to track. It never scrolled the screen, for example; it just moved the top-of-screen pointer before redrawing.
I already tried to track the cursor position on the screen, but that's easier said than done. I can catch the cursor position when the screen is redrawn, but that means if they move the cursor, SpeedScript will have no idea where the cursor is until it redraws again. so I need to find some cheaper way of locating the cursor.
I'll probably need a lookup table or something.
(no subject)
Sep. 16th, 2019 11:42 pmSo, the 8-Bit Guy's dream computer, the Commander X16, has reached a physical prototype stage, and seems to borrow so heavily from the Commodore 64 that I've already got SpeedScript kinda-sorta working.
It even works in the X16's 80-column mode, but it's much much slower in that mode, because it turns out SpeedScript redraws the entire screen constantly. In fact, that's how it blinks the cursor: it changes the letter your cursor is pointing at to an inverse version of itself, and just draws that whole section of the document to the screen. If you reset whil the cursor is visible, then the c64 version actualy has an NMI that smooths things out.
i need to figure out how to detect shift-ctrl commands, there's a lot of that
It even works in the X16's 80-column mode, but it's much much slower in that mode, because it turns out SpeedScript redraws the entire screen constantly. In fact, that's how it blinks the cursor: it changes the letter your cursor is pointing at to an inverse version of itself, and just draws that whole section of the document to the screen. If you reset whil the cursor is visible, then the c64 version actualy has an NMI that smooths things out.
i need to figure out how to detect shift-ctrl commands, there's a lot of that
(no subject)
Mar. 28th, 2013 10:46 pmLatest version actually allows you to type quotes and parentheses... and color codes, even on the Web emulator.
You can even type Ctrl-9 to get reverse text that doesn't blink, and Ctrl-N to go into lowercase mode.
You can even type Ctrl-9 to get reverse text that doesn't blink, and Ctrl-N to go into lowercase mode.
(no subject)
Mar. 27th, 2013 07:06 pmStar Trek kinda works. remember to press CTRL to unlock the keyboard first. you can type LOAD with or without a filename.
There are three demos: Eliza, Star Trek, and 10 PRINT.
There are three demos: Eliza, Star Trek, and 10 PRINT.
(no subject)
Mar. 25th, 2013 10:23 pmSo there are actually two problems, not just one, with the math.
For one, those gigantic numbers I've been seeing happen every time you INT a negative number.
Also, some subtractions come out derped. Particularly, if the number you're subtracting uses all 32 bits of the mantissa, the answer will be off by some power of two, in the negative direction.
if it's not one thing, it's another, eh. I've spent a little time walking through the routines and comparing them with the 6502 version, but haven't found anything that would explain any of this. I'll definitely have to fix it before Star Trek will work.
For one, those gigantic numbers I've been seeing happen every time you INT a negative number.
Also, some subtractions come out derped. Particularly, if the number you're subtracting uses all 32 bits of the mantissa, the answer will be off by some power of two, in the negative direction.
if it's not one thing, it's another, eh. I've spent a little time walking through the routines and comparing them with the 6502 version, but haven't found anything that would explain any of this. I'll definitely have to fix it before Star Trek will work.
(no subject)
Mar. 24th, 2013 11:29 pmSome mysterious calculation is resulting in the number -1.61061279E+09, probably a subtraction.
On a real c64, this is represented by the bytes 9f c0 00 00 6c. either the c0 doesn't belong there or the 6c doesn't belong there. I won't know until I catch it in the act. it only occurs in the Star Trek game, and not very reliably. If I can find the right random seed to make it happen early enough in the game, I can nail it.
Also, I just had an idea on how to get a tiny speed bump and postpone 32-bit division a little longer. The power and square root operators are wonky because they involve a log as one step, and the log involves an inverse square root. Well, I just remembered John Carmack had a famous "fast square root" that involved casting a float as a long integer, and subtracting it from a magic number. I think I might be able to use that here, though I'd need a 40-bit magic number.
On a real c64, this is represented by the bytes 9f c0 00 00 6c. either the c0 doesn't belong there or the 6c doesn't belong there. I won't know until I catch it in the act. it only occurs in the Star Trek game, and not very reliably. If I can find the right random seed to make it happen early enough in the game, I can nail it.
Also, I just had an idea on how to get a tiny speed bump and postpone 32-bit division a little longer. The power and square root operators are wonky because they involve a log as one step, and the log involves an inverse square root. Well, I just remembered John Carmack had a famous "fast square root" that involved casting a float as a long integer, and subtracting it from a magic number. I think I might be able to use that here, though I'd need a 40-bit magic number.
(no subject)
Mar. 24th, 2013 10:51 amStar Trek kinda-sorta works, but there's this overflow error I keep getting.
It uses
I'll have to dive into the floating point routines once again to fix this, and I'll have to do that before releasing this.
It uses
DEF FN
to compute distances with the Pythagorean formula, which uses exponents, which in turn uses division. So there's a chance that the 16-bit division shortcut is to blame. Still, it should be resulting in inaccurate answers, not aborting the program.I'll have to dive into the floating point routines once again to fix this, and I'll have to do that before releasing this.
(no subject)
Mar. 23rd, 2013 03:04 pmIt's so obvious now.
Star Trek. That's a BASIC game from the 1970s, and thematically appropriate.
I tried it, and it works with a little modification. It's slow too, probably too slow to play, but you can at least see it working. So it's more like playing Star Trek on a 300 baud modem than anything else.
Star Trek. That's a BASIC game from the 1970s, and thematically appropriate.
I tried it, and it works with a little modification. It's slow too, probably too slow to play, but you can at least see it working. So it's more like playing Star Trek on a 300 baud modem than anything else.