Giter Site home page Giter Site logo

discord-tts's People

Contributors

brettz9 avatar danloe avatar dependabot[bot] avatar gmkonan avatar hashfarm avatar mundoex avatar oneyellowlemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

discord-tts's Issues

Get error when the length of the string is more than 200

Well, when I input a message and is more than 200, this gets error
(node:48320) UnhandledPromiseRejectionWarning: RangeError: text length (361) should be less than 200 characters

I know that this error is for the google-tts api, but, could be a way that can I fix it?

dispatcher.on("finish") do not triggers

I have seen problem like this in issue before, but now 'end' event is not supported by current version of discord.js. Yet 'finish' event, do not triggers at the end of the stream. What can i do to fix it or how can I run smth after the broadcast ends.

const broadcast = client.voice.createBroadcast();
    const channelId = message.member.voice.channelID;
    const channel = client.channels.cache.get(channelId);
    channel?.join().then(async (connection) => {
        const stream = discordTTS.getVoiceStream(string, 'ru-RU')
        broadcast.play(stream);
        const dispatcher = await connection.play(broadcast)
        dispatcher.on('finish', () => console.log('That is the end'))
    })

Play long messages?

I saw that the library is currently limited to 200 chars
How do I play messages which are greater tha 200 chars(reaching all the way up to 5000 chars)

The error currently shows to use getAllAudioBase64(text,[option])
But that function is apparently not implemented?

The "listener" argument must be of type function. Received undefined

Hello Guys, I'm trying to do something simple, I just wanna play a "long" audio, so I'm spliting the text in an array. But I'm facing this issue, I dunno why.

I can hear the first "test 1", but not the others.

It's just a simple test, as you can see:

const { SlashCommandBuilder } = require('discord.js');
const discordTTS = require('discord-tts');
const { AudioPlayer, AudioPlayerStatus, createAudioResource, StreamType, entersState, VoiceConnectionStatus, joinVoiceChannel, getVoiceConnection } = require('@discordjs/voice');


let voiceConnection;
const audioPlayer = new AudioPlayer();

const texts = ['test 1', 'test 2', 'test 3', 'test 4'];


module.exports = {
    data: new SlashCommandBuilder()
        .setName('tts2')
        .setDescription('Responde com o Chat GPT apartir da voz.'),
    async execute(interaction) {
        await interaction.deferReply();


        const voiceChannel = interaction.member?.voice.channel;

        const audioStreams = texts.map((text) => {
            return discordTTS.getVoiceStream(text);
        });


        function playNextResource() {
            if (audioStreams.length > 0) {
                voiceConnection.subscribe(audioPlayer);
                const audioResource = createAudioResource(audioStreams.shift(), { inputType: StreamType.Arbitrary, inlineVolume: true });
                return audioPlayer.play(audioResource);
            }
            const connection = getVoiceConnection(voiceChannel.guild.id);
            connection.destroy();

        }
        if (!voiceConnection || voiceConnection?.status === VoiceConnectionStatus.Disconnected) {
            voiceConnection = joinVoiceChannel({
                channelId: voiceChannel.id,
                guildId: voiceChannel.guild.id,
                adapterCreator: voiceChannel.guild.voiceAdapterCreator,
            });
            voiceConnection = await entersState(voiceConnection, VoiceConnectionStatus.Connecting, 5_000);
        }

        audioPlayer.on(AudioPlayerStatus.Idle, playNextResource());
    },
};

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
at checkListener (node:events:274:3)
at _addListener (node:events:547:3)
at AudioPlayer.addListener (node:events:606:10)
at Object.execute (C:\Users*\commands\utility\tts.js:73:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:*
\events\interactionCreate.js:16:13) {
code: 'ERR_INVALID_ARG_TYPE'
}

Finish event gets thrown before anything is said

When using getVoiceStream no TTS is said and then the bot leaves on the finish event from the dispatcher.

async function speakHello(connection,wasConnected, voiceChannel, text){
    const dispatcher = connection.play(discordTTS.getVoiceStream(text, "de-DE"))
    dispatcher.setVolumeDecibels(10)
    dispatcher.on("finish", () => {
        if (!wasConnected) {
            voiceChannel.leave()
        }
    })
        .on("error", err => console.error(err));
}

TTS Gets cut off early

Using this code to play via discord tts:

startPlaying(discordTTS.getVoiceStream(`Now playing: ${yt_info[0].title}`), player)
function startPlaying(url, player, type) {
	const resource = createAudioResource(url, {
		inputType: type ?? StreamType.Arbitrary,
	});

	player.play(resource);
}

And it works, but the audio gets cut off before it is done saying what I inputted. This does not happen with regular audio. Any ideas? Using nodejs v16.10, discordjs v13, latest version of discord-tts

It always gets cutoff at ~5s to the end, and its not the variable because the same thing happens when I put plaintext in.

TTS Not playing any sound

I'm using it on a Discord bot since last month and it was working just fine but since yesterday the tts module doesn't play any sound.

FFmpeg/avconv not found!

I have installed all the packages, and when executing the command it gives this error:
FFmpeg/avconv not found!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.