thanhsonng / chatgpt-voice

Have a conversation with ChatGPT. Casually 🔈 🤖 ⚡️
https://chatgpt.sonng.dev
164 stars 38 forks source link

Nice Job! #1

Closed OliverRovesik closed 1 year ago

OliverRovesik commented 1 year ago

Great work! Really appreciate your work. After using it, I find that the voice is not natural (a little fast). Is it possible to change the speed of voice? Apart from that, is there a way to use local voice engine in MacOS?

thanhsonng commented 1 year ago

Hi @OliverRovesik, thank you for your feedback. Since my initial focus was ChatGPT api, in the meantime I only provided the basic voice. Voice configuration is in the roadmap and I will support that feature provided that I have the time 🤞

OliverRovesik commented 1 year ago

Thank you. I've been working on this with the help of Chatpt. I modified the App,tsx file and package.json. For App.tsx, what I have modified is " const speak = useCallback((text: string) => { const utterance = new SpeechSynthesisUtterance(text); const voices = window.speechSynthesis.getVoices(); const desiredVoice = voices.find((voice) => voice.name === 'Zoe(Premium)'); if (!desiredVoice) return; utterance.voice = desiredVoice; utterance.pitch = 0.8; utterance.rate = 1.0; window.speechSynthesis.speak(utterance); }, []);"

For package.json, this is what I have modified: "scripts": { "dev": "vite", "start": "vite && open http://localhost:5173/", "build": "tsc && vite build", "preview": "vite preview" },

However, after I ran this project, it doesn't pop up a Chrome window as the original does. This is as far as I can go. I know nothing about programming, and all I have ever followed is the tips from Chatgpt. I hope these modifications could help with your further work.

thanhsonng commented 1 year ago

Thanks for the hint. To run this frontend locally, you need to:

  1. Install the dependencies by running npm install
  2. Start the dev server by running npm run dev
  3. Open your browser and enter the URL http://localhost:5173/.

Hope that helps. I will take a closer look at the voice API and your suggestion.

thanhsonng commented 1 year ago

@OliverRovesik I added voice settings in the latest version. Under the hood, this app uses JavaScript's SpeechSynthesis API, which utilizes the voice engine of the underlying OS, so if you are running this app on a Mac, it is already using the macOS voice engine.

To verify, you can search for "voice" inside the Preference app. In the System voice list, the options should be very similar (though not exactly identical) to what you see on the web app. This is what I found on my machine:

Screenshot 2023-01-16 at 1 16 44 a m
OliverRovesik commented 1 year ago

Fantastic! I just tried. It works perfectly. It can help me improve my English-speaking skills now. Really appreciate your work!

thanhsonng commented 1 year ago

Glad you like it 😃 I will close this issue