• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Chatgpt+google STT + elevenlabs api

Scheduled Pinned Locked Moved Showcase
8 Posts 4 Posters 3.4k Views 7 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    sdmydbr9
    last edited by Mar 8, 2023, 7:33 PM

    Added voice to the chatgpt model and made an interactive chatbot with voice input and voice output using google stt for transcription and eleven labs api for tts.
    This is not final yet and I’m hoping someone will polish this, this is just a proof and concept and will post the complete code once it’s better. Here is the link to the video chatgpt

    Todo: 1. Add Hotword detection. Right now depends on notification from the iOS shortcuts.
    2. Add offline STT, google stt though more accurate takes up more time.
    3. Optimisation of the process. Right now it takes time to complete a request

    R V 2 Replies Last reply Mar 11, 2023, 6:49 AM Reply Quote 2
    • R Offline
      Rags @sdmydbr9
      last edited by Mar 11, 2023, 6:49 AM

      @sdmydbr9
      Hey Sudhamoy, Its fantastic man. Congratulations.
      Do you realise what you have achieved. Great going. Waiting for the finished module.

      S 1 Reply Last reply Mar 12, 2023, 11:20 AM Reply Quote 0
      • V Offline
        vijayrraut @sdmydbr9
        last edited by Mar 12, 2023, 4:02 AM

        @sdmydbr9 It’s amazing, last week I also tried using ChatGPT on Pi zero with wakeword and voice, to use like a smart speaker, also made it interactive using google stt.
        Y’day tried to made it multilingual using google translate API. I will put this video soon.
        https://youtu.be/b73XRWOFdz4

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdmydbr9 @Rags
          last edited by Mar 12, 2023, 11:20 AM

          @Rags here is the detailed instructions of how I did it, it’s not polished but I tried by best to be thorough

          repo here

          S 1 Reply Last reply Mar 16, 2023, 4:13 PM Reply Quote 0
          • S Offline
            soldatino @sdmydbr9
            last edited by Mar 16, 2023, 4:13 PM

            @sdmydbr9 Wooooow…that looks super interesting

            I was able to install and setup everything…almost everything…I just have a problem with the microphone.
            I can use the terminal:
            To record
            arecord --format=S16_LE --rate=16000 --file-type=wav /home/xxx/Desktop/out.wav

            To Play
            aplay /home/xxx/Desktop/out.wav

            …all without problems.

            But in MagicMirror, after I invoke the iOS shortcut, the GIF comes up saying “say something” but it’s not responding.

            Which microphone are you using? Or what do I have to consider?

            Thank you for your valuable feedback.

            Best, Marco

            S 1 Reply Last reply Mar 17, 2023, 5:16 AM Reply Quote 0
            • S Offline
              sdmydbr9 @soldatino
              last edited by Mar 17, 2023, 5:16 AM

              @soldatino hi could you try this, go to MMM-Chat directory, there is a file called transcript.py, around line 34-36 you will find these

              # start recording
              frames = sd.rec(int(RATE * RECORD_SECONDS), samplerate=RATE, channels=CHANNELS, blocking=True)
              
              

              Change it into

              
              # start recording
              print("say something...")
              frames = sd.rec(int(RATE * RECORD_SECONDS), samplerate=RATE, channels=CHANNELS, blocking=True)
              
              
              

              Console log is added to say something, now go to the end of the line and comment out the following line

              
              # delete saved audio file
              os.remove(WAVE_OUTPUT_FILENAME)
              
              

              It should look like this now

              
              # delete saved audio file
              #os.remove(WAVE_OUTPUT_FILENAME)
              
              

              And now run the script in the following way

              Python3 transcript.py
              

              It will print on the console “say something ……” try speaking on the mic and wait for it to complete, if everything goes well it will print the transcript on the console. If it does not print it in the console, you will get a wav file in the directory, try playing it and see if the audio is audible. If the audio is not clear you might have to change the rate according to which rate gives the best audio. Let me know if you have any more questions.

              S 1 Reply Last reply Mar 17, 2023, 2:05 PM Reply Quote 0
              • S Offline
                soldatino @sdmydbr9
                last edited by Mar 17, 2023, 2:05 PM

                @sdmydbr9 thank you very much for your answer. With this test I can confirm that my microphone works.
                But unfortunately it doesn’t react as expected.

                Here are the logs:

                When I start MagicMirror I get the following error message:

                ERROR! Could not find main module js file for MMM-11-TTS
                

                And as soon as I run the shortcut, the GIF is displayed and nothing happens for 2 minutes.

                [17.03.2023 14:44.26.411] [LOG]   say something
                [17.03.2023 14:46.20.385] [LOG]   child process exited with code 0
                [17.03.2023 14:46.20.394] [LOG]   Transcript extracted: say something...
                [17.03.2023 14:46.20.401] [LOG]   Sent TRANSCRIPT_EXTRACTED notification
                [17.03.2023 14:46.20.405] [LOG]   Sent OPENAI_REQUEST notification
                

                Maybe it matters that my MagicMirror directory is /home/soldatino/MagicMirror/…and not /home/pi/MagicMirror/.
                But I changed my path in this file:

                /home/soldatino/MagicMirror/modules/MMM-Chat/transcript.py
                

                And in the config:

                			module: 'MMM-NotificationTrigger',
                			config: {
                                             .....
                			 exec: (payload) => `python3 /home/soldatino/MagicMirror/modules/MMM-11-TTS/main.py "${payload.message}"`
                

                Did I miss something?

                Thank you.
                Best, Marco

                S 1 Reply Last reply Mar 17, 2023, 4:16 PM Reply Quote 0
                • S Offline
                  sdmydbr9 @soldatino
                  last edited by sdmydbr9 Mar 17, 2023, 4:18 PM Mar 17, 2023, 4:16 PM

                  @soldatino okay, I think it’s because you are using a different username it’s breaking. I will try to add the config options to set the files path in the coming days, for now just check you nodehelper of MMM-Chat.js line 21 and let me know if that helps. You will have to set it to your correct absolute path. Cheers.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    4/8
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy