An interactive simulation of the Doppler Effect, built with SceneryStack. This simulation allows users to explore how the frequency of sound waves changes when there is relative motion between a sound source and an observer.
🎮 Live Demo 🌐
- Interactive source and observer movement
- Real-time visualization of sound waves
- Live frequency shift calculations
- Waveform displays for both emitted and observed sound
- Velocity vector visualization
- Multiple preset scenarios
- Adjustable sound speed and frequency
- Numerical values for frequency, speed, and distance
- Pause/Resume functionality
- Keyboard controls
- Projector mode
- Extendable language support
- Produce a single HTML file for easy distribution
- Click and drag the green source or purple observer to move them and control their velocity
- Drag the microphone icon to listen to the sound
S: Select sourceO: Select observer- Arrow keys: Move selected object
- Space: Pause/Resume simulation
R: Reset simulationT: Toggle motion trailsM: Toggle microphoneH: Toggle help display+/-: Adjust emitted frequency,/.: Adjust sound speed0-6: Load preset scenarios0: Free Play1: Source approaching observer2: Source receding from observer3: Observer approaching source4: Observer receding from source5: Same direction motion6: Perpendicular motion
The simulation uses the Doppler Effect formula:
f' = f * (v - vₒ) / (v - vₛ)
where:
- f' is the observed frequency
- f is the emitted frequency
- v is the speed of sound
- vₒ is the observer's velocity component along the line of sight
- vₛ is the source's velocity component along the line of sight
- Node.js (v18 or higher)
- npm
- Clone the repository:
git clone https://github.com/veillette/dopplerEffectPhET.git
cd dopplerEffectPhET- Install dependencies:
npm install- Start the development server:
npm start- Build for production:
npm run buildnpm start: Start development servernpm run build: Build for productionnpm run preview: Preview production buildnpm run lint: Run ESLintnpm run format: Format code with Prettiernpm run fix: Fix linting and formatting issuesnpm run check: Type-check TypeScript codenpm run serve: Serve production buildnpm run watch: Watch TypeScript filesnpm run clean: Clean build directory
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with SceneryStack
- Inspired by PhET Interactive Simulations
