See the top rated post in this thread. Click here

Page 7 of 8 FirstFirst ... 345678 LastLast
Results 61 to 70 of 74

Thread: AutoCAD Speak

  1. #61
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Thanks Renderman for the response.
    You seemed to be well versed in the stuff.
    Could you express how to use Microsoft Mike in autolisp?

  2. #62
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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))
    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))
    ** Note - Give vlax-dump-object a try to see additional properties.

    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

  3. #63
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    Still trying to figure it.
    Thanks for all your work.

  4. #64
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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

  5. #65
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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

  6. #66
    Login to Give a bone
    0

    Lightbulb Re: AutoCAD Speak

    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.

  7. #67
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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.

  8. #68
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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.

  9. #69
    Active Member dotson's Avatar
    Join Date
    2005-01
    Posts
    56
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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.

  10. #70
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

    Default Re: AutoCAD Speak

    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
    Attached Files Attached Files

Page 7 of 8 FirstFirst ... 345678 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2015-08-07, 04:03 PM
  2. Speak 4 cad
    By maa in forum Software
    Replies: 9
    Last Post: 2006-06-30, 12:13 PM
  3. speak to autocad
    By jaberwok in forum Software
    Replies: 9
    Last Post: 2005-11-09, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •