Thanks Renderman for the response.
You seemed to be well versed in the stuff.
Could you express how to use Microsoft Mike in autolisp?
|
Thanks Renderman for the response.
You seemed to be well versed in the stuff.
Could you express how to use Microsoft Mike in autolisp?
Here are some freebie Sapi.SpVoice LISP functions:
Code:(defun sapi-get-ActiveVoice (oSapi / activeVoice) ;; © RenderMan 2011 ;; Example: (sapi-get-ActiveVoice oSapi) (if (and oSapi (setq activeVoice (vlax-invoke (vlax-get oSapi 'voice) 'getdescription))) activeVoice nil))Code:(defun sapi-get-voices (oSapi / sapiVoices) ;; © RenderMan 2011 ;; Example: (sapi-get-voices oSapi) (if oSapi (progn (vlax-for x (vlax-invoke oSapi 'getvoices) (setq sapiVoices (cons (vlax-invoke x 'getdescription) sapiVoices))) (vl-sort sapiVoices '<)) nil))Code:(defun sapi-get-volume (oSapi) ;; © RenderMan 2011 ;; Example: (sapi-get-volume oSapi) (if oSapi (vlax-get oSapi 'volume) nil))Code:(defun sapi-put-volume (oSapi n) ;; © RenderMan 2011 ;; Example: (sapi-put-volume oSapi 50) (if (and oSapi (<= n 100) (>= n 0)) (progn (vlax-put oSapi 'volume n) n) nil))** Note - Give vlax-dump-object a try to see additional properties.Code:(defun sapi-speak-if (oSapi voice string) ;; © RenderMan 2011 ;; Example: (sapi-speak-if oSapi "anna" "Yeah, this just happened.") (if (and oSapi (vl-string-search (strcase voice) (strcase (vlax-invoke (vlax-get oSapi 'voice) 'getdescription)))) (progn (vlax-invoke oSapi 'speak string 0) T) nil))
Edit - (vl-load-com) removed, as this is necessary to get-or-create the Sapi.SpVoice Object argument.
Last edited by RenderMan; 2011-12-23 at 04:34 PM.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
FWIW - I wasn't ignoring your question for how to 'speak' through the Mike voice.
I actually only have one voice installed, Anna, and haven't had an opportunity to properly test the sapi-put-ActiveVoice function that I've started. Hence the sapi-speak-if function that I posted above; perhaps you can share with me your success with that (or the lack thereof)?
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
If I am unsuccessful at manipulating the Sapi.SpVoice.Voice Token with only LISP, then another option is to code a .NET LispFunction Method that can perform this task.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Sometimes you will find an interesting article on the internet that you want to read about, but you’re too busy working in AutoCAD to stop and read it. With the following little program, you can just copy the text from the website into a text file and run the program ReadIt. You might want to put on your headphones and get off the internet, so your boss doesn’t think you’re just playing around. You can customize the ReadIt.txt filename and folder location as preferred, and create a desktop shortcut to the file for easy access to edit.
This is another variation of the SayIt.lsp functions in this thread AutoCAD Speak.
Code:;------------------------------------------------------------------------------- ; c:ReadIt - Read text file with Sapi.SpVoice ;------------------------------------------------------------------------------- (defun c:ReadIt (/ FileName% Phrase$ Sapi) (if (findfile "C:\\Temp\\ReadIt.txt") (progn (setq Sapi (vlax-create-object "Sapi.SpVoice")) (setq FileName% (open "C:\\Temp\\ReadIt.txt" "r")) (while (setq Phrase$ (read-line FileName%)) (vlax-invoke Sapi "Speak" Phrase$ 0) );while (close FileName%) (vlax-release-object Sapi) );progn (princ "\nC:\\Temp\\ReadIt.txt file not found.") );if (princ) );defun c:ReadIt
Last edited by Terry Cadd; 2020-12-05 at 09:22 AM.
Was playing with Sapi to day its great fun to spook co workers by adding some sapi into the start up routines. No one really had any idea how to do it.
"Good morning this is your computer speaking lets get on with it"
Talking to yourself again ! No your dictating to Word its built in these days just look for it. Little microphone + Dictate.
Of course speech recognition and Autocad is fun if you work alone then swearing can be added say as UNDO.
I shared SayIt.lsp and the other programs here with my friends at work, and it’s fun to hear the funniest things come out of a friend’s computer speakers. It’s like a robot with a sense of humor. And it makes the day go faster.
Last edited by Terry Cadd; 2020-12-07 at 07:29 PM.
Discovered this quite a while back. One practical application of this is to have it speak text that is too small to read, removing the need to zoom in/out. Another is to have a maps legal description read aloud while reviewing the source content to minimize the tennis match look back and forth.
ok, pick it
Code:(defun c:SayIt2 () (setq nent (car (nentsel "Pick words to say: "))) (setq nentl (entget nent)) (setq nentv (cdr (assoc 1 nentl))) (setq Phrase$ nentv) ; (setq Phrase$ (getstring T "Enter string: ")) (setq Phrase$l (strlen Phrase$)) (if (> Phrase$l 1000) (setq Phrase$ (substr Phrase$ 1 1000))) (vl-load-com) (setq sapi (vlax-create-object "Sapi.SpVoice")) (vlax-invoke sapi "Speak" Phrase$ 0) (vlax-release-object sapi) (princ) );defun c:SayIt2