Ok, i will post some other funny code i wrote some time ago for the demo "hyptot1k" http://www.pouet.net/prod.php?which=23859
i compiled it to an obj, and linked the c demo auld wrote.
compile to an obj (and call the function named "speakIt" to start speaking)
\masm32\bin\ml /c /coff /nologo "speech1k.asm"
Please dont expect me to remember the code 100%, it was reverseEngineered from a c++ program by using ollyDgbg and a lot of free time :)
The speech text is in WIDECHAR... its probably smaller to write a fre lines of asm to WIDEN chars for you instead.
Hope someone find it usefull. Dont forget to link with ole32 and kernel32
It is only tested in windows xp sp2.
Enyoy!
.586p
.MODEL flat, stdcall
LoadLibraryA PROTO :DWORD
GetProcAddress PROTO :DWORD, :DWORD
CoInitialize PROTO :DWORD
CoCreateInstance PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
option casemap:none
.code
align 1
speakIt proc
pushad
xor edi, edi
mov esi, offset e
cmp dword ptr [esi], 0
jne @f
; invoke CoInitialize, null
push edi
call CoInitialize
; invoke CoCreateInstance, addr b, 0, 7, addr d, addr e
push esi
push offset d
push 00000007h
push edi
push offset b
call CoCreateInstance
@@:
; invoke sapiFunction, asdasd, offsetToText, 1, 0
push edi
inc edi
push edi
push offset a
mov edx, [esi]
push edx
mov edx, [edx]
call dword ptr [edx+50h] ; speak!!!
popad
ret
speakIt endp
;blah1 CLSID and such...
b db 077h, 093h, 074h, 096h, 091h, 033h, 0d2h, 011h, 09eh, 0e3h, 000h, 0c0h, 04fh, 079h, 073h, 096h
;blah2 CLSID and such...
d db 074h, 0dfh, 044h, 06ch, 0b9h, 072h, 092h, 049h, 0a1h, 0ech, 0efh, 099h, 06eh, 004h, 022h, 0d4h
; stuff to say: uit says "music is chip-on.com"
a db "m",0,"u",0,"s",0,"i",0,"c",0," ",0,"i",0,"s",0," ",0;,;0,"s",0
db "c",0,"h",0,"i",0,"p",0," ",0,"o",0,"n",0,".",0,"c",0,"o",0,"m",0,0,0,0;
;szOle32
e dd 0
end
hope someone likes it - you dont see many speech in 1k nowdays :-\
Edit - Corrected Code Tags
Heheh, liked it and duely added my Thumb :) Nice one.
you are to kind :D
Tiny code is really cool, I have a lot of respect for what can be fitted into only a kb :)
Dont suppose you know how the speech data is made up, please dude?
; stuff to say: uit says "music is chip-on.com"
a db "m",0,"u",0,"s",0,"i",0,"c",0," ",0,"i",0,"s",0," ",0;,;0,"s",0
db "c",0,"h",0,"i",0,"p",0," ",0,"o",0,"n",0,".",0,"c",0,"o",0,"m",0,0,0,0;
ofcourse :)
If you wanna say "CLYDE"
then simply type a zero between each char. like this:
a db "C", 0, "L", 0, "Y", 0, "D", 0, "E", 0 ,0,0
dont forget to put two zeros at the end (its a widestring) (or was it four zeros)
hope its clear how to use it now.
EDIT:
OPS, i forgot to tell you taht you have to compile like i did with the midiSoundSystem (so the code section gets READ/WRITE/EXEC), if you dont do this the program will not work.
you can fix this by moving these lines to the .data section instead:
;szOle32
e dd 0
Dude this awesome, f*****g tiny :o
I compiled a test version for C and FB users
Well done!
Cool work dudes, is there a way to change the speakers voice settings?
Yes. Create a exe in c++ or download a program that can do this and open it in ollydbg. Could be hard to change settings.. i think you will have to use another CLSID and those are big.
Right now i have no clue at all how to change pitch and other settings for the voice, but it can be done in the speech config program by microsoft, so i guess its possible.
Sorry for not helping at all :)
Hehe, I'm going to be starting work on a little 40kb soon, thanks to you Saida I'll probably have speech in it :)
What would be cool, is a lip sync demo with a talking head. Without the need for Scrollers.
Alittle off course; but you've made me remember that I do have somewhere lib for Blitz from Blitzcoder showcase that uses the MS Speech engine. Which I'll see if I've still got. And also in the loft I've got the Speech Cartridge that was made for the C64.
That would be as cool as fuck.
Actually Thygrion did a demo with a head. It would be really neat if it had talked.
Sorry to drag up an old topic, but this is awesome man! :D I don't know squat about ASM, but is there a way we can send a FreeBASIC string to the ASM module, instead of hard coding it? That would be killer. I'll try to make a talking head that speaks whatever you type in, if someone can show me how to send it a string.
That would be cool to see, er hear.
It's about 4 lines of Freebasic to do that direct into the Windows Speech API - you wouldn't need the asm. I might check that out later if I get a chance.
Jim
Rbraz posted an archive above to do it in FB :)
That'll save me mucking about then, thanks for spotting! :D
Jim
Well, that one seems to have the text hard coded also. Unless I missed something. :whack:
and doesn't compile in fb .17b
Quote from: Stonemonkey on January 08, 2007
and doesn't compile in fb .17b
Did you have used compile.bat ? Btw I use the good old fbc 0.15 beta :)
Quote from: Dr_D on January 08, 2007
Well, that one seems to have the text hard coded also. Unless I missed something. :whack:
Yes, it was hard coded in asm, but I have changed saida's asm code to accept your own text, check out the attached file below.
Hope that help!
Oops, Jim beat me :whack: anyway I'll post the asm way to do that
Cool guys! These should be really fun to play with. Is anyone else going to make any demos? :inspired:
Also, Jim, there is a utility called Swig, that aids in converting C headers to FB header files. A little late now I guess. Sorry! :2funny:
Here's the freebasic code for the same thing http://dbfinteractive.com/index.php?topic=1161.0 (http://dbfinteractive.com/index.php?topic=1161.0)
Sorry for all the messing about - this post's supposed to be in there after Fryer's one. I split my FB code out of here and then re-merged the topic.
Thanks Dr_D, I'll see if I can find Swig next time. It only took me about half an hour to port the bits I wanted.
Jim
@Shockwave: I remember that head demo I did - it was in 3D Overload back in '04...I actually wanted to have its lips move when I coded that but I had nothing to sync it to or even worse the head was a static model.
I got the head model and the texture from the head demo that comes with blitz 3D (I got it from the demo so you don't have to buy it) if you guys want it...though you'd have to do some modelling to get the lips apart and tie a bunch of vertices to bones & stuff.
It'd be very cool to see where someone goes with this.