Skip to content

Commit fc87bda

Browse files
committed
music project
1 parent d4046f2 commit fc87bda

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ Make them do one. -->
834834
# Projects
835835

836836
<!-- Make a WAV file that plays hot cross buns -->
837-
- [Hot Cross Buns]()
837+
- [Music Maker](./projects/music_maker.md)
838838

839839
# Code Structure VIII
840840

src/projects/music_maker.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Music Maker
2+
3+
## Problem Statement
4+
5+
Recordings of audio predate the invention of the modern computer.
6+
7+
The first of recording was done [in 1860 in Paris by Édouard-Léon Scott de Martinville](https://www.firstsounds.org/sounds/scott.php). He would later have his glory stolen by Thomas Edison; a common occurrence for the time.
8+
9+
But just as black and white movies don't mean that the past lacked color, people
10+
have been making sounds and composing those sounds into music [probably the entire history of our species](https://www.youtube.com/watch?v=KElPnD-dbkk).
11+
12+
Computers are generally more convenient for sharing music and recordings than other
13+
methods we have tried in the past, such as paper and stone tablets, if sometimes
14+
of lower quality than something like a [vinyl record](https://victrola.com/blogs/articles/does-music-really-sound-better-on-vinyl)[^debate].
15+
16+
Sounds are formed by waves propagating through the air
17+
at various frequencies. When sound enters your ear [it vibrates your eardrum](https://www.nidcd.nih.gov/health/how-do-we-hear) which in turn vibrates other parts of your ear ultimately culminating
18+
in your brain perceiving a sound. The frequencies
19+
of sound determine in what way your eardrum will vibrate and therefore are what determine how you
20+
will percieve any given sound.
21+
22+
Storing audio on a computer requires translating audio information into a form
23+
that a computer can store. We call this translation step "digitization."
24+
It requires in some manner storing what frequencies of sounds
25+
and in what proportion need to be produced to "play back" a sound.
26+
27+
One of the file formats used to store such audio is a "[WAV](https://en.wikipedia.org/wiki/WAV)"
28+
file.
29+
30+
31+
## Your Goal
32+
33+
Make a program that produces a WAV file that, when played,
34+
will sound like an instrumental version of [Three Blind Mice](https://en.wikipedia.org/wiki/Three_Blind_Mice)[^haloreach].
35+
36+
As a hint: `byte` and `short` can be helpful when representing "binary formats" like WAV.
37+
Reading comprehension as well as reading stamina will also be useful for figuring out
38+
how a WAV file works.
39+
40+
## Future Goals
41+
42+
When you learn enough to do the following, come back to this project and expand it.
43+
44+
* Make the program produce other songs.
45+
* Expand the program to take as input a text file that in some way describes a song and produce a WAV file
46+
in turn.
47+
* Make a "virtual keyboard" where somebody can play notes by typing and whatever they played can
48+
be "exported" as a WAV file.
49+
* Support a file format other than WAV as the output.
50+
51+
[^debate]: This is a subject of much debate.
52+
53+
[^haloreach]: When Halo Reach came out there was a lot of internet fighting about the "reticle bloom"
54+
on a weapon called the DMR. This meant that if you fired it too quickly it would get
55+
less and less accurate. The advice I heard around that time was to pull the trigger to the tune
56+
of "three blind mice" and that would be about the right timing.

0 commit comments

Comments
 (0)