Skip to content

akashsahu54/Symphony-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง‘โ€๐Ÿ’ป+๐ŸŽต Symphony.js

Transform your code into music. Hear your logic, feel your bugs, compose with commits.

Symphony.js is an interactive web-based development tool that merges a code editor with a generative audio engine, providing real-time auditory feedback about code structure, quality, and flow. Write code and experience it as music.

License: MIT TypeScript React Tone.js


โœจ Features

๐ŸŽฌ Engaging Intro Experience

image
  • 5-second splash screen with animated logo and typewriter text effect
  • Fade-in background music that establishes the audio-visual nature
  • Skip functionality - press any key or click to jump straight to the editor
  • Responsive design that looks great on all devices

๐ŸŽน Real-Time Audio Feedback

  • Hear your code quality as you type with intelligent mood-based audio
  • Three distinct moods that reflect code characteristics:
    • ๐ŸŽผ HARMONIOUS: Clean, well-documented code โ†’ Major keys, smooth chords
    • ๐ŸŽธ DISCORDANT: Syntax errors, malformed code โ†’ Minor keys, chaotic sounds
    • โšก INTENSE: Complex algorithms, deep nesting โ†’ Fast tempo, high energy

๐ŸŽผ Musical Instruments

  • Rhythm Instrument: Represents execution flow and typing patterns
  • Harmony Instrument: Chord progressions based on code complexity
  • Melody Instrument: Function calls and significant code events

๐ŸŽฌ Commit Compositions

image
  • Generate 15-second musical pieces from your entire file
  • Code structure mapped to musical phrases:
    • Imports โ†’ Steady beat patterns
    • Functions โ†’ Melodic development
    • Returns โ†’ Resolving chords

๐Ÿ“Š Visual Feedback

image
  • Real-time waveform visualizer showing audio output
  • Code quality indicators with visual metrics
  • Split-screen layout: Editor on left, visualizer on right
  • Dark theme optimized for extended coding sessions

๐ŸŽ›๏ธ Smart Controls

  • Mute Bugs: Silence error sounds while debugging
  • Play Commit: Generate full file composition
  • Language Support: JavaScript, TypeScript, Python
  • Keyboard Shortcuts: Quick access to all features

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Modern browser with Web Audio API support (Chrome, Firefox, Safari, Edge)

Installation

# Clone the repository
git clone https://github.com/akashsahu54/symphony-js.git
cd symphony-js

# Install dependencies
npm install

# Start development server
npm run dev

Open http://localhost:5173 in your browser.

First Steps

  1. Watch the intro - Experience the 5-second splash screen (or press any key to skip)
  2. Start typing code in the Monaco Editor
  3. Listen as Symphony.js analyzes and sonifies your code
  4. Click "Play Commit" to hear your entire file as a composition
  5. Toggle "Mute Bugs" to silence error sounds while fixing issues

๐ŸŽฏ Use Cases

๐ŸŽ“ Learning & Education

  • Multi-sensory learning: Audio + visual feedback accelerates skill development
  • Immediate error detection: Hear mistakes as you make them
  • Pattern recognition: Internalize code quality through consistent audio cues
  • Engaging practice: Gamification makes coding more enjoyable

๐Ÿ› Development & Debugging

  • Background awareness: Audio alerts without breaking visual focus
  • Error prevention: Catch syntax issues in real-time
  • Complexity monitoring: Intense sounds signal when code needs refactoring
  • Flow state: Maintain focus with ambient audio feedback

๐ŸŽจ Creative Coding

  • Algorithmic music composition: Code becomes a creative medium
  • Live coding performances: Use for algorithmic music shows
  • Artistic expression: Generate unique soundscapes from code
  • Educational demonstrations: Make code structure audible for teaching

โ™ฟ Accessibility

  • Audio feedback for developers with visual impairments
  • Alternative quality indicators beyond visual cues
  • Multi-modal interface supports different learning styles

๐Ÿ—๏ธ Architecture

Technology Stack

  • React 19.2: UI framework with hooks and context
  • TypeScript 5.9: Type-safe development with strict mode
  • Vite: Lightning-fast build tool and dev server
  • Tone.js 15.1: Web Audio API framework for synthesis
  • Monaco Editor 4.7: VS Code's editor component

Project Structure

symphony-js/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/       # React UI components
โ”‚   โ”‚   โ”œโ”€โ”€ EditorPanel.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ WaveformVisualizer.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ ControlBar.tsx
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ contexts/         # React context providers
โ”‚   โ”‚   โ””โ”€โ”€ AudioEngineContext.tsx
โ”‚   โ”œโ”€โ”€ services/         # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ CodeAnalyzer.ts
โ”‚   โ”‚   โ”œโ”€โ”€ InstrumentManager.ts
โ”‚   โ”‚   โ””โ”€โ”€ PythonRunner.ts
โ”‚   โ”œโ”€โ”€ hooks/            # Custom React hooks
โ”‚   โ”œโ”€โ”€ types/            # TypeScript definitions
โ”‚   โ””โ”€โ”€ utils/            # Helper functions
โ”œโ”€โ”€ public/               # Static assets
โ””โ”€โ”€ .kiro/                # Kiro AI specs and config

Key Components

IntroScreen: 5-second splash screen with animations and music
IntroLogo: Animated SVG logo with pulse effect
CodeAnalyzer: Analyzes code structure, detects errors, calculates complexity
InstrumentManager: Manages Tone.js instruments and audio synthesis
AudioEngineContext: Global state for audio engine and playback
EditorPanel: Monaco Editor wrapper with language support
WaveformVisualizer: Real-time audio visualization canvas


๐ŸŽฎ Usage Guide

Keyboard Shortcuts

Pointing to icon
Shortcut Action
Any Key Skip Intro Screen
Ctrl/Cmd + Enter Play Commit Composition
Ctrl/Cmd + M Toggle Mute Bugs
Ctrl/Cmd + / Show Keyboard Shortcuts
Ctrl/Cmd + L Change Language

Audio Moods Explained

๐ŸŽผ HARMONIOUS (Major Keys, 90-120 BPM)

image

Triggered by:

  • Clean syntax with no errors
  • Well-documented code (comments present)
  • Moderate complexity (nesting depth โ‰ค 2)
  • Proper code structure

๐ŸŽธ DISCORDANT (Minor Keys, 60-90 BPM)

image

Triggered by:

  • Syntax errors or warnings
  • Malformed code structure
  • Missing brackets or semicolons
  • Undefined variables

โšก INTENSE (Fast Tempo, 120-180 BPM)

image

Triggered by:

  • Complex algorithms
  • Deep nesting (depth > 4)
  • Recursive functions
  • High cyclomatic complexity

Code Examples

Try these examples to experience different moods:

HARMONIOUS Example:

// Well-documented function
function calculateSum(a, b) {
  return a + b;
}

DISCORDANT Example:

// Syntax errors
fucntion broken( {
  retunr undefined
}

INTENSE Example:

// Complex matrix
def matrix_multiply(A, B):
    """
    Multiplies two matrices A and B.
    This is a classic example of high algorithmic complexity.
    """
    if len(A[0]) != len(B):
        print("Error: Incompatible matrix dimensions")
        return None

    # Initialize the result matrix with zeros
    result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]

    # Iterate through rows of A
    for i in range(len(A)):
        # Iterate through columns of B
        for j in range(len(B[0])):
            # Iterate through rows of B
            for k in range(len(B)):
                result[i][j] += A[i][k] * B[k][j]
    
    return result

# Example matrices:
matrix1 = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

matrix2 = [
    [9, 8, 7],
    [6, 5, 4],
    [3, 2, 1]
]

# This call should sound intense
print("Calculating matrix multiplication...")
product = matrix_multiply(matrix1, matrix2)
print(product)

๐Ÿ› ๏ธ Development

Available Scripts

# Start development server with HMR
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

# Run tests (single execution)
npm run test

# Lint code
npm run lint

Running Tests

# Run all tests once
npm run test

# Run tests with UI
npm run test -- --ui

# Run specific test file
npm run test CodeAnalyzer.test.ts

Building for Production

npm run build

Output will be in the dist/ directory, ready for deployment to any static hosting service.


๐ŸŒ Browser Compatibility

Symphony.js requires Web Audio API support:

  • โœ… Chrome 34+
  • โœ… Firefox 25+
  • โœ… Safari 14.1+
  • โœ… Edge 79+

Falls back to visual-only mode if audio is unavailable.


๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run tests: npm run test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript strict mode conventions
  • Write tests for new features
  • Update documentation for API changes
  • Follow existing code style (ESLint enforced)
  • Keep components small and focused

๐Ÿ“š Documentation

Core Features

Intro Screen

Project Guidelines


๐ŸŽฏ Roadmap

Current Version (v1.0)

  • โœ… Engaging intro screen with animations and music
  • โœ… Real-time audio feedback with three moods
  • โœ… Commit compositions (15-second pieces)
  • โœ… Multi-language support (JS, TS, Python)
  • โœ… Visual waveform display
  • โœ… Mute controls and keyboard shortcuts

Upcoming Features (v1.1-v1.2)

  • ๐Ÿ”„ User accounts and cloud save
  • ๐Ÿ”„ Custom instrument selection
  • ๐Ÿ”„ Export compositions (MIDI/WAV)
  • ๐Ÿ”„ Mobile responsive design
  • ๐Ÿ”„ More language support (Java, C++, Rust)

Future Vision (v2.0+)

  • ๐Ÿ”ฎ AI-powered code analysis and suggestions
  • ๐Ÿ”ฎ Collaborative real-time coding
  • ๐Ÿ”ฎ VS Code extension
  • ๐Ÿ”ฎ Custom theme marketplace
  • ๐Ÿ”ฎ Educational curriculum integration

๐Ÿ› Known Issues

  • Large files (>1000 lines) use sampling for performance
  • Audio requires user interaction to start (browser security)
  • Some browsers may require headphones for best experience

Report issues on GitHub Issues.


๐Ÿ“„ License

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


๐Ÿ™ Acknowledgments

  • Monaco Editor - Microsoft's excellent code editor
  • Tone.js - Powerful Web Audio framework
  • React Team - For the amazing framework
  • Vite Team - For blazing fast tooling


๐ŸŒŸ Show Your Support

If you find Symphony.js helpful, please consider:

  • โญ Starring the repository
  • ๐Ÿฆ Sharing on social media
  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Suggesting features
  • ๐Ÿค Contributing code

๐Ÿ“ง Contact Us

You can contact me directly at akashsahu64158@gmail.com


Made with โค๏ธ and ๐ŸŽต by developer, for developers

Experience code in a whole new way. Start composing today.

About

Symphony.js: Stop looking for bugs, start listening for them. An AI-powered editor that turns your code into real-time generative music.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages