#Converting Opus to PCM

3 messages · Page 1 of 1 (latest)

chilly grail
#

so i know in previously you can do

const voiceReceiver = connection.receiver.createStream(member.user, {mode: 'pcm', end: 'manual'});

is there a new way to select the mode so this is the code now:

const voiceReceiver = connection.receiver.subscribe(interaction.member.id, {mode: 'pcm', end: 'manual'});

however, mode in the config no longer exists, how should i be converting opus to pcm?

glossy pelicanBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

chilly grail
#

I'm currently trying to use FFmpeg. this is my code:

        const voiceReceiver = connection.receiver.subscribe(interaction.member.id, {end: 'manual', mode: 'pcm'});
        const convert = new ffmpeg().input(voiceReceiver)
            .inputOptions(['-ac 2', '-ar 48000']).outputOptions(['-ac 1', '-ar 16000'])
            .outputFormat('s16le').pipe({end: false});

        convert.on('data', (data) => {
            console.log(data);
        });

but i think i'm doing something wrong as no data is being logged from voice