Skip to content

Commit 0e08748

Browse files
author
bartlettmic
committed
Formatting fix
1 parent e5517fe commit 0e08748

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

code math.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
### Loudness and Brightness
55

66
Having brightness correspond to volume is an obvious enough feature, however its implementation was a bit of a design choice. Initially, I started with straight proportionality:
7-
<center>![linear proportionality](http://i.imgur.com/bAM95uO.gif) &nbsp;&nbsp;&nbsp;&nbsp;in the code as: `(volume / maxVol) * 255`</center>
7+
![linear proportionality](http://i.imgur.com/bAM95uO.gif) &nbsp;&nbsp;&nbsp;&nbsp;in the code as: `(volume / maxVol) * 255`
88

99
I found this method to be a little underwhelming, so I tried a more exponential approach to make lower ratios darker and higher ratios brighter:
1010

11-
<center>![exponential](http://imgur.com/sqhPcq8.gif)&nbsp;&nbsp;&nbsp;&nbsp;in the code as: `pow(256, volume / maxVol) - 1`</center>
11+
![exponential](http://imgur.com/sqhPcq8.gif)&nbsp;&nbsp;&nbsp;&nbsp;in the code as: `pow(256, volume / maxVol) - 1`
1212

1313
This seemed a little too extreme, so the code currently uses a squared proportion:
1414

15-
<center>![proportion^2](http://imgur.com/3amI46q.gif)&nbsp;&nbsp;&nbsp;&nbsp;in the code as: `pow(volume / maxVol, 2.0) * 255`</center>
15+
![proportion^2](http://imgur.com/3amI46q.gif)&nbsp;&nbsp;&nbsp;&nbsp;in the code as: `pow(volume / maxVol, 2.0) * 255`
1616

1717
This was used because it is a balance between the linear and exponential approaches, as can be seen graphically:
1818

19-
<center>![bright graph](http://imgur.com/DPynqok.gif)</center>
19+
![bright graph](http://imgur.com/DPynqok.gif)
2020

2121
I encourage you to to try all methods to see which one you find to be the most pleasing. One other alternative is to raise the volume ratio to the power of 1.5 to get a slightly more linear output.
2222

@@ -40,14 +40,14 @@ Rarely will you get an ordered sequence from the sound detector, and that's wher
4040
In this sequence, there is an trend toward lower inputs (i.e. volume readings, so in the program this would reflect a decreasing noise level). The sequenced average properly reflects this trend, whereas if we did a proper mathematical average it would still read as 5. The difference here is a little too nuanced to be of importance, so I'll demonstrate with some actual data:
4141

4242
<table>
43-
<tr><td><center>All volumes were read out simultaneously during the same song. Some quiet was left at the end to demonstrate the difference between true and sequenced averages.</td></tr>
44-
<tr><th><center>Volume Readings, Straight from Sound Detector</center></th></tr>
43+
<tr><td> All volumes were read out simultaneously during the same song. Some quiet was left at the end to demonstrate the difference between true and sequenced averages.</td></tr>
44+
<tr><th> Volume Readings, Straight from Sound Detector </th></tr>
4545
<tr><td><img src="http://i.imgur.com/bYXGvKV.png" alt="vols"></td></tr>
46-
<tr><th><center>Volume Readings + Sequenced Average of Volumes<sub>(orange)</sub></center></th></tr>
46+
<tr><th> Volume Readings + Sequenced Average of Volumes<sub>(orange)</sub> </th></tr>
4747
<tr><td><img src="http://i.imgur.com/CLJKTkV.png" alt="vol+sa"></td></tr>
48-
<tr><th><center>Volume Readings + True Average of Volumes<sub>(green)</sub></center></th></tr>
48+
<tr><th> Volume Readings + True Average of Volumes<sub>(green)</sub> </th></tr>
4949
<tr><td><img src="http://i.imgur.com/3CgFLbo.png" alt="vol+av"></td></tr>
50-
<tr><th><center>Sequenced Average of Volumes<sub>(orange)</sub> + True Average of Volumes<sub>(green)</sub></center></th></tr>
50+
<tr><th> Sequenced Average of Volumes<sub>(orange)</sub> + True Average of Volumes<sub>(green)</sub> </th></tr>
5151
<tr><td><img src="http://i.imgur.com/MFDu64M.png" alt="av+sa"></td></tr>
5252
</table>
5353

0 commit comments

Comments
 (0)