Simple TTS with Botpress
# 📖tutorials
f
This is a very simple TTS template to get you started. npm init -y npm install express openai cors dotenv Add "type": "module", to the package.json. It would look like this: "name": "voicetest", "version": "1.0.0", "description": "", "type": "module", "main": "index.js", Download the env file and rename it to .env Add your API key in the .env file. Start the server by typing node server.js in the terminal and then you can start using your index.html file.

https://youtu.be/SumGdkttifg

Watched the video, downloaded the files, and will give you feedback after some testing! 💯 This is a perfect example of how to integrate an important and requested feature into a Botpress chatbot CORRECTLY. After seeing this, I'm going to update all my TTS chatbots to use JSON Payload as well. Thank you very much, @fresh-fireman-491 ! 🦸‍♂️ 🛠️ 🫡 This is a good lesson for bot builders of all level to learn from and start building their own text-to-speech projects.
f
Thanks a lot for the kind words ❤️
s
I followed the tutorial and downloaded all of the files, but i am stuck on the package-lock.json and package.json portion of the tutorial.
f
Are you stuck on the npm install part? Or adding the type: module to it?
s
more so the npm install part
I am getting this error. Apologies if this is 101 for VSC... I'm quite new to this program.
f
Ahh yea okay I see. I forgot to add that you should have node.js installed. II am can check it with
node -v
You can download it from here https://nodejs.org/en Thanks a lot for pointing that out
s
of course! thanks so much for the quick response!
f
Any time and you wrote a message right as I was checking Botpress so your timing was pretty good.
s
💯
Hey, so also! my .env code is not in blue, i believe the program isn't translating/reading it correctly? Did i miss something else?
because now i am getting this error:
f
You have saved the file right? And are all of your files in the same folder?
Like this
s
f
Your env file should be named .env
s
omg, the dreaded period!
alrighty! i think i am set!
f
Perfect. Not sure why discord deletes the period but I have added it to the list of things to do. Thanks a lot for pointing these things out
s
you got it!
Okay, I am still having trouble, but I’ll try to ask more tomorrow. I’m not sure what might be happening now. I open the html and get to the correct prompt, but it doesn’t generate the audio. The error happens within the website at this point.
f
You could try and open the console on the website and see if there is an error but to be honest I don't remember if I added error handling
Are you running the server on your localhost
And have you opened the file so it says something like file///c:/
s
this is what i am looking at error wise.
f
Have you started the server up by typing node server.js
I do it at around 2:36 in this video

https://youtu.be/SumGdkttifg

s
yes i did that too
f
That is weird. Have you changed any part of the code? Can you check that all of your credentials are valid. This could also be because the path for the speech.mp3 file isn't in the expected location. Do you have a separate folder containing both the index.html file and the server.js file?
s
I have not, or at least not that I know of. How do I check credentials? And they are all in the same folder.
f
You can check the credentials in the .env file
Make sure its a correct API key
s
It is the only api key but I will double check it.
Should I try and make a second one?
f
Nono
You can test it like this
s
now i am getting this on the console
f
Import this bot to a completely new bot Go to the execute code card and replace sk- with your actual api key
Write any message in the chat and check the logs if you get a response
You should see this in your logs
I got a deadline on a presentation tonight so I will just quickly finish it and then I will come back to here. I will try and do everything in a complete new envirerment without anything installed to try and recreate this
If you could in the mean time write a little step by step walkthrough of what you have done up to now so I can try and recreate the error
s
Okay Tysm for all your help. If it doesn’t work after this I may abandon the idea for now. Because I am looking more for the bot to talk to the user with auto play. I was just trying to get this to work first.
f
To be honest I think what Devmik created here https://discord.com/channels/1108396290624213082/1199649804653965342 is a lot easier to follow and for you to recreate
This post was just kind of a step 1 towards my post about adding voice to your bot https://discord.com/channels/1108396290624213082/1197616810728632422
All you have to do then is just to get an API key from Eleven Labs which is free and then you can use it
You wont have to set up a server or anything
s
Okay I may go that route. What I am trying to do is also fairly multifaceted, so I will reach back out if any other questions. Tysm again!
f
Feel free to do that and it was a pleasure helping you!
j
hey decay what its TTS
f
Hey Theo TTS is text to speech. So we give a TTS model from OpenAI some text and it can add a voice to it.
h
Hi i can find the index.js on the files can you please share it here or where is shlod find it
@fresh-fireman-491
@User
f
Hey there, There is no index.js file.
All of the files are listed at the top of this thread
h
ok we are trying to do this video

https://www.youtube.com/watch?v=Djo3rPo518I&t=452s

its not the TTS
f
You can find all of the code in the associated thread https://discord.com/channels/1108396290624213082/1197616810728632422
Question mark doesn't trigger intent, no question mark triggers intent
f
Hey there @bland-sandwich-37784 Might not be the right place to talk about that
4 Views