software design document - Mr-Kumar-Abhishek/brain-beats GitHub Wiki

Software Design Document

1. Introduction

Brain Beats is a web application for generating brainwave entrainment sounds. This document outlines the software design of the Brain Beats web application.

2. Architecture

The application follows a client-side architecture, primarily built with HTML, CSS, and JavaScript. It does not have a backend server.

2.1. Components

  • HTML Files:

    • index.html: Main entry point, contains navigation and links to different generators.
    • Generator-specific HTML files (e.g., binaural-beats-generator.html, isochronic-tones-generator.html, pure-tone-generator.html): Contain the UI for each sound generator, including input elements, controls, and potentially visual elements.
    • Preset HTML files (e.g., noise.html, solfeggio-frequency.html, angel-frequency.html): Provide interfaces for pre-configured sound presets.
    • favorites.html: Manages and displays user's saved presets.
    • search.html: Implements search functionality for presets and frequencies.
    • blog/ subdirectory: Contains HTML and related assets for a blog section.
  • CSS Files:

    • css/main.css: Main stylesheet for the application, providing overall styling.
    • css/bootstrap.css: Bootstrap CSS framework for layout and UI components.
    • css/normalize.min.css: CSS reset for cross-browser consistency.
    • blog/css/: Stylesheets specific to the blog section.
  • JavaScript Files:

    • js/main.js: Main application logic, handling user interactions, sound generation, and potentially preset management.
    • js/data.js: Likely contains data for presets, frequencies, and descriptions.
    • js/data-id.js, js/desc-data.js, js/favorites-data.js, js/jsonDataArray.js, js/search-data.js: Potentially manage specific data sets or functionalities.
    • js/bootstrap.bundle.js, js/bootstrap.js, js/bootstrap-input-spinner.js: Bootstrap and related utilities.
    • js/workbox/: Service worker related files for offline capabilities.
    • blog/js/: Scripts specific to the blog section.
  • JSON Files:

    • json/binaurals.json, json/isochronic.json, json/monaurals.json, json/puretones.json, json/noise.json, json/solfeggio.json, json/angel.json, json/rife-frequencies-cafl-xref.json, json/rife-monaural-freq.json, json/rife3Dfreq.json, json/alt-freq-auto.json, json/alt-freq-monaural.json, json/sq_monaurals.json, json/dreamachines.json: Store data for sound presets and frequency lists.
    • json/indexer.json: Likely used for search indexing.
    • lab/: Contains various JSON files likely used for frequency data and potentially experimental features.
  • Image Files:

    • img/: Contains images for the website, including icons and logos.
    • blog/img/: Images specific to the blog section.
  • Service Worker:

    • sw.js: Service worker script for caching assets and enabling offline functionality.
    • js/workbox/: Workbox library files used by the service worker.
  • Noise Processor:

    • noise-processor/: Directory potentially containing scripts or modules for advanced noise processing or audio manipulation.

3. Data Flow

  1. User Interaction: User interacts with HTML elements (buttons, sliders, inputs) in the browser.
  2. JavaScript Logic: JavaScript in js/main.js and other scripts handles user events, reads input values, and retrieves frequency data from JSON files.
  3. Sound Generation: JavaScript uses Web Audio API to generate audio signals based on selected frequencies and sound types.
  4. Audio Playback: Web Audio API plays the generated sounds through the user's browser.
  5. Preset Data: JSON files in json/ and lab/ directories provide data for sound presets and frequency values, loaded by JavaScript.
  6. Favorites & Search: JavaScript manages user's favorite presets and implements search functionality using js/favs.js and js/search-data.js and json/indexer.json.
  7. Service Worker (Optional): sw.js uses Workbox to cache website assets, enabling offline access.

4. Technologies Used

  • Frontend:

    • HTML5
    • CSS3
    • JavaScript (ES6+)
    • Web Audio API
    • Bootstrap CSS Framework
    • jQuery
    • Workbox (for service worker)
  • Data Storage:

    • JSON files (client-side data storage)
    • Local Storage (for user favorites - implied)

5. Future Enhancements (Based on README and file structure)

  • Expanding the range of sound types and generators.
  • Adding more custom presets.
  • Improving search functionality.
  • Enhancing user interface and user experience.
  • Potentially incorporating user accounts and cloud-based preset storage.
  • Further development of the blog section.
  • Exploring more advanced audio processing techniques in noise-processor/.

This document provides a high-level overview of the software design for the Brain Beats web application. Further details can be found in the code itself.