@orbynnew/voice
@orbynnew/voice — Public Beta 0.1.88-beta.2
npm install @orbynnew/voice@beta
Camada oficial de voz do orbynnew sobre LiveKit.
A v0.1.58 mantém a descoberta automática do FFmpeg e corrige o caminho LiveKit de reprodução: a track é publicada, o adapter aguarda um assinante (waitForSubscription()), e só então começa a enviar PCM. O estado Playing só é emitido após o primeiro frame.
const voice = require('@orbynnew/voice');
console.log(voice.generateDependencyReport());
Ordem de resolução do FFmpeg: ffmpegPath → ORBYNNEW_FFMPEG_PATH → FFMPEG_PATH → ffmpeg-static → PATH.
No Debian 13/WSL:
sudo ./INSTALAR_MEDIA_DEBIAN13.sh
AudioResource também aceita httpHeaders, usados pelo @orbynnew/music quando o resolver de mídia fornece headers necessários para a fonte remota.
VoiceConnection continua oferecendo reconexão, mudança de canal, heartbeat e agora acompanha mudanças de VoiceState publicadas pelo servidor.
Base herdada da v0.1.50
Camada oficial de voz para bots orbynnew sobre LiveKit.
A v0.1.50 mantém o pipeline real FFmpeg -> PCM s16le 48 kHz estéreo -> LiveKit e adiciona recuperação automática de transporte.
const {
joinVoiceChannel,
createAudioPlayer,
createAudioResource,
entersState,
VoiceConnectionStatus
} = require('@orbynnew/voice');
const connection = joinVoiceChannel({
guildId: guild.id, // Snowflake público
channelId: voice.id, // Snowflake público
adapterCreator: guild.voiceAdapterCreator,
rejoinAttempts: 5,
rejoinDelay: 1000
});
connection.on('reconnecting', ({ attempt }) => console.log('tentativa', attempt));
connection.on('reconnected', () => console.log('recuperado'));
await entersState(connection, VoiceConnectionStatus.Ready, 20_000);
const player = createAudioPlayer();
connection.subscribe(player);
const resource = createAudioResource('./musica.mp3', { inlineVolume: true });
resource.volume.setVolume(0.8);
player.play(resource);
player.on('progress', ms => console.log('posição', ms));
Estados incluem Signalling, Connecting, Ready, Reconnecting, Disconnected e Destroyed.
AudioResource.playbackDuration e playbackDurationMs acompanham a reprodução. O adapter só confirma o VoiceState conectado depois que o RTC estiver realmente Ready.
Requer @livekit/rtc-node e ffmpeg no PATH. FFMPEG_PATH pode apontar para outro executável.