Skip to content

Instantly share code, notes, and snippets.

@matchaxnb
Last active August 4, 2025 15:04
Show Gist options
  • Save matchaxnb/14b631d27dab8f956ab47a4249aee2dc to your computer and use it in GitHub Desktop.
Save matchaxnb/14b631d27dab8f956ab47a4249aee2dc to your computer and use it in GitHub Desktop.
Sound as pure form
; i'll update this from time to time
; add this to your prelude file
; i am under the assumption that you keep the original prelude contents
\pitchLogIndex [ pitchLogIndex 2^ ] = toHz
\midinum [
; first produce a pitch log index based on C4==60
midinum 60 - ; this is the distance to C4
1/12 * C4 + ; this is the pitch log index for the note
toHz ; we convert it
] = midiToHz
; just play a major second between D and E
[62 nnhz .3 0 pulsesin .3 mum 64 nnhz .3 0 pulsesin .3 mum] cyc $/ play
; play a sequence (just d7 chord followed by M7 chord)
stop clear [[[d7 M7] @ 220 *] flat @ \pch[[(pch 0 sinosc .2 T) (.1 mum)] $/ ] ! [.3 mum] ] $/ $/ cyc play
; sequencing (the second part is note length)
stop clear [[[d7 M7] @ 220 * ] flat] @ @ [1 8 irand 8 / 1/8 2/8 1/8 1/4 1/8 1/8 1/2 1/4] \pch dur[[(pch 0 sinosc dur
T) (.1 mum)] $/ ] ! $/ $/ $/ cyc play
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment