0.6.0
Voice Receive
v0.6.0 makes voice receive useable with many utility additions. You can see a run-down below, or view the full recorder example.
Audio receive streams automatically close when their attached voice connection is destroyed.
// Join with selfDeaf set to false to receive audio
const voiceConnection = joinChannel({ ...options, selfDeaf: false });
voiceConnection.receiver.speaking.on('start', userId => console.log(`User ${userId} started speaking`));
voiceConnection.receiver.speaking.on('end', userId => console.log(`User ${userId} stopped speaking`));
// A Readable object mode stream of Opus packets
// Will only end when the voice connection is destroyed
voiceConnection.receiver.subscribe(userId);
// A Readable object mode stream of Opus packets
// Will end when the voice connection is destroyed, or the user has not said anything for 100ms
const opusStream = voiceConnection.receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 100,
},
});
// -------------------------
// You can re-use the Opus stream, e.g. to play in another channel as an echo
const resource = createAudioResource(opusStream, { inputType: StreamType.Opus });
// You can decode the Opus stream to raw audio using prism-media
const rawAudio = opusStream.pipe(new prism.opus.Decoder({ frameSize: 960, channels: 2, rate: 48000 }));
// You can save the stream to an Ogg file using prism-media@2.0.0-alpha.0
const oggWriter = new opus.OggLogicalBitstream({
opusHead: new opus.OpusHead({
channelCount: 2,
sampleRate: 48000,
}),
pageSizeControl: {
maxPackets: 10,
},
});
pipeline(opusStream, oggWriter, createWriteStream('./myfile.ogg'), callback);
Commit log
-
chore: update conventional commit URL (#167)
-
test(DataStore): add missing tests (#165)
-
tests(DataStore): add missing tests
-
test(DataStore): add function spys for frame prep
-
-
refactor(AudioPlayer): use this.once instead of events.once (#162)
-
feat(Util): support AbortSignal in entersState (#171)
-
refactor(Util): use AbortSignal in entersState
-
chore(CI): drop Node v14 from CI
-
refactor(Util): remove unnecessary function
-
test(Util): add tests for abortAfter
-
test(Util): add test for entersState
-
-
refactor(Examples): remove unused imported binding (#172)
-
feat(VoiceReceive)!: improve usability (#136)
-
refactor(VoiceReceiver): begin refactor
-
feat(SSRCMap): resolve function
-
feat(VoiceConnection): close all streams in non-ready state
-
refactor(VoiceReceiver): map by user ID
-
feat(VoiceReceiver): allow specifying end type for streams
-
feat(VoiceReceiver): add SpeakingMap
-
refactor(SSRCMap): remove unused resolve method
-
test(VoiceReceiver): add test for SpeakingMap
-
test(VoiceReceiver): add tests for AudioReceiveStream
-
test(AudioReceiver): strengthen AudioReceiveStream tests
-
test(VoiceReceiver): remove inapplicable tests
-
test(VoiceConnection): fix test errors
-
test(VoiceConnection): test receiver bindings tracking
-
test(VoiceReceiver): decrypt
-
chore: remove unused code
-
fix(AudioReceiveStream): close normally
-
feat(Examples): update receiver example
-
feat(Examples): create recorder example
-
docs(VoiceReceiver): add docs for receive classes
-
refactor: suggestions from code review
Co-authored-by: Antonio Román kyradiscord@gmail.com
Co-authored-by: Antonio Román kyradiscord@gmail.com
-
-
chore(Release): v0.6.0