Make your computer talk in Racket on Windows in 5 lines

29 views
Skip to first unread message

Sam Phillips

unread,
May 16, 2020, 2:15:00 PM5/16/20
to Racket Users
Stephen De Gabrielle and I are wondering if any Mac or Linux users
have similar short programs to make their computer talk.

https://www.reddit.com/r/Racket/comments/gkz3yi/make_your_computer_talk_in_racket_on_windows_in_5/

Cheers,
Sam

----->8----->8-----
#lang racket/base

(require ffi/com)

(define voice
(com-create-instance "SAPI.SPVoice"))

(com-invoke voice "Speak" "hello world")
----->8----->8-----

Sorawee Porncharoenwase

unread,
May 16, 2020, 2:21:28 PM5/16/20
to Sam Phillips, Racket Users

On Mac, there’s a say command, so this would do it.

(system "say \"hello world\"")

When I had a Linux machine, I recalled using a command named espeak, which is similar to say on Mac.


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAHsjV0zG4mFbryy4uYWHS-%3DvP%3D10_bCjFxBR5wS%2BUkaFuLkx5Q%40mail.gmail.com.

Ryan Culpepper

unread,
May 16, 2020, 2:47:37 PM5/16/20
to Sorawee Porncharoenwase, Sam Phillips, Racket Users
I wrote a little flashcard program in Racket to help myself learn Czech vocabulary (here: https://github.com/rmculpepper/racket-jazyk), and when run on a Mac it uses `say` for audio. IIRC, I had to install extra "voice" packages for Czech, but that consisted of clicking a few buttons in Settings.

Ryan

Reply all
Reply to author
Forward
0 new messages