Exemplo n.º 1
0
 async def leftscmd(self, m):
     """.lefts <reply to audio>
         Push sound to left channel"""
     audio = await get_audio(self, m, "Left channel")
     if not audio:
         return
     out = effects.pan(audio.audio, -1.0)
     await go_out(self, audio.message, audio, out, audio.pref, audio.pref)
Exemplo n.º 2
0
 async def leftscmd(self, m):
     """.lefts <reply to audio>
         Весь звук в левый канал"""
     audio = await get_audio(m, "Левый канал")
     if not audio:
         return
     out = effects.pan(audio.audio, -1.0)
     await go_out(m, audio, out, audio.pref, audio.pref)
Exemplo n.º 3
0
 async def rightscmd(self, m):
     """.rights <reply to audio>
         Весь звук в правый канал"""
     audio = await get_audio(m, "Правый канал")
     if not audio:
         return
     out = effects.pan(audio.audio, +1.0)
     await go_out(m, audio, out, audio.pref, audio.pref)
Exemplo n.º 4
0
 async def leftscmd(self, m):
     """.lefts <reply to audio>
         Весь звук в левый канал"""
     pref = "Левый канал"
     reply = await m.get_reply_message()
     audio = await get_audio(m, reply, pref)
     if not audio: return
     await m.edit(f"[{pref}] Работаю...")
     out = effects.pan(audio[0], -1.0)
     await go_out(m, reply, audio, out, pref, pref)
Exemplo n.º 5
0
    async def rightscmd(self, message):
        """.rights <reply to audio>
		    Весь звук в правый канал
		"""
        v = False
        reply = await message.get_reply_message()
        if not reply:
            await message.edit("А где реплай?")
            return
        await message.edit("Скачиваем...")
        fname = await message.client.download_media(message=reply.media)
        await message.edit("Pan'им...")
        if fname.endswith(".oga") or fname.endswith(".ogg"):
            v = True
            sound = AudioSegment.from_file(fname)
        elif fname.endswith(".mp3") or fname.endswith(
                ".m4a") or fname.endswith(".wav"):
            sound = AudioSegment.from_file(fname)
        else:
            await message.edit("<b>Unsupported format!</b>")
            os.remove(fname)
            return
        sound = AudioSegment.from_file(fname)
        sound = effects.pan(sound, +1.0)
        await message.edit("Отправляем...")
        m = io.BytesIO()
        if v:
            m.name = "voice.ogg"
            sound.export(m, format="ogg", bitrate="64k", codec="libopus")
            await message.client.send_file(message.to_id,
                                           m,
                                           reply_to=reply.id,
                                           voice_note=True)
        else:
            m.name = "Right.mp3"
            sound.export(m, format="mp3")
            await message.client.send_file(
                message.to_id,
                m,
                reply_to=reply.id,
                attributes=[
                    types.DocumentAttributeAudio(
                        duration=reply.document.attributes[0].duration,
                        title="Right",
                        performer="Right")
                ])
        await message.delete()