Skip to main content
F3D
Nút bấm FYSETC cho Magic 8 Ball TTS 1

8 images

Máy In 3D

Nút bấm FYSETC cho Magic 8 Ball TTS

By YourBuddyDinec

Downloads
17
Likes
5
Views
268

Files 5 285.7 KB

  • Magic_8_Ball_Single_Color_1766419854.stlSTL · 87.7 KB
  • Magic_8_Ball_-_Question_Mark_Single_Color_1766419854.stlSTL · 87.7 KB
  • Magic_8_Ball_Multicolor_1766419855.3mf3MF · 61.9 KB
  • Magic_8_Ball_-_Question_Mark_Multicolor_1766419856.3mf3MF · 48.2 KB

Make a variant with AI

Build another version of this model.

Open Studio

Description

A button for you to push (or call from a START_PRINT macro that plays a text to speech Magic 8 Ball. Included both single and multicolor models in case you're lucky enough to have a FYSETC ERCF kit.

To get the macro to work you need the following:

GCode Shell Commands - Installable through Kiauh
Espeak - sudo apt install espeak
Aplay - sudo apt install aplay
A set of speakers - Cheap ones do fine. Connected to your printer through the Computer running klipper or a usb hub with a headphone jack out. (If needed I can make a separate macro for a USB hub audio out since it needs a command added)
tts_espeak.sh - included in files. Unzip and place in ~/printer_data/scripts/

The script allows you at edit the voice (m/f) and type (1-5) along with a voice speed so you can customize your voice.

Use this code to check the TTS settings you are using
[gcode_macro TTS_SETTINGS]
###########You can edit the TTS settings below here###########
variable_tts_voice_type: 'f' # options are f and m
variable_tts_voice_number: 5 # choices are 1-5
variable_tts_voice_speed: 150 # epeak default is 100
###########You can edit the TTS settings above here###########
gcode:
   M118 Your TTS Voice Type is {printer["gcode_macro TTS_SETTINGS"].tts_voice_type} and the number is {printer["gcode_macro TTS_SETTINGS"].tts_voice_number}/5
   M118 And will be played at {printer["gcode_macro TTS_SETTINGS"].tts_voice_speed}% speed.

The actual TTS Command. You can also do TTS MSG=<message> and it will talk.
[gcode_macro TTS]
gcode:
   {% set TTS_MSG    = params.MSG|default('BOOP') %}
   {% set TTS_GENDER = printer["gcode_macro TTS_SETTINGS"].tts_voice_type %}
   {% set TTS_NUMBER = printer["gcode_macro TTS_SETTINGS"].tts_voice_number %}
   {% set TTS_SPEED  = printer["gcode_macro TTS_SETTINGS"].tts_voice_speed %}

   RUN_SHELL_COMMAND CMD=TTS_SHELL PARAMS='{TTS_GENDER} {TTS_NUMBER} {TTS_SPEED} "{TTS_MSG}"'

And heres the Magic 8 Ball Command
[gcode_macro MAGIC_EIGHT_BALL]
gcode:
 {% set num_songs = params.numsongs|default(20)|int %}
 {% set random_int = (range(1, num_songs+1) | random) %}
 ########## Good Responses ##########
 {% if random_int|int == 1 %} #1
     {% set m8b_msg = "It is certain" %}
 {% elif random_int|int == 2 %} #2
     {% set m8b_msg = "It is decidedly so" %}
 {% elif random_int|int == 3 %} #3
     {% set m8b_msg = "Without a doubt" %}
 {% elif random_int|int == 4 %} #4
     {% set m8b_msg = "Yes definitely" %}
 {% elif random_int|int == 5 %} #5
     {% set m8b_msg = "You may rely on it" %}
 {% elif random_int|int == 6 %} #6
     {% set m8b_msg = "As I see it, yes" %}
 {% elif random_int|int == 7 %} #7
     {% set m8b_msg = "Most likely" %}
 {% elif random_int|int == 8 %} #8
     {% set m8b_msg = "Outlook good" %}
 {% elif random_int|int == 9 %} #9
     {% set m8b_msg = "Yes" %}
 {% elif random_int|int == 10 %} #10
     {% set m8b_msg = "Signs point to yes" %}
 ########## Neutral Responses ##########
 {% elif random_int|int == 11 %} #11
     {% set m8b_msg = "Reply hazy, try again" %}
 {% elif random_int|int == 12 %} #12
     {% set m8b_msg = "Ask again later" %}
 {% elif random_int|int == 13 %} #13
     {% set m8b_msg = "Better not tell you now" %}
 {% elif random_int|int == 14 %} #14
     {% set m8b_msg = "Cannot predict now" %}
 {% elif random_int|int == 15 %} #15
     {% set m8b_msg = "Concentrate and ask again" %}
 ########## Negative Responses ##########
 {% elif random_int|int == 16 %} #16
     {% set m8b_msg = "Don’t count on it" %}
 {% elif random_int|int == 17 %} #17
     {% set m8b_msg = "My reply is no" %}
 {% elif random_int|int == 18 %} #18
     {% set m8b_msg = "My sources say no" %}
 {% elif random_int|int == 19 %} #19
     {% set m8b_msg = "Outlook not so good" %}
 {% elif random_int|int == 20 %} #20
     {% set m8b_msg = "Very doubtful" %}  
 {% endif %}

 M118 The Magic 8 Ball says...
 TTS MSG="The Magic 8 Ball says..."
 M118 ...{m8b_msg}!
 TTS MSG="{m8b_msg}"

Read more Show less

Print spec

Formats
3mfstlzip
Model files
5
Total size
285.7 KB
Largest file
87.7 KB

0 comments

See all