Atmosphere automatically creates the perfect soundtrack for your life. Put on smart glasses and walk around โ the system sees what you see and generates music that matches your environment in real time.
Walk into a coffee shop and hear smooth jazz. Step outside into a busy street, and energetic beats kick in. Enter a quiet library, and ambient study music begins. Atmosphere can capture and create custom music for any moment.
- ๐ Automatic Scene Detection: AI-powered visual analysis of your environment every ~60 seconds
- ๐ผ Contextual Music Generation: Custom music tailored to your current scene and activity
- ๐ Seamless Audio Streaming: Continuous background music with smooth transitions
- ๐ฑ Multi-device Sync: Smart glasses and companion app stay perfectly synchronized
- ๐ง Hands-free Operation: Fully automatic music generation with no manual intervention
- ๐ Real-time Monitoring: Visual status indicators and companion app dashboard
- ๐ต Music History: Track and replay all previously generated music
- Smart Glasses Client: Captures images, plays audio, minimal UI
- Backend Server: Node.js/Express server handling image processing and AI orchestration
- Companion App: React webview application running on Mentra OS
- AI Services: Claude Vision API for scene analysis, Claude API for prompt generation, Suno API for music generation
Smart Glasses โ Images via WebSocket โ Backend Server
Backend Server โ Claude Vision (every ~60s) โ Scene Analysis
Backend Server โ Claude API โ Suno-optimized prompt
Backend Server โ Suno API โ Generated music
Backend Server โ Audio stream โ Smart Glasses
Backend Server โ Status updates โ Companion App
- Node.js 18+ and npm
- Redis server
- API keys for Claude (Anthropic) and Suno
-
Clone the repository
git clone <repository-url> cd atmosphere
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your API keys and configuration -
Start Redis
# Using Docker docker run -d -p 6379:6379 redis:alpine # Or using Docker Compose npm run docker:up
-
Run the development servers
# Start all services npm run dev # Or start individually npm run dev:backend # Backend server npm run dev:glasses # Smart glasses client npm run dev:mobile # Companion app
Create a .env file in the root directory:
# AI API Keys ANTHROPIC_API_KEY=your_claude_api_key SUNO_API_KEY=your_suno_api_key # Application Settings ANALYSIS_INTERVAL=60000 # ms between Claude Vision calls IMAGE_CAPTURE_INTERVAL=3000 # ms between image captures MAX_STORED_IMAGES=20 # number of recent images to keep SCENE_CHANGE_THRESHOLD=0.7 # similarity threshold for scene changes # Server Configuration PORT=3000 REDIS_URL=redis://localhost:6379 DATABASE_URL=sqlite:./atmosphere.db # Smart Glasses Settings DEVICE_ID=atmosphere_glasses_001 AUDIO_QUALITY=high WEBRTC_SERVERS=["stun:stun.l.google.com:19302"]
atmosphere/
โโโ backend/ # Node.js backend server
โ โโโ src/
โ โ โโโ app.ts # Server entry point
โ โ โโโ routes/ # REST API endpoints
โ โ โโโ sockets/ # WebSocket handlers
โ โ โโโ core/
โ โ โ โโโ claude/ # Claude API integration
โ โ โ โโโ suno/ # Suno API integration
โ โ โ โโโ cerebras/ # Cerebras API integration
โ โ โโโ middleware/ # Express middleware
โ โโโ package.json
โโโ smart-glasses/ # Smart glasses client app
โ โโโ src/
โ โ โโโ main.ts # Glasses app entry point
โ โ โโโ services/
โ โ โ โโโ camera.ts # Image capture service
โ โ โ โโโ websocket.ts # Backend communication
โ โ โ โโโ audio.ts # Music playback service
โ โ โโโ components/ # UI components
โ โโโ index.html
โ โโโ package.json
โโโ shared/ # Shared TypeScript types
โ โโโ src/types.ts
โโโ docker-compose.yml # Docker services configuration
โโโ package.json # Root package with workspaces
Client to Server:
interface ImageData { image: Uint8Array; timestamp: string; deviceId: string; }
Server to Client:
interface MusicGenerated { audioUrl: string; title: string; prompt: string; sceneDescription: string; timestamp: string; } interface SceneAnalysis { description: string; mood: string; activity: string; location: string; confidence: number; }
GET /api/status # System health and status
GET /api/music/history # Recent generated music
POST /api/settings # Update user preferences
GET /api/analysis/current # Latest scene analysis
POST /api/analysis/manual # Trigger manual analysis
npm run dev # Start all development servers npm run dev:backend # Backend server only npm run dev:glasses # Smart glasses client only npm run dev:mobile # Companion app only npm run build # Build all workspaces npm run clean # Clean all workspaces npm run docker:up # Start Docker services npm run docker:down # Stop Docker services
Backend:
- Express.js with Socket.IO for WebSocket communication
- Claude Vision API for multi-image scene analysis
- Claude API for Suno prompt generation
- Suno API for music generation
- Redis for caching and session storage
- Sharp for image processing
Smart Glasses Client:
- HTML5/JavaScript web-based application
- WebRTC/MediaDevices for image capture
- Socket.IO client for real-time communication
- Web Audio API for music playback
Companion App:
- React application for Mentra OS webview
- Real-time WebSocket updates
- Music history and user preferences
- Status monitoring dashboard
- Image capture: < 500ms per image
- Scene analysis: < 5s for Claude Vision call
- Music generation: < 30s for Suno API call
- Audio streaming: < 200ms latency
- Companion app: < 100ms UI response time
- Secure WebSocket connections (WSS)
- Input validation for all image data
- Sanitized user inputs in companion app
- Environment-based API key storage
- Proper CORS policies
- Security event logging
# Run unit tests npm test # Run integration tests npm run test:integration # Run end-to-end tests npm run test:e2e # Run performance tests npm run test:performance
The project includes Docker configuration for easy deployment:
# Build and start services docker-compose up -d # View logs docker-compose logs -f # Stop services docker-compose down
- Docker & Docker Compose
- SSL certificates for HTTPS/WSS
- Redis server
- Environment variables configured
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for HackMIT 2024
- Powered by Claude (Anthropic), Suno AI, and Mentra OS
- Special thanks to the smart glasses community
๐ Star this repo if you find it helpful!