Skip to content

Commit

Permalink
en: music-and-technology-synthesis-simple-melodies: Improve
Browse files Browse the repository at this point in the history
* src/en/sections/music-and-technology-synthesis-simple-melodies.tex: Improve
the tables.
  • Loading branch information
artyom-poptsov committed Jan 5, 2025
1 parent 107f796 commit a79d9ea
Showing 1 changed file with 66 additions and 48 deletions.
114 changes: 66 additions & 48 deletions src/en/sections/music-and-technology-synthesis-simple-melodies.tex
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,78 @@ \section{Programming of simple melodies}
melody is shown in the table \ref{table:twinkle-winkle-little-star-notes} in
more readable form. Each row of the table represents one bar of the melody.

\begin{tabular}{p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}}
Bar number & \multicolumn{4}{c}{Notes} \\
\hline \hline
0 & C4 & C4 & G4 & G4 \\
\hline
1 & A4 & A4 & G4 & \\
\hline
2 & F4 & F4 & E4 & E4 \\
\hline
3 & D4 & D4 & C4 & \\
\hline
4 & G4 & G4 & F4 & F4 \\
\hline
5 & E4 & E4 & D4 & \\
\hline
6 & G4 & G4 & F4 & F4 \\
\hline
7 & E4 & E4 & D4 & \\
\hline
8 & C4 & C4 & G4 & G4 \\
\hline
9 & A4 & A4 & G4 & \\
\hline
\begin{table}[ht]
\centering
\begin{tabular}{|*{5}{c|}}
\hline
\textbf{Bar number} & \multicolumn{4}{c|}{\textbf{Notes}} \\
\hline
0 & C4 & C4 & G4 & G4 \\
\hline
1 & A4 & A4 & G4 & \\
\hline
2 & F4 & F4 & E4 & E4 \\
\hline
3 & D4 & D4 & C4 & \\
\hline
4 & G4 & G4 & F4 & F4 \\
\hline
5 & E4 & E4 & D4 & \\
\hline
6 & G4 & G4 & F4 & F4 \\
\hline
7 & E4 & E4 & D4 & \\
\hline
8 & C4 & C4 & G4 & G4 \\
\hline
9 & A4 & A4 & G4 & \\
\hline
\end{tabular}
\label{table:twinkle-twinkle-little-star-notes}
\end{tabular}
\end{table}

Using our knowledge of the musical ``squiggles'', let's try to set the length
for each note by adding it into the brackets next to the note.

\begin{tabular}{p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}}
Bar number & \multicolumn{4}{c}{Notes} \\
\hline \hline
0 & C4 ($\frac{1}{4}$) & C4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) \\
\hline
1 & A4 ($\frac{1}{4}$) & A4 ($\frac{1}{4}$) & G4 ($\frac{1}{2}$) & \\
\hline
2 & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) \\
\hline
3 & D4 ($\frac{1}{4}$) & D4 ($\frac{1}{4}$) & C4 ($\frac{1}{2}$) & \\
\hline
4 & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) \\
\hline
5 & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & D4 ($\frac{1}{2}$) & \\
\hline
6 & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) \\
\hline
7 & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & D4 ($\frac{1}{2}$) & \\
\hline
8 & C4 ($\frac{1}{4}$) & C4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) \\
\hline
9 & A4 ($\frac{1}{4}$) & A4 ($\frac{1}{4}$) & G4 ($\frac{1}{2}$) & \\
\hline
\begin{table}[ht]
\centering
\begin{tabular}{|*{5}{c|}}
\hline
\textbf{Bar number} & \multicolumn{4}{c|}{\textbf{Notes}} \\
\hline
0 & C4 ($\frac{1}{4}$) & C4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$)
\rule[-2ex]{0pt}{5ex}\\
\hline
1 & A4 ($\frac{1}{4}$) & A4 ($\frac{1}{4}$) & G4 ($\frac{1}{2}$) &
\rule[-2ex]{0pt}{5ex}\\
\hline
2 & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$)
\rule[-2ex]{0pt}{5ex}\\
\hline
3 & D4 ($\frac{1}{4}$) & D4 ($\frac{1}{4}$) & C4 ($\frac{1}{2}$) &
\rule[-2ex]{0pt}{5ex}\\
\hline
4 & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$)
\rule[-2ex]{0pt}{5ex}\\
\hline
5 & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & D4 ($\frac{1}{2}$) &
\rule[-2ex]{0pt}{5ex}\\
\hline
6 & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$) & F4 ($\frac{1}{4}$)
\rule[-2ex]{0pt}{5ex}\\
\hline
7 & E4 ($\frac{1}{4}$) & E4 ($\frac{1}{4}$) & D4 ($\frac{1}{2}$) &
\rule[-2ex]{0pt}{5ex}\\
\hline
8 & C4 ($\frac{1}{4}$) & C4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$) & G4 ($\frac{1}{4}$)
\rule[-2ex]{0pt}{5ex}\\
\hline
9 & A4 ($\frac{1}{4}$) & A4 ($\frac{1}{4}$) & G4 ($\frac{1}{2}$) &
\rule[-2ex]{0pt}{5ex}\\
\hline
\end{tabular}
\label{table:twinkle-twinkle-little-star-notes-lengths}
\end{tabular}
\end{table}

To program this melody it is convenient to define all the required notes at the
beginning of the program as constants. Each constant will store the frequency
Expand Down

0 comments on commit a79d9ea

Please sign in to comment.