A web application that generates binaural beats for various frequencies, built with Astro.
- Node.js (v18+)
- npm
- Install dependencies:
npm install
# Install type definitions for fluent-ffmpeg
npm i --save-dev @types/fluent-ffmpeg
- Generate audio segments:
npm run generate-audio
- Start development server:
npm run dev
/
├── public/
│ ├── audio/ # Pre-generated audio segments
│ │ └── binaural-*.wav # Audio files named by frequency
│ └── favicon.svg
├── src/
│ ├── layouts/
│ │ └── Layout.astro
│ ├── lib/
│ │ ├── audio-utils.ts # Audio helper functions
│ │ └── rate-limiter.ts # Rate limiting logic
│ └── pages/
│ ├── index.astro
│ └── api/
│ └── get-binaural-beats.ts
├── scripts/
│ └── generate-audio-files.ts # Audio generation script
└── package.json
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run generate-audio |
Generates audio segments (required before build) |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
The application uses pre-generated audio segments with these frequencies:
Base frequencies:
- 432 Hz
- 436 Hz
- 440 Hz (A4)
- 444 Hz
- 448 Hz
Binaural beat frequencies:
- 0.5 Hz (Low Delta)
- 2.0 Hz (Delta)
- 4.0 Hz (Theta)
- 8.0 Hz (Alpha)
- 12.0 Hz (High Alpha)
- 16.0 Hz (Beta)
- 24.0 Hz (High Beta)
- 32.0 Hz (Gamma)
- 40.0 Hz (High Gamma)
The project requires Python for generating audio files during the build process.
- Python 3.x
- FFmpeg
- Python packages:
pip install numpy scipy
Audio files are automatically generated during build:
npm run build
To generate audio files manually:
python scripts/generate_audio.py # Generate WAV files
python scripts/convert_to_mp3.py # Convert to MP3
Generated files are stored in:
src/assets/audio/wav/
- WAV filessrc/assets/audio/mp3/
- MP3 files
- ✅ Run audio generation:
npm run generate-audio
- ✅ Verify audio files exist in
public/audio/
- ✅ Build the application:
npm run build
- Audio Format: WAV
- Sample Rate: 22050 Hz
- Duration: 1-second segments
- File Naming:
binaural-{baseFreq}-{beatFreq}.wav
- Storage Location:
public/audio/
- Free tier: 1 download per day per IP
- IP addresses are hashed for privacy
- Limits reset after 24 hours
- MP3 conversion for smaller file sizes
- Premium features:
- Higher quality audio (44.1kHz)
- Longer durations
- Custom frequencies
- Advanced waveforms
- Volume control and fade effects
- Progress tracking for generation
- Audio preview before download
Check out Astro's documentation for more information about the framework.