Comments (2)
I know I'm a bit late to reply, but I split the text into an array of chunks that are all strings of length <= 200, then .map this into an array of audio streams.
let audioStreams = chunks.map((chunk) => {
return discordTTS.getVoiceStream(chunk);
});
Once this is done, you can play them in order, switching to the next on audioPlayer status Idle
function playNextResource(){
if (audioStreams.length > 0) {return audioPlayer.play(createAudioResource(audioStreams.shift(), {inputType: StreamType.Arbitrary, inlineVolume:true}));}
connection = getVoiceConnection(gameInfo.guild.id);
connection.destroy();
}
audioPlayer.on(AudioPlayerStatus.Idle, playNextResource);
There is a slight delay sometimes, so it's not perfect. You can try to split on characters like .!?; to make the break sound more natural.
from discord-tts.
ohhh thank you!
from discord-tts.
Related Issues (17)
- Client leave the voice channel after tts is done. HOT 7
- FFmpeg/avconv not found! HOT 1
- dispatcher.on("finish") do not triggers HOT 4
- Possible to change TTS speed? HOT 1
- Dispatcher "finish" event not working. HOT 1
- Finish event gets thrown before anything is said HOT 2
- TTS Not playing any sound HOT 19
- Option to change voice gender and cooldown between words HOT 1
- is the package will run in discord.js v13 HOT 2
- TTS Gets cut off early HOT 3
- (node:21888) UnhandledPromiseRejectionWarning: TypeError: connection.play is not a function HOT 1
- the client.voice.createBroadcast() is not a function
- discordTTS doesn't work with single words
- Get error when the length of the string is more than 200 HOT 1
- Get key failed from google HOT 8
- Unhandled promise rejection: Error: get token key failed from google HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-tts.