mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-18 15:52:10 +00:00
msink
This commit is contained in:
+9
-13
@@ -46,8 +46,15 @@ class SRAudioSinkHammerVersion(AudioSink):
|
|||||||
|
|
||||||
class Transcriber(commands.Cog):
|
class Transcriber(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
|
def callback(user, data: voice_recv.VoiceData):
|
||||||
|
logger.info(f"Got packet from {user}")
|
||||||
|
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self._last_member = None
|
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():
|
async def transcribe():
|
||||||
config = aai.TranscriptionConfig(speaker_labels=True)
|
config = aai.TranscriptionConfig(speaker_labels=True)
|
||||||
@@ -61,22 +68,11 @@ class Transcriber(commands.Cog):
|
|||||||
print(f"Speaker {utterance.speaker}: {utterance.text}")
|
print(f"Speaker {utterance.speaker}: {utterance.text}")
|
||||||
@commands.hybrid_command(name="transcribe")
|
@commands.hybrid_command(name="transcribe")
|
||||||
async def test(self, ctx):
|
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")
|
logger.info("Attempt transcribe")
|
||||||
vc = await ctx.author.voice.channel.connect(cls=voice_recv.VoiceRecvClient)
|
vc = await ctx.author.voice.channel.connect(cls=voice_recv.VoiceRecvClient)
|
||||||
logger.info("Connected")
|
logger.info("Connected")
|
||||||
wsink = voice_recv.WaveSink(destination="/home/pi/Conjurer/Test.mp3")
|
msink = voice_recv.MultiAudioSink(destinations= self.sink_list)
|
||||||
fsink = voice_recv.FFmpegSink(filename="/home/pi/Conjurer/Test.mp3")
|
vc.listen(msink)
|
||||||
|
|
||||||
vc.listen(fsink)
|
|
||||||
|
|
||||||
|
|
||||||
@commands.command(name="stop_transcribe")
|
@commands.command(name="stop_transcribe")
|
||||||
|
|||||||
Reference in New Issue
Block a user