Bruno Ruviaro added More Patterns.tex  almost 10 years ago

Commit id: 005e0cbd1f9c1e3da01d0a7b60246c971a366bcf

deletions | additions      

         

\subsection{Expanding your Pattern vocabulary}  By now you should be able to write simple \texttt{Pbind}s on your own. You know how to specify pitches, durations, amplitudes, and legato values, and you know how to embed other patterns (\texttt{Pseq}, \texttt{Prand}, \texttt{Pwhite}) to generate interesting sequences of values for these parameters.  This section will expand your Pattern vocabulary a bit. The examples below will introduce you to six more members of the Pattern family. Try to figure out by yourself what they do. Use the following strategies:  \begin{itemize}  \item Listen the resulting melody; describe and analyze what you hear;  \item Look at the Pattern name: does it suggest something? (for example, \texttt{Pshuf} may remind you of the word ``shuffle'');  \item Look at the arguments (numbers) inside the new Pattern;  \item Use \texttt{.trace.play} as seen earlier to watch the values being printed in the Post window;  \item Finally, confirm your guesses by consulting the Help files (click ``Search'' on the Help section and type in the name of the Pattern to read its description).  \end{itemize}  \lstinputlisting[style=SuperCollider-IDE, basicstyle=\scttfamily\footnotesize]{code-pattern-expand-vocabulary.scd}    Practice using these Patterns---you can do a lot with them. \texttt{Pbind}s are like a recipe for a musical score, with the advantage that you are not limited to writing fixed sequences of notes and rhythms: you can describe processes of ever changing musical parameters, like a guided improvisation, and SuperCollider will play it all for you (this is also called ``algorithmic composition''). And this is just one aspect of the powerful capabilities of the Pattern family.  In the future, when you feel the need for more pattern objects, the best place to go is James Harkins' ``A Practical Guide to Patterns,'' available in the built-in Help files.\footnote{Also online at \url{http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_02_Basic_Vocabulary.html}} We'll finish this subsection with a simple example adapted from that tutorial:    \begin{lstlisting}[style=SuperCollider-IDE, basicstyle=\scttfamily\footnotesize]  // "Flock of seagulls" example by James Harkins  (  Pbind(  \degree, Pslide([-6, -4, -2, 0, 2, 4, 6, 8, 10, 12], 8, 3, 1),  \dur, Pseq([0.1, 0.1, 0.2], inf),  \legato, 0.7  ).play;  )  \end{lstlisting}