scaleTemp7

46-scale scaling and 137-temperaments module, but with a 1-key per note response like the factory harmony module This module contains 4 scalers in one to be able to control 4 oscillators at the same time in the same scaling, saves up a bit of memory and tidies up the patch. Add the "scale7bank" module to provide the module the scale-list. (Before first use, add the scale7generator once to create the list and auto-save it to the SD-card, the scale7bank then uses this file. If you don't have a SD-card, you can use the generator module and refer to that module)
Author: Remco van der Most
License: BSD
Github: sss/harmony/scaleTemp7.axo

Inlets

frac32 stretch

bool32 track

int32 p1

int32 p2

int32 p3

int32 p4

int32 key

int32 scale

int32 temper

Outlets

frac32 n1

frac32 n2

frac32 n3

frac32 n4

Attributes

objref scale

Declaration
int32_t out;
int key;
int scale;
int32_t STR;
int32_t temper;
int32_t N[4];
int32_t scalar(int NT) {
  int32_t pitch = NT + 64;
  int32_t octave = pitch / 7;
  int semitone = pitch - octave * 7;
  int32_t note = (attr_scale.note[semitone + scale] + octave * 12) - 112 + key
                 << 21;

  int mn = (note + (1 << 20) >> 21) + 8;
  int32_t stretch = mn / 12;
  stretch = stretch * (STR / 1000);
  int oct = mn / 12 * 12;
  oct = note < 0 ? oct - 12 : oct;
  mn = mn - oct;
  int tmpr = temper;
  tmpr = tmpr - tmpr / 137 * 137;
  tmpr += tmpr < 0 ? 137 : 0;
  tmpr = tmpr * 12;
  return out = attr_scale.TMPR[mn + tmpr] * 0 + note + stretch;
};
Init
N[0] = 0;
N[1] = 0;
N[2] = 0;
N[3] = 0;
Control Rate
scale = inlet_scale;
scale = scale - scale / 46 * 46;
scale = scale < 0 ? scale + 46 : scale;
scale = scale * 7;

key = (inlet_key)*5 - 4;
key = key - (key / 12) * 12;
key = key < 0 ? key + 12 : key;
temper = inlet_temper;
STR = inlet_stretch;
if (inlet_track > 0) {
  N[0] = scalar(inlet_p1);
  N[1] = scalar(inlet_p2);
  N[2] = scalar(inlet_p3);
  N[3] = scalar(inlet_p4);
}

outlet_n1 = N[0];
outlet_n2 = N[1];
outlet_n3 = N[2];
outlet_n4 = N[3];

Privacy

© 2024 Zrna Research