You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,22 @@
1
1
# WavePlayerJS
2
2
WavePlayerJS is a simple web app that allows you to enter a math formula for a custom waveform and hear what it sounds like. Everything is in a single `.html` file (including the CSS and JavaScript), so you don't need to download multiple files (and you can just save the program in your Downloads folder if you want - it doesn't create other files).\
3
-
ChatGPT created the code for this program and I made a few modifications.
Type or paste your wave formula into the big text box. Make sure you include the variables `vf` and `va` in your formula (these are for setting frequency and amplitude). If you want to, you can also include an optional parameter variable in your formula with `vp`. This can do whatever you want and is usually used to change the shape of the wave.
12
+
Type or paste your wave formula into the big text box. Make sure you include the variables `vf` and `va` in your formula (these are for setting frequency and amplitude). If you want to, you can also include an optional parameter variable in your formula with `vp`. This can do whatever you want, but it's usually used to change the shape of the wave.
9
13
10
14
## Using Presets
11
15
Inside the `presets` folder, you will find some markdown files that contain some wave formulas that you can try. For the preset that you want to use, copy the formula labelled as _JS_ and paste it into the web app.\
12
16
If you want to see what one of these preset waveforms looks like, open [GeoGebra](https://www.geogebra.org/) in your web browser (or use the desktop app) and copy the formula labelled _GGB_ into the input box in the left sidebar.
13
17
18
+
You can also access some of the presets with the _Load Preset_ button, but not all presets are included in this feature.
19
+
14
20
## Converting GGB to JS
15
21
Converting a GeoGebra formula into JavaScript that this web app will recognize is pretty easy. I recommend looking at the `Presets.md` file and comparing the GGB and JS versions of one of the presets, but here's a quick guide:
16
22
- Change `sin()` to `Math.sin()`
@@ -24,4 +30,4 @@ Converting a GeoGebra formula into JavaScript that this web app will recognize i
24
30
- GeoGebra uses the caret symbol (`^`) for exponents, but JavaScript uses 2 asterisks. JS treats `^` as a bitwise XOR operation.
25
31
- Add extra brackets (if you need to)
26
32
27
-
Again, it's probably best to compare GGB and JS versions of the same formula in the `Presets.md` file. It will probably be easier to learn that way.
33
+
Again, it's probably best to compare GGB and JS versions of the same formula in the `Presets.md` file. I found it easier to learn that way.
0 commit comments