Skip to content

scalemode

Sets gi_CurrentScale to a mode from gi_SuperScale.

Syntax

scalemode isuperscalefn, ikeyctr, i/kSuperscaleIntervalPattern[] [, idestifn]

scalemode12 ikeyctr,imode   
scalemode12 ikeyctr,Smode

scalemode31 ikeyctr,imode   
scalemode31 ikeyctr,Smode
scalemode(isuperscalefn, ikeyctr, i/kSuperscaleIntervalPattern[] [, idestifn])  

scalemode12(ikeyctr,imode)  
scalemode12(ikeyctr,Smode)

scalemode31(ikeyctr,imode)  
scalemode31(ikeyctr,Smode)

Usage

The rationale here is that gi_SuperScale represents a chromatic scale, while gi_CurrentScale represents a mode (e.g. a major scale, or dorian mode) from the super scale. Scalemode extracts a subset of scale degrees from isuperscalefn according to the intervals specified in iSuperscaleIntervalPattern. The result updates the global table gi_CurrentScale.

  • scalemode12 and scalemode31 are convenience wrappers around scalemode to quickly set some common pre-populated modes from common scales.
  • scalemode12 can be used to set major or minor in 12edo.
  • scalemode31 can be used to set a variety of scale types in 31edo.

Globals

gi_CurrentScale (default="major") -- The table holding the current mode.

gi_SuperScale (default=gi_31edo) -- The table holding the 'chromatic' scale or temperament.

giTonic_ndx (default=0) -- the key centre.


Outputs and Arguments

isuperscalefn -- A function table containing parameters suitable for the Csound cpstun opcode. Typically this is set to gi_SuperScale.

ikeyctr -- the scale degree in isuperscalefn on which to base the calculation of iSuperscaleIntervalPattern. For example, setting ikeyctr as '5' for a isuperscalefn of 31edo, will create a scale in 'D' in gi_CurrentScale.

iSuperscaleIntervalPattern -- an array specifying intervals in isuperscalefn which create the resulting mode. The sum of this array should be equal to the number of grades in isuperscalefn

idestifn (optional, default=gi_CurrentScale) -- the table number updated with the resulting scale degrees.

imode (for scalemode12) -- 0 = chromatic, 1 = major, 2 = minor.

imode (for scalemode31) -- 0 = chromatic, 1 = major, 2 = minor, 3 = major with a harmonic 7th, 4 = minor with a harmonic 7th, 5 = diminished, 6 = neutral, 7 = Orwell[9]

Smode (for scalemode12) -- Strings can specify "chromatic", "major", "minor".

Smode (for scalemode31) -- Strings can specify "chromatic", "major", "minor", "M7", "m7", "dim", "neutral", "orwell", "harmonic"

Example

scalemode.orc

nextrh
gi_SuperScale = gi12edofn ;; set our scale to 12edo.

instr Sound101
  ;; Audio source

  ares fmrhode p4,p5,15,0.01,0.31,5,-1,-1,-1,-1,-1
  ares declickr ares

send ares
endin

patchsig "Sound101", "outs"

scalemode12 0,"major"

instr Sched11
  ;; Event trigger  - a temporal recursion instrument

  imodeswitch = p6 
  if p5 % 12 == 0 then
    imodeswitch += 1
  endif
  ;; increment imodeswitch every 12 steps.

  if imodeswitch % 7 == 0 then
    scalemode gi_31edo, 3, fillarray(4,2,6,4,2,6,7)
  elseif imodeswitch % 5 == 0 then
    scalemode gi17edofn, 9, fillarray(3,3,1,3,3,2,2)
  elseif imodeswitch % 3 == 0 then
    scalemode gi12edofn, 0, fillarray(2,1,2,2,1,2,2)
  endif
  ;;; update gi_CurrentScale when the stars align.

  schedule "Sound101",0,tempodur(0.13),p4,cpstuni(mirror:i(p5,0,14), gi_CurrentScale)
  ;; trigger the audio source. 

  schedule p1, nextbeat(0.125), 1, p4, p5+1,imodeswitch
  ;; re-trigger this recursion instrument.

turnoff ; no need for a k-rate pass
endin

schedule "Sched11", 0,1,0.5,0,0 ;; launch the Event trigger instrument.