Skip to content

Instantly share code, notes, and snippets.

@jameswritescode
Last active September 7, 2016 16:37
Show Gist options
  • Select an option

  • Save jameswritescode/3d906f21679abeac5e8207f9e982a79d to your computer and use it in GitHub Desktop.

Select an option

Save jameswritescode/3d906f21679abeac5e8207f9e982a79d to your computer and use it in GitHub Desktop.
rust voice stuff
Doctors - 08/20/2016
Is there any way I record voice using voice_packet from discord::voice::AudioReceiver?(edited)
SpaceManịac - 08/20/2016
@Doctors It's possible, yes - data is just audio in PCM form like you'd find in a .wav file
Doctors - 08/20/2016
So I should be able to send data to a file (like a .wav)? Any suggestions as to how I would do so?
SpaceManịac - 08/20/2016
The hound crate can be used for writing .wav files
Nick - 08/20/2016
Yeah, wav will be the easiest, for any other format you'll have to use something like ffmpeg to convert the the input (and dear god, don't try to write c bindings for it, it's a terrible API)
Wav is just pcm data with a header before it
Nick - 08/20/2016
If you really need another format and you have to use ffmpeg, you'll have to subprocess it and pass data through stout, if that's even possible for s16le pcm (the name of the sample format you'll get from this lib)
Doctors - 08/20/2016
Alright thanks! .wav should be fine.
I should always be recieving Stereo correct? and if so then I should have the specs for the .wav file to two channels rather than?
SpaceManịac - 08/20/2016
Most of the time you will not be receiving stereo
Doctors - 08/20/2016
nods
Should I put code in to check for it? or should I not even bother?
SpaceManịac - 08/20/2016
It depends on your needs
I've only ever seen music bots use stereo
Doctors - 08/20/2016
If the regular client doesn't output stero then I guess I have no need for it.(edited)
Doctors - 08/20/2016
I'm currently stuck on
the trait bound `&[i16]: hound::Sample` is not satisfied
, any ideas?
SpaceManịac - 08/20/2016
you'll have to loop over the slice manually
August 21, 2016
VoltBotBOT - 08/21/2016
SpaceManiac/discord-rs
057e3a4 Add LiveServer::permissions_for method [Tad Hardesty]
SpaceManịac - 08/21/2016
@sans this one is for you
SpaceManịac - 08/21/2016
Anyone who was getting warnings from the url crate, cargo update should fix them
Doctors - 08/21/2016
How would I loop over the slice?
acdenisSK ꙩ ⃤ - 08/21/2016
with a for in loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment