Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (77)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (9923)

  • configure : update copyright year

    1er janvier, par Lynne
    configure : update copyright year
    

    On 01/01/2025 19:05, Peter Ross wrote :
    > FFmpeg turns 25 this year.

    • [DH] configure
  • "FFmpeg : Error not transitioning to the next song in Discord Bot's queue."

    1er avril 2024, par noober

    I have 3 modules, but I'm sure the error occurs within this module, and here is the entire code within that module :

    


    import asyncio
import discord
from discord import FFmpegOpusAudio, Embed
import os

async def handle_help(message):
    embed = discord.Embed(
        title="Danh sách lệnh cho Bé Mèo",
        description="Dưới đây là các lệnh mà chủ nhân có thể bắt Bé Mèo phục vụ:",
        color=discord.Color.blue()
    )
    embed.add_field(name="!play", value="Phát một bài hát từ YouTube.", inline=False)
    embed.add_field(name="!pause", value="Tạm dừng bài hát đang phát.", inline=False)
    embed.add_field(name="!resume", value="Tiếp tục bài hát đang bị tạm dừng.", inline=False)
    embed.add_field(name="!skip", value="Chuyển đến bài hát tiếp theo trong danh sách chờ.", inline=False)
    embed.add_field(name="!stop", value="Dừng phát nhạc và cho phép Bé Mèo đi ngủ tiếp.", inline=False)
    # Thêm các lệnh khác theo cùng mẫu trên
    await message.channel.send(embed=embed)

class Song:
    def __init__(self, title, player):
        self.title = title  # Lưu trữ tiêu đề bài hát ở đây
        self.player = player

# Thêm đối tượng Song vào hàng đợi
def add_song_to_queue(guild_id, queues, song):
    queues.setdefault(guild_id, []).append(song)

async def handle_list(message, queues):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    if os.path.exists(log_file_path):
        with open(log_file_path, "r", encoding="utf-8") as f:
            song_list = f.readlines()

        if song_list:
            embed = discord.Embed(
                title="Danh sách bài hát",
                description="Danh sách các bài hát đã phát:",
                color=discord.Color.blue()
            )

            for i, song in enumerate(song_list, start=1):
                if i == 1:
                    song = "- Đang phát: " + song.strip()
                embed.add_field(name=f"Bài hát {i}", value=song, inline=False)

            await message.channel.send(embed=embed)
        else:
            await message.channel.send("Hiện không có dữ liệu trong file log.")
    else:
        await message.channel.send("File log không tồn tại.")

async def handle_commands(message, client, queues, voice_clients, yt_dl_options, ytdl, ffmpeg_options=None, guild_id=None, data=None):
    # Nếu không có ffmpeg_options, sử dụng các thiết lập mặc định
    if ffmpeg_options is None:
        ffmpeg_options = {
            'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
            'options': '-vn -filter:a "volume=0.25"'
        }
    
    # Khởi tạo voice_client
    if guild_id is None:
        guild_id = message.guild.id

    if guild_id in voice_clients:
        voice_client = voice_clients[guild_id]
    else:
        voice_client = None

    # Xử lý lệnh !play
    if message.content.startswith("!play"):
        try:
            # Kiểm tra xem người gửi tin nhắn có đang ở trong kênh voice không
            voice_channel = message.author.voice.channel
            # Kiểm tra xem bot có đang ở trong kênh voice của guild không
            if voice_client and voice_client.is_connected():
                await voice_client.move_to(voice_channel)
            else:
                voice_client = await voice_channel.connect()
                voice_clients[guild_id] = voice_client
        except Exception as e:
            print(e)

        try:
            query = ' '.join(message.content.split()[1:])
            if query.startswith('http'):
                url = query
            else:
                query = 'ytsearch:' + query
                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(query, download=False))
                if not data:
                    raise ValueError("Không có dữ liệu trả về từ YouTube.")
                url = data['entries'][0]['url']

            player = FFmpegOpusAudio(url, **ffmpeg_options)
            # Lấy thông tin của bài hát mới đang được yêu cầu
            title = data['entries'][0]['title']
            duration = data['entries'][0]['duration']
            creator = data['entries'][0]['creator'] if 'creator' in data['entries'][0] else "Unknown"
            requester = message.author.nick if message.author.nick else message.author.name
                    
            # Tạo embed để thông báo thông tin bài hát mới
            embed = discord.Embed(
                title="Thông tin bài hát mới",
                description=f"**Bài hát:** *{title}*\n**Thời lượng:** *{duration}*\n**Tác giả:** *{creator}*\n**Người yêu cầu:** *{requester}*",
                color=discord.Color.green()
            )
            await message.channel.send(embed=embed)
            
            # Sau khi lấy thông tin của bài hát diễn ra, gọi hàm log_song_title với title của bài hát
            # Ví dụ:
            title = data['entries'][0]['title']
            await log_song_title(title)

            # Thêm vào danh sách chờ nếu có bài hát đang phát
            if voice_client.is_playing():
                queues.setdefault(guild_id, []).append(player)
            else:
                voice_client.play(player)
                
        except Exception as e:
            print(e)
            
    if message.content.startswith("!link"):
            try:
                voice_client = await message.author.voice.channel.connect()
                voice_clients[voice_client.guild.id] = voice_client
            except Exception as e:
                print(e)

            try:
                url = message.content.split()[1]

                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))

                song = data['url']
                player = discord.FFmpegOpusAudio(song, **ffmpeg_options)

                voice_clients[message.guild.id].play(player)
            except Exception as e:
                print(e)

    # Xử lý lệnh !queue
    elif message.content.startswith("!queue"):
        queue = queues.get(guild_id, [])
        if queue:
            await message.channel.send("Danh sách chờ:")
            for index, item in enumerate(queue, 1):
                await message.channel.send(f"{index}. {item.title}")
        else:
            await message.channel.send("Không có bài hát nào trong danh sách chờ.")

    # Xử lý lệnh !skip
    elif message.content.startswith("!skip"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.stop()
                await play_next_song(guild_id, queues, voice_client, skip=True)
                await remove_first_line_from_log()
        except Exception as e:
            print(e)

    # Xử lý các lệnh như !pause, !resume, !stop
    elif message.content.startswith("!pause"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.pause()
        except Exception as e:
            print(e)

    elif message.content.startswith("!resume"):
        try:
            if voice_client and not voice_client.is_playing():
                voice_client.resume()
        except Exception as e:
            print(e)

    elif message.content.startswith("!stop"):
        try:
            if voice_client:
                voice_client.stop()
                await voice_client.disconnect()
                del voice_clients[guild_id]  # Xóa voice_client sau khi dừng
        except Exception as e:
            print(e)

async def log_song_title(title):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        # Kiểm tra xem tệp tin log đã tồn tại chưa
        if not os.path.exists(log_file_path):
            # Nếu chưa tồn tại, tạo tệp tin mới và ghi title vào tệp tin đó
            with open(log_file_path, 'w', encoding='utf-8') as file:
                file.write(title + '\n')
        else:
            # Nếu tệp tin log đã tồn tại, mở tệp tin và chèn title vào cuối tệp tin
            with open(log_file_path, 'a', encoding='utf-8') as file:
                file.write(title + '\n')
    except Exception as e:
        print(f"Error logging song title: {e}")

async def remove_first_line_from_log():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "r", encoding="utf-8") as f:
            lines = f.readlines()
        # Xóa dòng đầu tiên trong list lines
        lines = lines[1:]
        with open(log_file_path, "w", encoding="utf-8") as f:
            for line in lines:
                f.write(line)
    except Exception as e:
        print(f"Error removing first line from log: {e}")
        
async def clear_log_file():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "w", encoding="utf-8") as f:
            f.truncate(0)
    except Exception as e:
        print(f"Error clearing log file: {e}")


async def play_next_song(guild_id, queues, voice_client, skip=False):
    queue = queues.get(guild_id, [])
    if queue:
        player = queue.pop(0)
        voice_client.play(player, after=lambda e: asyncio.run_coroutine_threadsafe(play_next_song(guild_id, queues, voice_client, skip=False), voice_client.loop))
        if skip:
            return
        else:
            await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
    elif skip:
        await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng
    else:
        await clear_log_file()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng


    


    I have tried asking ChatGPT, Gemini, or Bing, and they always lead me into a loop of errors that cannot be resolved. This error only occurs when the song naturally finishes playing due to its duration. If the song is playing and I use the command !skip, the next song in the queue will play and function normally. I noticed that it seems like if a song ends naturally, the song queue is also cleared immediately. I hope someone can help me with this

    


  • FFMPEG equalizer clipping audio despite low volume

    23 juillet 2023, par Tom

    I'm using ffmpeg to equalise audio transferred from historic gramophone records, using standard eqs of the era.

    


    The frequency and gain values are taken from the graphic eq settings listed on the Audacity website - https://plugins.audacityteam.org/additional-resources/eq-curves/playback-equalization-for-78-rpm-shellacs-and-early-33-lps

    


    An example of the Blumlien300 curve here - https://2850314611-files.gitbook.io/ /files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FklCVENFte0GRy5IqVz0W%2Fuploads%2FJHS6Mv121GX1h898xy4K%2FBlumlein300_3.2.2.txt?alt=media&token=8d04df05-366d-47f8-8c82-149fa5eda59a

    


    The audio file I'm testing with has a digital peak of -35db, the highest gain value applied on this eq is 17db. When I run the ffmpeg command though, it reports the audio is clipping and the result is a horribly distorted recording.

    


    Can anyone advise why this is happening ? I run the same file through the same eq settings in Audacity and the result is as expected.

    


    set eq="equalizer=f=22050:g=-0.4,equalizer=f=21203.720228928225:g=-0.4,equalizer=f=20389.920705063967:g=-0.4,equalizer=f=19607.354835383569:g=-0.4,equalizer=f=18854.823871147240:g=-0.4,equalizer=f=18131.175071633737:g=-0.4,equalizer=f=17435.299938351014:g=-0.4,equalizer=f=16766.132517017904:g=-0.4,equalizer=f=16122.647764715837:g=-0.4,equalizer=f=15503.859979709296:g=-0.4,equalizer=f=14908.821291529812:g=-0.4,equalizer=f=14336.620209010769:g=-0.4,equalizer=f=13786.380224048187:g=-0.4,equalizer=f=13257.258468950000:g=-0.4,equalizer=f=12748.444425315412:g=-0.4,equalizer=f=12259.158682468413:g=-0.4,equalizer=f=11788.651743541806:g=-0.4,equalizer=f=11336.202877384472:g=-0.4,equalizer=f=10901.119014532051:g=-0.4,equalizer=f=10482.733685550458:g=-0.4,equalizer=f=10080.406000125797:g=-0.4,equalizer=f=9693.519665336817:g=-0.4,equalizer=f=9321.482041606178:g=-0.4,equalizer=f=8963.723234884175:g=-0.4,equalizer=f=8619.695223674737:g=-0.4,equalizer=f=8288.871019565895:g=-0.4,equalizer=f=7970.743859979441:g=-0.4,equalizer=f=7664.826431902562:g=-0.4,equalizer=f=7370.650125412990:g=-0.4,equalizer=f=7087.764315853595:g=-0.4,equalizer=f=6815.735673557399:g=-0.4,equalizer=f=6554.147500065165:g=-0.4,equalizer=f=6302.599089819104:g=-0.4,equalizer=f=6060.705116354743:g=-0.4,equalizer=f=5828.095042050793:g=-0.4,equalizer=f=5604.412550532827:g=-0.4,equalizer=f=5389.315000861326:g=-0.4,equalizer=f=5182.472902668021:g=-0.394052055589,equalizer=f=4983.569411436476:g=-0.386751590389,equalizer=f=4792.299843153906:g=-0.376185664074,equalizer=f=4608.371207590573:g=-0.362543760251,equalizer=f=4431.501759492006:g=-0.345993198097,equalizer=f=4261.420566996452:g=-0.330710126890,equalizer=f=4097.867096616487:g=-0.318503033191,equalizer=f=3940.590814149046:g=-0.309564283335,equalizer=f=3789.350800902538:g=-0.303741189604,equalizer=f=3643.915384653179:g=-0.300601888512,equalizer=f=3504.061784765236:g=-0.3,equalizer=f=3369.575770931567:g=-0.3,equalizer=f=3240.251335011708:g=-0.3,equalizer=f=3115.890375464830:g=-0.3,equalizer=f=2996.302393894170:g=-0.3,equalizer=f=2881.304203238093:g=-0.3,equalizer=f=2770.719647160795:g=-0.3,equalizer=f=2664.379330212802:g=-0.3,equalizer=f=2562.120358347913:g=-0.3,equalizer=f=2463.786089399117:g=-0.3,equalizer=f=2369.225893131248:g=-0.3,equalizer=f=2278.294920502843:g=-0.3,equalizer=f=2190.853881783698:g=-0.3,equalizer=f=2106.768833188346:g=-0.296437432785,equalizer=f=2025.910971698469:g=-0.290217913930,equalizer=f=1948.156437760116:g=-0.280922418484,equalizer=f=1873.386125553329:g=-0.268550946447,equalizer=f=1801.485500543704:g=-0.253103497820,equalizer=f=1732.344424036255:g=-0.235614749092,equalizer=f=1665.856984462975:g=-0.218076286078,equalizer=f=1601.921335145533:g=-0.200537822606,equalizer=f=1540.439538284674:g=-0.184632657170,equalizer=f=1481.317414937308:g=-0.168779161348,equalizer=f=1424.464400751469:g=-0.152925665153,equalizer=f=1369.793407238189:g=-0.137072168707,equalizer=f=1317.220688367753:g=-0.121218672255,equalizer=f=1266.665712285991:g=-0.105365175802,equalizer=f=1218.051037954117:g=-0.088396941462,equalizer=f=1171.302196523118:g=-0.070858476440,equalizer=f=1126.347577261013:g=-0.053320011417,equalizer=f=1083.118317858216:g=-0.034770724190,equalizer=f=1041.548198942992:g=-0.013200571808,equalizer=f=1001.573542645411:g=0.011445558081,equalizer=f=963.133115054414:g=0.039167665478,equalizer=f=926.168032418592:g=0.069965750383,equalizer=f=890.621670946974:g=0.103839812794,equalizer=f=856.439580071665:g=0.140789852714,equalizer=f=823.569399039473:g=0.180815870141,equalizer=f=791.960776704742:g=0.223158863450,equalizer=f=761.565294400547:g=0.266149082252,equalizer=f=732.336391770094:g=0.311823093692,equalizer=f=704.229295444710:g=0.360237839089,equalizer=f=677.200950459179:g=0.413174176689,equalizer=f=651.209954299352:g=0.471478099167,equalizer=f=626.216493481026:g=0.535493496953,equalizer=f=602.182282562909:g=0.606978871276,equalizer=f=579.070505500287:g=0.684199304160,equalizer=f=556.845759249530:g=0.767096732395,equalizer=f=535.473999537060:g=0.853776460170,equalizer=f=514.922488709709:g=0.943323717867,equalizer=f=495.159745586582:g=1.036571598687,equalizer=f=476.155497235608:g=1.135335711982,equalizer=f=457.880632600910:g=1.237175803242,equalizer=f=440.307157909949:g=1.342335109599,equalizer=f=423.408153792158:g=1.453088412615,equalizer=f=407.157734043353:g=1.569993670188,equalizer=f=391.531005972773:g=1.688508164136,equalizer=f=376.504032271996:g=1.808802987893,equalizer=f=362.053794347337:g=1.934465396527,equalizer=f=348.158157059540:g=2.065823830001,equalizer=f=334.795834816768:g=2.204891058267,equalizer=f=321.946358968944:g=2.352009664049,equalizer=f=309.590046453497:g=2.509552803849,equalizer=f=297.707969644483:g=2.678532979186,equalizer=f=286.281927358906:g=2.856115742576,equalizer=f=275.294416975809:g=3.041612670003,equalizer=f=264.728607625441:g=3.230723044219,equalizer=f=254.568314407418:g=3.422700948357,equalizer=f=244.797973598401:g=3.621312762050,equalizer=f=235.402618811295:g=3.826195809769,equalizer=f=226.367858069467:g=4.034154835453,equalizer=f=217.679851760848:g=4.246639157749,equalizer=f=209.325291438168:g=4.468048945659,equalizer=f=201.291379432825:g=4.698686666092,equalizer=f=193.565809251186:g=4.938552319047,equalizer=f=186.136746723276:g=5.187645904525,equalizer=f=178.992811874976:g=5.445967422525,equalizer=f=172.123061495972:g=5.712025685327,equalizer=f=165.516972376744:g=5.984236264250,equalizer=f=159.164425188922:g=6.258981796419,equalizer=f=153.055688984312:g=6.515823590632,equalizer=f=147.181406288853:g=6.777692051390,equalizer=f=141.532578768664:g=7.044587178695,equalizer=f=136.100553446236:g=7.314095599483,equalizer=f=130.877009445637:g=7.583605034445,equalizer=f=125.853945246444:g=7.853114469407,equalizer=f=121.023666426868:g=8.146285201135,equalizer=f=116.378773877299:g=8.444439101287,equalizer=f=111.912152466211:g=8.742593001439,equalizer=f=107.616960141075:g=9.042209423688,equalizer=f=103.486617447577:g=9.344900874707,equalizer=f=99.514797451091:g=9.650668303691,equalizer=f=95.695416044961:g=9.959511710641,equalizer=f=92.022622630759:g=10.271431095557,equalizer=f=88.490791156230:g=10.586541422511,equalizer=f=85.094511497198:g=10.906991735356,equalizer=f=81.828581170245:g=11.233594002758,equalizer=f=78.687997363448:g=11.556996378650,equalizer=f=75.667949272979:g=11.873211536187,equalizer=f=72.763810733831:g=12.194794278600,equalizer=f=69.971133133372:g=12.521192148224,equalizer=f=67.285638596875:g=12.846501740168,equalizer=f=64.703213434600:g=13.169127539473,equalizer=f=62.219901840358:g=13.492484068742,equalizer=f=59.831899831942:g=13.820346094285,equalizer=f=57.535549424116:g=14.145340590334,equalizer=f=55.327333025244:g=14.467659297988,equalizer=f=53.203868048980:g=14.789401139821,equalizer=f=51.161901732761:g=15.111142981226,equalizer=f=49.198306155165:g=15.437629968456,equalizer=f=47.310073444503:g=15.770860796927,equalizer=f=45.494311171305:g=16.104091624940,equalizer=f=43.748237917649:g=16.412536097232,equalizer=f=42.069179016527:g=16.579143834849,equalizer=f=40.454562454745:g=16.588876722789,equalizer=f=38.901914933067:g=16.461103901687,equalizer=f=37.408858077565:g=16.215674576171,equalizer=f=35.973104796389:g=15.850016386783,equalizer=f=34.592455776352:g=15.350234288456,equalizer=f=33.264796113983:g=14.615823142814,equalizer=f=31.988092075884:g=13.626809695512,equalizer=f=30.760387983412:g=12.332756508563,equalizer=f=29.579803216941:g=10.518513413063,equalizer=f=28.444529335092:g=8.346792732977,equalizer=f=27.352827304528:g=5.833681758551,equalizer=f=26.303024836072:g=3.097942665008,equalizer=f=25.293513823067:g=0.163604913582,equalizer=f=24.322747878043:g=-2.887748621210,equalizer=f=23.389239963935:g=-6.091081601564,equalizer=f=22.491560116216:g=-9.478973229620,equalizer=f=21.628333252442:g=-12.539218030638,equalizer=f=20.798237065887:g=-14.384804507659,equalizer=f=20:g=-15"
ffmpeg -i "File.wav" -af %eq% -c:a pcm_s24le out.wav