Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
How to record audio from voice channel in discord.js voice v13?

I’m trying to record audio from a voice channel in discord using v13 of discord.js. Here is my code :

const { joinVoiceChannel } = require("@discordjs/voice");
const fs = require("fs");
var { streams } = require("streams.js");

var voiceChannel = interaction.member.voice.channel;
streams[voiceChannel.id] = fs.createWriteStream("test.pcm");


const connection = await joinVoiceChannel({
                channelId: voiceChannel.id,
                guildId: interaction.guild.id,
                adapterCreator: interaction.guild.voiceAdapterCreator,
                selfDeaf: false
            });
const audio = connection.receiver.subscribe(`${interaction.user.id}`, {encoding: "utf-8"});
audio.pipe(streams[voiceChannel.id]);

then the stop command :

…
streams[voiceChannel.id].close();
delete streams[voiceChannel.id];

And when I convert the pcm to wav using ffmpeg -f s16le -ar 44.1k -ac 2 -i test.pcm file.wav, it returns a short audio without my voice but the noise "ffffffffffff" Why ? Thank you for your help.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!