sound-effects/README.md
DJP 4c734e51d4 Initial commit: Sound Effects App
Added complete sound effects application with multiple versions (V1, V2),
configuration files, webhook functionality, and associated assets.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 16:04:47 -04:00

5.6 KiB

🎵 Sound Effect Generator

A professional web application for generating custom sound effects using the ElevenLabs API with Microsoft Azure AD authentication.

Features

🔐 Authentication

  • Microsoft Azure AD Integration: Secure login using Oliver SSO
  • Session Management: Persistent login sessions with automatic token validation
  • Protected Access: Main application is hidden until user authenticates

🎛️ Sound Generation

  • ElevenLabs API Integration: Professional-grade AI sound generation
  • Text-to-Sound: Generate sound effects from text descriptions
  • Duration Control: Adjustable duration from 0.5 to 22 seconds (or auto)
  • Prompt Influence: Fine-tune how closely the AI follows your description (0-1 scale)

🎨 User Interface

  • Modern Design: Clean, responsive interface using Montserrat font
  • Dark/Light Mode: Toggle between themes with persistent preference storage
  • Interactive Sliders: Real-time value display for duration and prompt influence
  • Mobile Responsive: Optimized for all device sizes

🔧 Technical Features

  • Real-time Audio Playback: Instant preview of generated sounds
  • Download Functionality: Save sound effects as MP3 files
  • Automatic Cleanup: Old files (24+ hours) are automatically deleted
  • Error Handling: Comprehensive error messages and validation
  • Security Headers: Protected configuration files and proper MIME types

Installation

Prerequisites

  • Web server with PHP support
  • ElevenLabs API key
  • Microsoft Azure AD application configured

Setup Steps

  1. Clone/Download the project files to your web server

  2. Configure API Key:

    // Edit config.php
    'elevenlabs_api_key' => 'your-actual-elevenlabs-api-key-here'
    
  3. Set Permissions:

    chmod 755 generated/
    chmod 644 config.php
    
  4. Configure Azure AD (if needed):

    • Update clientId and authority in index.php line 500-501
    • Ensure redirect URI matches your domain

Configuration

config.php

return [
    'elevenlabs_api_key' => 'your-api-key-here',
    'max_file_age_hours' => 24,        // Auto-delete files older than this
    'generated_files_dir' => 'generated/'
];

Azure AD Settings

Located in index.php around line 498:

const msalConfig = {
    auth: {
        clientId: "your-client-id",
        authority: "https://login.microsoftonline.com/your-tenant-id",
        redirectUri: window.location.origin + window.location.pathname
    }
};

Usage

  1. Login: Use your Oliver SSO credentials to authenticate
  2. Describe Sound: Enter a text description of the sound effect you want
  3. Adjust Settings:
    • Duration: Use slider (0 = auto, or 0.5-22 seconds)
    • Prompt Influence: Control AI creativity (0 = creative, 1 = literal)
  4. Generate: Click "Generate Sound Effect" button
  5. Play & Download: Preview the audio and download if satisfied

Example Prompts

  • "Spacious braam suitable for high-impact movie trailer moments"
  • "Gentle rain falling on leaves in a forest"
  • "Sci-fi laser gun firing with echo"
  • "Medieval sword clashing against shield"
  • "Mystical wind chimes in ancient temple"

API Integration

ElevenLabs Sound Generation API

  • Endpoint: POST https://api.elevenlabs.io/v1/sound-generation
  • Parameters:
    • text (required): Sound description
    • duration_seconds (optional): 0.5-22 seconds
    • prompt_influence (optional): 0-1 creativity control
  • Output: MP3 audio file

File Structure

sound-effects/
├── index.php              # Main application
├── config.php             # API configuration
├── .htaccess              # Security & MIME types
├── generated/             # Generated sound files (auto-created)
└── README.md              # This file

Security Features

  • Config Protection: .htaccess prevents direct access to config.php
  • File Cleanup: Automatic deletion of old generated files
  • Input Validation: Sanitized user inputs and API parameters
  • Session Security: Secure token management with Azure AD
  • HTTPS Redirect: Enforced secure connections

Browser Support

  • Chrome/Edge: Full support
  • Firefox: Full support
  • Safari: Full support (including iOS)
  • Mobile: Responsive design for all mobile browsers

Troubleshooting

Common Issues

"Please configure your ElevenLabs API key"

  • Edit config.php and add your actual API key

Authentication Issues

  • Check Azure AD configuration
  • Verify redirect URI matches your domain
  • Clear browser cache and try again

Sound Generation Fails

  • Verify API key is valid and has credits
  • Check internet connection
  • Try simpler text descriptions

File Permission Errors

  • Ensure generated/ directory exists and is writable
  • Check web server file permissions

Debug Mode

Add error reporting to troubleshoot issues:

// Add to top of index.php for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

Development

Adding Features

  • Edit index.php for UI/functionality changes
  • Modify config.php for new settings
  • Update .htaccess for security rules

Customization

  • Colors: Modify CSS variables in the :root section
  • Fonts: Change Google Fonts import and CSS font-family
  • Authentication: Update Azure AD configuration as needed

License

This project is for internal use with Oliver Agency's infrastructure and authentication systems.

Support

For technical issues or questions:

  • Email: optical@oliver.agency
  • Check ElevenLabs API documentation for sound generation issues
  • Verify Azure AD configuration for authentication problems