Skip to content

GordonBie123/relaylist

Repository files navigation

Relaylist 🎵💬

Transform your SMS conversations into personalized Spotify playlists using Natural Language Processing and emotion analysis.

Python Version Streamlit License: MIT

🌟 Overview

Relaylist analyzes the emotional landscape of your text conversations and generates music recommendations that match the mood and energy of your chats. Using advanced NLP techniques and the Spotify API, it bridges the gap between conversational sentiment and musical expression.

Key Features

  • Emotion Detection: Identifies joy, sadness, anger, fear, surprise, and neutral emotions
  • Sentiment Analysis: Tracks emotional polarity and trends over time
  • Topic Modeling: Extracts key themes and conversation patterns
  • Temporal Analysis: Discovers messaging patterns by hour and day
  • Spotify Integration: Generates personalized playlists based on conversation mood
  • Multiple Preference Methods: Genre selection, Spotify profile sync, or artist/track seeds

🎬 Demo

https://relaylist.streamlit.app (Pseudo data is included in the pasuedo_data folder in main, additionally song suggestion function will not work, link is just for app UI/UX and model analysis demo, please obtain own API key and run locally for song suggestion function)

🏗️ Architecture

User SMS Export → File Parser → NLP Analyzer → Emotion Mapper → Spotify API → Playlist
                                      ↓
                              Music Preferences ← User Input

Tech Stack

  • Frontend: Streamlit with custom Spotify-inspired UI
  • NLP: NLTK, TextBlob for sentiment analysis
  • Music API: Spotify Web API via Spotipy
  • Database: SQLite for session storage
  • Visualization: Plotly for interactive charts

🚀 Getting Started

Prerequisites

  • Python 3.8 or higher
  • Spotify Developer Account
  • SMS conversation export in CSV format

Installation

  1. Clone the repository
git clone https://github.com/yourusername/relaylist.git
cd relaylist
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Set up Spotify API credentials

Create a .env file in the root directory:

SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_URI=http://localhost:8501/callback

See API Setup Guide for detailed instructions.

  1. Run the application
streamlit run Home_Page.py

📊 CSV Format

Your SMS export should contain these columns: (You can get the exports via a SMS Backup & Restore mobile app) (Pseudo data provided for testing purposes)

Column Description Example
Type Message direction "Sent" or "Received"
Date Timestamp "9/1/2024 10:54"
Name / Number Contact info "John Doe (+15551234567)"
Sender Sender name "John Doe" or empty for sent
Content Message text "Hey, how are you?"

🎯 Usage

  1. Upload: Export your SMS conversation and upload the CSV file
  2. Analyze: View emotional insights, sentiment trends, and conversation patterns
  3. Preferences: Set your music taste via genres, Spotify profile, or seed tracks
  4. Discover: Get personalized playlist recommendations

🧪 Core Project Structure

relaylist/
├── models/           # Core NLP and recommendation algorithms
├── services/         # External API integrations (Spotify)
├── utils/            # Helper functions and utilities
├── pages/            # Streamlit page components
└── styles/           # Custom CSS styling

🔧 Configuration

Audio Feature Mapping

Emotions are mapped to Spotify audio features:

  • Joy: High valence (0.6-1.0), moderate-high energy
  • Sadness: Low valence (0.0-0.4), low energy, acoustic
  • Anger: Low valence, high energy (0.7-1.0), loud
  • Surprise: Moderate-high valence and energy
  • Neutral: Balanced features

NLP Pipeline

  1. Tokenization (NLTK)
  2. Emotion keyword matching
  3. Sentiment polarity analysis (TextBlob)
  4. Topic extraction via frequency analysis
  5. Temporal pattern recognition

📈 Future Enhancements

  • Support for WhatsApp exports
  • Real-time conversation analysis
  • Collaborative playlist generation
  • Export to Apple Music
  • Advanced topic modeling with LDA
  • Emotion tracking dashboard
  • Multi-language support

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Spotify Web API for music data
  • NLTK and TextBlob for NLP capabilities
  • Streamlit for the web framework
  • The open-source community

📧 Contact

Gordon - gordonbie2@gmail.com

Project Link: https://github.com/GordonBie123/relaylist

⚠️ Privacy & Security

  • All conversation data is processed locally
  • No messages are stored on external servers
  • Spotify authentication uses OAuth 2.0
  • Session data stored in local SQLite database
  • See Privacy Policy for details

Built with 💚 using Python, NLP, and Spotify API

About

Relaylist transforms SMS conversations into personalized Spotify playlists. Analyzes chat emotions with NLP (NLTK, TextBlob), extracts sentiment patterns, and generates mood-based music recommendations using Spotify API. Built with Streamlit & Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors