0

I'm trying to learn how to use event patterns. I typed out the following, expecting a sequence which 'jumps down' an octave each time:

p = Pbind(*[
    instrument: \mySynth,
    midinote: Pseq([108, 96, 84, 72, 60, 48, 36, 24, 12], inf),
    dur: 0.2
]);

SynthDef(
    "mySynth",
    {
        |midinote, gate = 1|
        var stereofreq = [midinote, midinote];
        var audio = Pulse.ar(stereofreq, 0.5, mul: 0.8);
        var env = Linen.kr(gate, 0.01, 1, 0.1, doneAction: 2);
        OffsetOut.ar(0, audio * env);
    }
).add;

p.play;

I certainly get a descending sequence, but the interval is not an octave. Am I missing some detail of the midinote key?

David
  • 15,750
  • 22
  • 90
  • 150

1 Answers1

1

Yes you are missing something: the data in the midinote key is magically transformed into Hertz values in the freq key when the pattern is played. So when you write your synthdef, you shouldn't use midinote, instead use freq.

It might seem like suspicious magic, but think about it this way: you can write a SynthDef once, using freq, and thereafter you are free to use midinote or freq or degree in your patterns, and they'll all be converted, without you having to rewrite your SynthDef to use the different-named control.

To understand more about what is going on, this page is very helpful: Pattern Guide 07: Value Conversions

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30
  • I see you're also asking questions about SuperCollider. Is this the right place to go, or is there a more active forum? – David Jul 28 '13 at 22:07
  • @David: I like SO for this, but the SuperCollider mailing lists have by far the most activity: http://www.birmingham.ac.uk/facilities/BEAST/research/supercollider/mailinglist.aspx (on that page you can sign up to **sc-users**, or view the archives online etc) – Dan Stowell Jul 29 '13 at 14:19