mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
msink
This commit is contained in:
+9
-13
@@ -46,8 +46,15 @@ class SRAudioSinkHammerVersion(AudioSink):
|
||||
|
||||
class Transcriber(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
def callback(user, data: voice_recv.VoiceData):
|
||||
logger.info(f"Got packet from {user}")
|
||||
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
bsink = voice_recv.BasicSink(callback)
|
||||
wsink = voice_recv.WaveSink(destination="/home/pi/Conjurer/wav.wav")
|
||||
fsink = voice_recv.FFmpegSink(filename = ".home/pi/Conjurer/mp3.mp3")
|
||||
self.sink_list = [bsink, wsink, fsink]
|
||||
|
||||
async def transcribe():
|
||||
config = aai.TranscriptionConfig(speaker_labels=True)
|
||||
@@ -61,22 +68,11 @@ class Transcriber(commands.Cog):
|
||||
print(f"Speaker {utterance.speaker}: {utterance.text}")
|
||||
@commands.hybrid_command(name="transcribe")
|
||||
async def test(self, ctx):
|
||||
def callback(user, data: voice_recv.VoiceData):
|
||||
logger.info(f"Got packet from {user}")
|
||||
|
||||
## voice power level, how loud the user is speaking
|
||||
# ext_data = packet.extension_data.get(voice_recv.ExtensionID.audio_power)
|
||||
# value = int.from_bytes(ext_data, 'big')
|
||||
# power = 127-(value & 127)
|
||||
# print('#' * int(power * (79/128)))
|
||||
## instead of 79 you can use shutil.get_terminal_size().columns-1
|
||||
logger.info("Attempt transcribe")
|
||||
vc = await ctx.author.voice.channel.connect(cls=voice_recv.VoiceRecvClient)
|
||||
logger.info("Connected")
|
||||
wsink = voice_recv.WaveSink(destination="/home/pi/Conjurer/Test.mp3")
|
||||
fsink = voice_recv.FFmpegSink(filename="/home/pi/Conjurer/Test.mp3")
|
||||
|
||||
vc.listen(fsink)
|
||||
msink = voice_recv.MultiAudioSink(destinations= self.sink_list)
|
||||
vc.listen(msink)
|
||||
|
||||
|
||||
@commands.command(name="stop_transcribe")
|
||||
|
||||
Reference in New Issue
Block a user