Saturday, June 05, 2010

Polyphony and Sequencing

Chords

Now that we can use Pbinds to make sure our sounds come on time, let's look about how to order them and play more than one note at once. The easiest way to do polyphony is with arrays:

Pbind(\note, [1, 3, 5]).play

The Pbind creates a separate synth for each item in the array.

\note determines pitch as a scale degree in an equal tempered scale. It computes the frequency based on the note number and then uses that for the synth's freq argument. \note can be used with any synthdef.

While note is always equally tempered, it need not be 12-tone ET:

(
 Pbind(
  \note,    [1, 4, 7],
  \stepsPerOctave,  10
 ).play
)

By pairing \stepsPerOctave with 10, the example above gives us 10-tone ET. We could do 24 for a quatertone scale, or use whatever number we'd like.

If, for some reason, we wanted to use MIDI note numbers we could do that. We don't need to use whole numbers, but can use Floats to change the tuning.

Pbind(\midinote, 60.05).play

60.05 is middle C, 5 cents sharp.

Rests

If we want to rest for a note, we can do that by pairing the symbol \rest to any of the symbols that control pitch:

(
 Pbind(
  \dur,   0.2,
  \note,    Prand([1, 4, 7, 9, \rest], 15),
  \stepsPerOctave,  10
 ).play
)

We could also pair rest with \freq, \midinote, or \degree - which is the degree in the scale.

Ppar

If we want to play two Pbinds at the same time, just telling one to play right after the other does not guarantee that they will line up perfectly. To make sure they start in sync, we can use Ppar.

Ppar takes two arguments, a list and the number of repeats. Here's an example from the helpfile:

(
 var a, b;
 a = Pbind(\note, Pseq([7, 4, 0], 4), \dur, Pseq([1, 0.5, 1.5], inf));
 b = Pbind(\note, Pseq([5, 10, 12], 4), \dur, 1);
 Ppar([a, b ]).play;
)

a and b play exactly in time with each other.

If we don't want all the patterns to start right away, we can use Ptpar, which is the same except that the list contains pairs of times and patterns. Each time is how long to delay before starting the pattern:

(
 var a, b;
 a = Pbind(\note, Pseq([7, 4, 0], 4), \dur, Pseq([1, 0.5, 1.5], inf));
 b = Pbind(\note, Pseq([5, 10, 12], 4), \dur, 1);
 Ptpar([ 0.0, a, 1.3, b ], 2).play;
)

Pbind a starts immediately, because it's time is 0. Pbind b starts after 1.3 seconds. The whole thing repeats twice, because of the second argument to Ptpar

If, instead of playing at the same time, we wanted to play one after the other, we can put the Pbinds into a Pseq:

(
 var a, b;
 a = Pbind(\note, Pseq([7, 4, 0], 2), \dur, Pseq([1, 0.5, 1.5], inf));
 b = Pbind(\note, Pseq([5, 10, 12], 2), \dur, 1);
 Pseq([a, b ]).play;
)

And Pseqs can be passed to Ppars and Ptpars and vice versa.

Summary

  • Pairing an array with a symbol in a Pbind makes it play chords
  • \note determines pitch as a scale degree in an equal tempered scale and can be use with any synthdef.
  • \degree is the degree in the scale
  • \stepsPerOctave set the number of pitches in the scale used by \note or \degree
  • \midinote is the midinote number - in Floats
  • Pairing \rest with any of pitch-related symbols will cause a rest
  • We can start two or more Pbinds at the same time with Ppar
  • We can start two or more Pbinds with a pre-set delay between them using Ptpar
  • We can start two Pbinds sequentially by putting them in a Pseq
  • We can put Pseqs in Ppars and vice versa.

Problems

  1. Write a short A B A (refrain verse refrain) piece with a higher pitched line and a lower pitched line, with their own rythms. You can use the default synth for Pbind or one (or more) of your own.

4 comments:

Anonymous said...

Mr. Hutchins, I've used both this and your BBCut2 tutorial and both are pure gold! Thank you for your time!

Charles Céleste Hutchins said...

Note is not always equally tempered. You can use \scale and the Scale class to set not-ET scales.

I need to update this......

Anonymous said...
This comment has been removed by a blog administrator.
شركة تنظيف منازل بالخبر تنظيف مجالس0531334317 said...


شركة الاندلس لخدمات الصرف الصحى وتسليك المجارى بالدمام واحده من افضل واحسن الشركات المتخصصة فى فى حل جميع مشاكل الصرف الصحى وتسليك المجارى وشفط البيارات وتوصيل مواسير الصرف الصحى الشركة لديها فريق متكامل ومدرب على ادق وابسط الاشياء الاندلس توفر هذة الخدمة على مدار اليوم لما لها من اهمية كبيرة
شركة تسليك مجارى بالدمام
حيث ان مشكلة انسداد المواسر تسبب لدى العملاء ازعاج كبير جدا ونفور حيث الرائحة الكريهة التى تجلب الحشرات بكثرة فى يكون البيت او الشركة او الفنادق غير مؤهلة لوجود الحياة البشرية ولكن شركة الاندلس تتواجد على حل المشكلة فى اى وقت وتوفير الدعم الكامل لدى عملائها كل ما عليك الاتصال على الرقم الخاص بالشركة وناتيك فى الحال 0531334317