nextcord.ext.voicerecording
¶
New in version 2.0.0.
Helps you recording voice to files with specified Encodings
API Reference¶
FileSink¶
- defcleanup
- defdestroy
- defformat_audio
- defget_files
- class nextcord.ext.voicerecording.FileSink(*, encoding=<nextcord.ext.voicerecording.encoder.Encoder object>, filters=..., tempfolder=...)¶
A Sink “stores” all the audio data into a file.
New in version 2.0.
- Parameters
encoding (
Encodings
) – The encoding to use. Valid types include wav, mp3, and pcm (even though it’s not an actual encoding).filters – The filters to apply. Should be a dict. Currently supported are time, users and max_size. Time takes an integer as amount of seconds after listening shall stop, users should be a list of user ids to ignore (ints) and max_size is a limit for the max file of the pcms (bytes amounts as int). Please note that converting to other formats might change the file size a bit
- Raises
ClientException – An invalid encoding type was specified.
- cleanup()¶
Formats audio and ends listening
- format_audio(audio)¶
Formats one Audio File
- destroy()¶
Removes its tempdirectory Will delete this sink
- get_files()¶
Gives back all file paths Note: These will be temporary pcm files until cleanup is called
Cleanup¶
Used to remove all files out of the tempdir
- nextcord.ext.voicerecording.cleanuptempdir(tempfolder=...)¶
Attempts to remove all files out of the voicerecs tempfolder
New in version 2.0.
Encoder¶
- class nextcord.ext.voicerecording.Encoder(func, name)¶
Used to define how to encode recorded data
Represents an Encoder used for File Encoding
- nextcord.ext.voicerecording.pcm_encoder = <nextcord.ext.voicerecording.encoder.Encoder object>¶
Used to define how to encode recorded data
- nextcord.ext.voicerecording.wav_encoder = <nextcord.ext.voicerecording.encoder.Encoder object>¶
Used to define how to encode recorded data
- nextcord.ext.voicerecording.generate_ffmpeg_encoder(type)¶
Generates an Encoder which uses FFMPEG to encode the data to the specified type
Encodings¶
- class nextcord.ext.voicerecording.Encodings¶
Represents all curently available Encodings for files received by recording
New in version 2.0.
- wav¶
Encodes in .wav format
- mp3¶
Encodes in .mp3 format. Requires ffmpeg to be present
- pcm¶
No Encoding. PCM is also what will be used when receiving until formatted
- mp4¶
Encodes in .mp4 format. Requires ffmpeg to be present
- m4a¶
Encodes in .m4a format. Requires ffmpeg to be present
- mka¶
Encodes in .mka format. Requires ffmpeg to be present
- mkv¶
Encodes in .mkv format. Requires ffmpeg to be present
- ogg¶
Encodes in .ogg format. Requires ffmpeg to be present