Skip to content

HeythisisSud/echoChamber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎧 EchoChamber — Room Acoustic Fingerprinting

Node.js Express Prisma TypeScript License Status


EchoChamber is a web-based system that analyzes room acoustics using audio recordings and generates a unique "fingerprint" of the space. It focuses on capturing how sound behaves in real environments and storing that information in a structured, usable format.


🚀 What This Project Does

The application records a short audio sample from a room and processes it to extract acoustic characteristics such as:

  • Reverberation time (RT60) across frequencies
  • Early reflections
  • Phase coherence and randomness
  • Group delay metrics

These features are combined into a fingerprint that represents the acoustic identity of a room.


🧠 How It Works

1. Audio Capture — Frontend

The user records audio (typically a sweep signal). This recording is sent to the backend as a .wav file along with metadata like room name and capture duration.


2. Audio Processing — Backend

The backend:

  • Extracts the raw WAV buffer
  • Parses the signal
  • Applies DSP techniques like inverse sweep and reflection detection

3. Fingerprint Generation

From the processed signal, the system computes:

  • RT60 values for multiple frequency bands
  • Phase-related metrics
  • Early reflections

A hash is generated to uniquely identify the fingerprint.


4. Database Storage

The data is stored using Prisma in a structured format:

Entity Description
Space Represents the room
Measurement Recording session
Fingerprint Computed acoustic data
Reflections Early reflection points

All related records are created inside a transaction to maintain consistency.


5. Authentication

The system uses cookie-based authentication with JWT:

  • token (httpOnly) — actual authentication
  • echochamber_session — session hint for UI

Protected routes like /analyze require a valid token.


🛠️ Tech Stack

Frontend

  • TypeScript
  • Fetch API (with credentials)
  • Browser Audio APIs

Backend

  • Node.js
  • Express
  • Prisma ORM
  • JWT Authentication

Audio / DSP

  • Custom signal processing utilities
  • WAV parsing
  • Fingerprint generation

⚙️ Environment Variables

Create a .env file in the backend directory:

JWT_SECRET=your_secret_key
JWT_EXPIRES_IN=1h
DATABASE_URL=your_database_url
NODE_ENV=development

📦 Installation

# Install dependencies
npm install

# Start backend
npm run dev

# Start frontend
npm run dev

🔐 Auth Flow

  1. Login sets cookies: token and echochamber_session
  2. Requests include cookies via:
credentials: "include"
  1. Backend reads and verifies the token from cookies
  2. Invalid or expired tokens are cleared automatically

⚠️ Notes

  • Audio processing can take time depending on file size
  • Avoid aborting requests during processing — this can interrupt DB transactions
  • JWT expiry should be set correctly ("1h" instead of 3600)

📌 Future Improvements

  • Move processing to background jobs
  • Add retry handling for failed captures
  • Visualize acoustic fingerprints
  • Compare fingerprints across rooms

🧑‍💻 Author

Built to explore:

  • Audio signal processing
  • Backend architecture
  • Real-world problem solving

📄 License

Distributed under the MIT License.

About

EchoChamber is an acoustic fingerprinting system that verifies physical room presence by analyzing how sound reflects within a space, enabling secure and hardware-free location authentication.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages