home/ atoms/ strudel-note-function

note() sets pitch as a MIDI number or a letter name with optional octave and accidental

The note() function assigns a pitch to each event. It accepts two interchangeable notations, which can be mixed in one pattern string: (1) integers read as MIDI note numbers (e.g. 48 = C3, 52, 55); (2) letter names with an optional accidental and octave digit (e.g. “c”, “c#3”, “eb4”). Sharps use #, flats use b, and a trailing digit selects the octave (c2 e3 g4 b5). note() is separate from sound()/s(), which selects the timbre, so the two are chained: note(“c e g”).sound(“piano”). Note that note() takes raw pitches; the related n() function combined with scale() instead interprets its numbers as scale degrees, e.g. n(“0 2 4”).scale(“C:minor”).

Examples

note(“48 52 55”) // MIDI numbers note(“c e g”).sound(“piano”) // letter names + instrument note(“c# d# f#”) // sharps note(“c2 e3 g4 b5”).sound(“piano”) // octaves n(“0 2 4”).scale(“C:minor”).sound(“piano”) // contrast: scale degrees, not raw pitch

Assessment

Write a Strudel pattern that plays a C major triad (C-E-G) with piano using letter notation, then rewrite it with MIDI note numbers. Then write a minor triad using a letter-name accidental, and rewrite that using n() and scale() as scale degrees.

“note("c e g b").sound("piano")”
“note: set pitch as number or letter”