GithubHelp home page GithubHelp logo

elixonus / doppler Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 3 MB

Simulation of the doppler effect, particularized in the context of sound waves and explored through scenarios where a wave emitting source and wave detecting observer move with a user controllable position, velocity or acceleration.

Home Page: https://elixonus.github.io/doppler/

License: MIT License

JavaScript 76.14% HTML 19.82% CSS 4.04%
ap-physics doppler-effect html5-canvas javascript frequencies simulation waves amplitudes

doppler's Introduction

doppler ๐Ÿ”Š

Logo

Project Logo

About

Simulation of the doppler effect, particularized in the context of sound waves and explored through scenarios where a wave emitting source and wave detecting observer move with a user controllable position, velocity or acceleration.

Source

Source is controllable in position, velocity and acceleration and is always in one of three states: stationary, constant velocity or constant acceleration.

Source emits waves with a constant or variable frequency and constant amplitude.

Waves

Waves propagate in time with their amplitude attenuating exponentially.

Only crests are illustrated in the rendering of waves.

When multiple waves collide, interference is not accounted for at the moment.

Observer

Observer, similarly, is controllable in position, velocity and acceleration and is always in one of three states: stationary, constant velocity or constant acceleration.

Observer detects a wave at a time and records its perceived frequency and amplitude.

Algorithm

Data of each wave is stored in a rolling queue array where the array is overwritten progressively in a circular fashion.

When each wave is emitted, the current time, as well as the position and velocity of the source is stored in an object to be used later.

To find which wave is currently being detected by the observer, the program goes through each wave to try to find the closest wave that has passed the observer, if any.

If an observer wave is found, the perceived frequency and amplitude is calculated using the vector position and velocity of the observer as well as the vector position and velocity of the source from the time of wave emission (using the source wave data structure mentioned earlier) to find the components of the projected velocities of the source and observer in the relative direction of the observer and source, respectively.

Functionality

TIME button group can be accessed with key P to pause the simulation, possibly to change the properties of the source and observer.

BUFFER button group can be accessed with keys S and R to save the current simulation time and restore the saved time later on.

SOUND button group can be accessed with key M to interpret the observer signal in time as an audible sound.

OWAVE button group can be accessed with key W to highlight the properties of the wave that is observed at the current time. This includes but is not limited to, the position and velocity of the source.

FMOD button group can be accessed with key F to modulate the frequency of the source signal in time.

CONTROL button group can be accessed with key C to switch between modifying the properties of the source and observer.

TYPE button group can be accessed with key T to switch between modifying the position, velocity and acceleration of the controlled object.

DIRECTION button group can be accessed with keys ArrowLeft, ArrowRight, ArrowUp, ArrowDown and 0 to set the direction of the vector (including origin) of the motion type of the controlled object.

MAGNITUDE button group can be accessed with keys 1, 2 and 3 to set the magnitude of the vector (excluding origin) of the motion type of the controlled object.

Limitations

Simulation does not implement the effects of wave interference.

Observer can only detect one frequency and amplitude at a time.

Screenshots

Main

Screenshot 1

Screenshot 1

View

Screenshot 2

Plot

Screenshot 3

doppler's People

Contributors

elixonus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

doppler's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.