Author Topic: speech in 1k?  (Read 10806 times)

0 Members and 1 Guest are viewing this topic.

Offline saida

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • saidas webpage
speech in 1k?
« on: September 14, 2006 »
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!

Code: [Select]
.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
« Last Edit: September 14, 2006 by saida »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: speech in 1k?
« Reply #1 on: September 14, 2006 »
Heheh, liked it and duely added my Thumb :) Nice one.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline saida

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • saidas webpage
Re: speech in 1k?
« Reply #2 on: September 14, 2006 »
you are to kind   :D

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: speech in 1k?
« Reply #3 on: September 14, 2006 »
Tiny code is really cool, I have a lot of respect for what can be fitted into only a kb :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: speech in 1k?
« Reply #4 on: September 14, 2006 »
Dont suppose you know how the speech data is made up, please dude?

Code: [Select]
; 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;
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline saida

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • saidas webpage
Re: speech in 1k?
« Reply #5 on: September 14, 2006 »
ofcourse :)
If you wanna say "CLYDE"
then simply type a zero between each char. like this:

Code: [Select]
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
« Last Edit: September 14, 2006 by saida »

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: speech in 1k?
« Reply #6 on: September 14, 2006 »
Dude this awesome, f*****g tiny   :o

I compiled a test version for C and FB users

Well done!

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: speech in 1k?
« Reply #7 on: September 14, 2006 »
Cool work dudes, is there a way to change the speakers voice settings?
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline saida

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • saidas webpage
Re: speech in 1k?
« Reply #8 on: September 15, 2006 »
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 :)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: speech in 1k?
« Reply #9 on: September 15, 2006 »
Hehe, I'm going to be starting work on a little 40kb soon, thanks to you Saida I'll probably have speech in it :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: speech in 1k?
« Reply #10 on: September 15, 2006 »
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.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: speech in 1k?
« Reply #11 on: September 15, 2006 »
That would be as cool as fuck.
Actually Thygrion did a demo with a head. It would be really neat if it had talked.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Re: speech in 1k?
« Reply #12 on: January 08, 2007 »
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.
The Dr. is INsane!!!

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: speech in 1k?
« Reply #13 on: January 08, 2007 »
That would be cool to see, er hear.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: speech in 1k?
« Reply #14 on: January 08, 2007 »
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
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: speech in 1k?
« Reply #15 on: January 08, 2007 »
Rbraz posted an archive above to do it in FB :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: speech in 1k?
« Reply #16 on: January 08, 2007 »
That'll save me mucking about then, thanks for spotting! :D

Jim
Challenge Trophies Won:

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Re: speech in 1k?
« Reply #17 on: January 08, 2007 »
Well, that one seems to have the text hard coded also. Unless I missed something.  :whack:
The Dr. is INsane!!!

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: speech in 1k?
« Reply #18 on: January 09, 2007 »
and doesn't compile in fb .17b

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: speech in 1k part2
« Reply #19 on: January 09, 2007 »
and doesn't compile in fb .17b
Did you have used compile.bat ? Btw I use the good old fbc 0.15 beta  :)

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
Challenge Trophies Won: