\subsubsection{Pitch}
\seclabel{pitch}
Perhaps the most basic musical idea is that of a \keyword{pitch},
which consists of an \keyword{octave} and a \keyword{pitch class}
(i.e. one of 12 semi-tones, cf. \secref{discussion:pitch}):
\begin{haskelllisting}

>typeAbsolute=Int>typeRelative=Int>>toInt::T->Absolute>toInt(oct,pc)=12*oct+classToIntpc>>fromInt::Absolute->T>fromIntap=>let(oct,n)=divModap12>in(oct,[C,Cs,D,Ds,E,F,Fs,G,Gs,A,As,B]!!n)>>classToInt::Class->Relative>classToIntpc=casepcof>Cf->-1;C->0;Cs->1-- or should Cf be 11?>Df->1;D->2;Ds->3>Ef->3;E->4;Es->5>Ff->4;F->5;Fs->6>Gf->6;G->7;Gs->8>Af->8;A->9;As->10>Bf->10;B->11;Bs->12-- or should Bs be 0?

\end{haskelllisting}
Now two functions for parsing and formatting pitch classes
in a more human way, that is using '\#' and 'b' suffixes
instead of 's' and 'f'.
We do not simply use
\begin{haskelllisting}

>classFormat::Class->ShowS>classFormatpc=>let(p:r)=showpc>in(p:).>caserof>[]->id>'s':[]->('#':)>'f':[]->('b':)>_->error("classFormat: Pitch.Class.show must not return suffixes"++>" other than 's' and 'f'")

\end{haskelllisting}
Using \type{Pitch.Absolute} we can compute the frequency associated
with a pitch:
\begin{haskelllisting}

\end{haskelllisting}
We can also define a function \function{Pitch.transpose},
which transposes pitches
(analogous to \function{Music.transpose},
which transposes values of type \type{Music.T}):
\begin{haskelllisting}