Skip to content

JulienMeziere/sound-tools

Repository files navigation

🎡 Sound Tools - Chrome Extension

License Open Source

A powerful open source Chrome extension built with React that provides real-time audio effects for web audio/video and connects to MIDI controllers for hands-on control.

Download it here from the Chrome Web Store.

Features

  • πŸŽ›οΈ Real-time Audio Effects: Apply reverb, distortion, and filters to any audio/video on web pages
  • 🎹 MIDI Controller Support: Connect your MIDI keyboard/controller for hands-on control
  • πŸŽ“ MIDI Learn Mode: Click any control and move a MIDI knob/slider to create instant mappings
  • πŸ’Ύ Persistent Settings: All effect parameters and MIDI mappings are automatically saved
  • 🌐 Per-Domain MIDI Permissions: MIDI access permissions are remembered per website
  • πŸ”„ Auto-Restore: MIDI controllers and mappings automatically reconnect when revisiting pages
  • 🏷️ Visual MIDI Links: See which controls are linked with removable chips
  • ⚑ Modern React UI: Beautiful, responsive popup interface built with React and TypeScript
  • πŸ”„ Hot Module Replacement: Lightning-fast development with Vite and CRXJS
  • πŸ“± Content Script Integration: Seamless integration with web pages through content scripts

Development Setup

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Chrome browser

Installation

  1. Clone the repository:
git clone https://github.com/JulienMeziere/sound-tools.git
cd sound-tools
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Load the extension in Chrome:
    • Open Chrome and go to chrome://extensions/
    • Enable "Developer mode" in the top right
    • Click "Load unpacked" and select the dist folder

Available Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run type-check - Run TypeScript type checking
  • npm run lint:check - Check code formatting and linting
  • npm run lint:fix - Fix code formatting and linting issues

Project Structure

src/
β”œβ”€β”€ ParameterStore/         # Centralized parameter management
β”‚   β”œβ”€β”€ BaseParameterStore.ts    # Base parameter store class
β”‚   β”œβ”€β”€ ContentParameterStore.ts # Content script parameter store
β”‚   └── PopupParameterStore.ts   # Popup parameter store
β”œβ”€β”€ content/                # Content scripts
β”‚   β”œβ”€β”€ content.ts          # Main content script entry point
β”‚   β”œβ”€β”€ content.css         # Content script styles
β”‚   β”œβ”€β”€ ContentScriptManager.ts # Content script orchestrator
β”‚   β”œβ”€β”€ audio/              # Audio processing
β”‚   β”‚   β”œβ”€β”€ AudioEffect.ts       # Base effect interface & class
β”‚   β”‚   β”œβ”€β”€ AudioProcessor.ts    # Audio chain management
β”‚   β”‚   └── effects/             # Individual effect implementations
β”‚   β”‚       β”œβ”€β”€ ReverbEffect.ts
β”‚   β”‚       β”œβ”€β”€ DistortionEffect.ts
β”‚   β”‚       └── FilterEffect.ts
β”‚   └── notifications/      # Notification system
β”‚       └── NotificationManager.ts # Toast notifications
β”œβ”€β”€ midi/                   # MIDI controller integration
β”‚   └── MidiController.ts   # MIDI device & mapping management
β”œβ”€β”€ storage/                # Chrome storage management
β”‚   └── MidiStorageManager.ts # MIDI state & permissions storage
β”œβ”€β”€ logger/                 # Logging system
β”‚   └── index.ts           # Logger with dev/prod modes
β”œβ”€β”€ ui/                     # React UI components
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”‚   β”œβ”€β”€ Popup.tsx           # Main popup container
β”‚   β”‚   β”œβ”€β”€ Header.tsx          # App header component
β”‚   β”‚   β”œβ”€β”€ AudioEffect/        # Audio effect components
β”‚   β”‚   β”‚   β”œβ”€β”€ index.tsx           # Effects grid container
β”‚   β”‚   β”‚   β”œβ”€β”€ EffectRow.tsx       # Individual effect row
β”‚   β”‚   β”‚   β”œβ”€β”€ EffectButton.tsx    # Effect toggle button
β”‚   β”‚   β”‚   β”œβ”€β”€ Slider.tsx          # Parameter slider
β”‚   β”‚   β”‚   β”œβ”€β”€ MidiLinkChip.tsx    # MIDI link indicator
β”‚   β”‚   β”‚   └── SettingsButton.tsx  # Settings toggle
β”‚   β”‚   └── Midi/               # MIDI components
β”‚   β”‚       β”œβ”€β”€ index.tsx           # MIDI controller container
β”‚   β”‚       β”œβ”€β”€ MidiRow.tsx         # MIDI connection row
β”‚   β”‚       └── MidiButton.tsx      # MIDI action button
β”‚   β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useSoundTools.ts    # Audio effects logic
β”‚   β”‚   └── useMidiController.ts # MIDI controller logic
β”‚   └── popup/              # Popup entry point
β”‚       β”œβ”€β”€ popup.html      # Popup HTML template
β”‚       β”œβ”€β”€ popup.tsx       # Popup React entry point
β”‚       └── popup.css       # Popup styles

How It Works

Audio Effects Processing

The extension uses the Web Audio API to create real-time audio effects:

  • Reverb: Convolution reverb using impulse responses
  • Distortion: Waveshaper-based distortion
  • Filter: Biquad filters (lowpass, highpass, etc.)

MIDI Integration

  • Device Connection: Uses the Web MIDI API to connect to MIDI controllers
  • Learn Mode: Click "Learn" button, then click any UI control and move a MIDI knob/slider to create mappings
  • Flexible Mappings: Support for both MIDI notes and CC messages with one-to-many and many-to-one relationships
  • Visual Feedback: MIDI link chips show which controls are mapped and allow easy removal
  • Persistent Storage: All MIDI mappings are saved per device and automatically restored
  • Per-Domain Permissions: MIDI access permissions are remembered for each website
  • Auto-Reconnect: Controllers and mappings automatically restore when revisiting pages

Extension Architecture

  • Popup: React-based UI with real-time parameter control and MIDI learning
  • Content Script: Injected into web pages to process audio and handle MIDI events
  • Parameter Store: Cross-context parameter synchronization between popup and content script
  • Storage Manager: Persistent storage for MIDI mappings, device configurations, and permissions
  • Message Passing: Chrome extension messaging for real-time UI updates and MIDI events

Usage

Getting Started with Audio Effects

  1. Open the Extension: Click the Sound Tools icon in your browser toolbar
  2. Enable Effects: Toggle any effect (Reverb, Distortion, Filter) on or off
  3. Adjust Parameters: Use the sliders to fine-tune effect settings
  4. Real-time Processing: Effects are applied instantly to any audio/video on the page

Setting Up MIDI Control

  1. Connect Your MIDI Controller: Plug in your MIDI keyboard, control surface, or DJ controller
  2. Request MIDI Access: Click "Request MIDI Access" in the extension popup
  3. Select Your Device: Choose your MIDI controller from the available devices list
  4. Enter Learn Mode: Click the "Learn" button to start creating MIDI mappings

Creating MIDI Mappings

  1. Activate Learn Mode: Click "Learn" - the button will show "Learning..."
  2. Select a Control: Click any effect button or parameter slider in the UI
  3. Move MIDI Control: Turn a knob, move a slider, or press a key on your MIDI controller
  4. Mapping Created: A chip will appear showing the MIDI link (e.g., "CC64", "Note C4")
  5. Remove Mappings: Click the "Γ—" on any chip to remove that MIDI link

MIDI Features

  • Multiple Mappings: One MIDI control can control multiple UI elements
  • Multiple Controls: One UI element can be controlled by multiple MIDI controls
  • Persistent Storage: All mappings are automatically saved per device
  • Auto-Restore: Mappings automatically restore when you reconnect the same device
  • Per-Domain Permissions: MIDI access is remembered separately for each website

Browser Compatibility

  • βœ… Chrome: Full support (Manifest V3)
  • πŸ”„ Firefox: Planned support (will require Manifest V2 adaptation)
  • ❓ Safari: Under consideration
  • βœ… Edge: Full support (Chromium-based)

Technologies Used

  • React 18 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool and dev server
  • CRXJS - Chrome extension build tooling
  • Web Audio API - Audio processing
  • Web MIDI API - MIDI controller support
  • Chrome Extensions API - Browser integration

Contributing

This is an open source project and contributions are welcome! πŸŽ‰

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

Ways to Contribute

  • πŸ› Bug Reports: Found an issue? Open an issue on GitHub
  • πŸ’‘ Feature Requests: Have an idea? We'd love to hear it
  • πŸ”§ Code Contributions: Fix bugs, add features, improve documentation
  • 🎡 Audio Effects: Add new audio effects or improve existing ones
  • 🎹 MIDI Features: Enhance MIDI controller support
  • πŸ“š Documentation: Help improve the README, add tutorials, or write guides

License

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

Roadmap

  • βœ… MIDI learn functionality - Implemented with visual feedback and persistent storage
  • βœ… Persistent parameter storage - All settings automatically saved and restored
  • βœ… Per-domain MIDI permissions - MIDI access remembered per website
  • βœ… Auto-restore MIDI state - Controllers and mappings automatically reconnect
  • Firefox extension support (Manifest V2 adaptation)
  • More audio effects (delay, chorus, phaser, flanger, pitch shift)
  • Visual audio analyzer with real-time frequency display
  • Preset management system for saving/loading effect configurations
  • Audio recording capabilities with effect processing
  • Advanced MIDI features (velocity sensitivity, aftertouch, pitch bend)
  • Keyboard shortcuts for quick effect toggling

About

A browser extension providing audio FXs to the browser and that can connect to MIDI controllers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors