Skip to content

A Python-based Telegram bot that automates lyric retrieval by querying external music APIs in real-time.

Notifications You must be signed in to change notification settings

AmartyaKumar09/Music_Finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 Telegram Lyrics Finder Bot

A Python-based Telegram bot that identifies songs based on lyrics. It supports both text input and voice messages, using the Genius API to fetch song details.

🌟 Features

  • Text Search: Type partial lyrics to find a song.
  • Voice Search: Record yourself singing or humming lyrics; the bot converts the audio to text and performs a search.
  • Smart Matching: Uses fuzzy logic and keyword cleaning to improve search results.
  • Genius Integration: Provides direct links to song lyrics on Genius.com.
  • FFmpeg-Free: Uses librosa and soundfile for audio conversion, making deployment easier.

πŸ“‹ Prerequisites

  • Python 3.8 or higher
  • A Telegram Bot Token
  • A Genius API Client Access Token

πŸ› οΈ Installation

  1. Clone the repository (or download the files):

    git clone <your-repo-url>
    cd <your-repo-folder>
  2. Create a virtual environment (recommended):

    python -m venv venv
    
    # Windows
    venv\Scripts\activate
    
    # Mac/Linux
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

βš™οΈ Configuration

You need to set up your environment variables to keep your API keys secure.

  1. Create a file named .env in the root directory of the project.

  2. Add the following lines to the file, replacing the placeholders with your actual keys:

    BOT_TOKEN=your_telegram_bot_token_here
    GENIUS_API_KEY=your_genius_access_token_here

How to get tokens:

  • BOT_TOKEN: Chat with @BotFather on Telegram and create a new bot.
  • GENIUS_API_KEY: Sign up at Genius API Clients, create a new API Client, and copy the Client Access Token.

πŸ§ͺ Test File

  • I have added a test file within my codebase to check for the functionality and debugging purposesl, you dont need to mandatorily run this file for the functionality of your code

πŸš€ Usage

  1. Run the bot:

    python your_script_name.py
  2. Open Telegram and find your bot.

  3. Start the conversation:

    • /start - Initializes the bot.
    • /help - Shows instructions.
  4. Search:

    • Text: Simply type the lyrics (e.g., "is this the real life is this just fantasy").
    • Voice: Hold the microphone button and speak/sing the lyrics clearly.

πŸ“ Notes

  • Audio Processing: The bot creates temporary .ogg and .wav files during voice processing (voice_<chat_id>.wav). These are automatically deleted after processing to save space.
  • Voice Recognition: The bot uses Google Speech Recognition (en-US). For best results, speak clearly and minimize background noise.

🀝 Contributing

Pull requests are welcome, you can watch, learn or even laugh at my code but for major changes, please open an issue first to discuss what you would like to change.

πŸ“„ License

MIT

About

A Python-based Telegram bot that automates lyric retrieval by querying external music APIs in real-time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages