matrixscalerbasic

matrix scaler
Author:
License:
Github: phi/harmony/matrixscalerbasic.axo

Inlets

int32.positive select

Outlets

int32.bipolar o

Parameters

bool32.tgl on

int32.hradio C

int32.hradio Cis

int32.hradio D

int32.hradio Dis

int32.hradio E

int32.hradio F

int32.hradio Fis

int32.hradio G

int32.hradio Gis

int32.hradio A

int32.hradio Ais

int32.hradio B

int32 transpose

Declaration
int32_t val;
int rem;
int div;
int bang;
int oct;
int scl;
Init
val = (int32_t)(GenerateRandomNumber()) >> 4;
div = 1;
rem = 1;
oct = 0;
scl = 0;
Control Rate
int r;
if (inlet_s >= 0)
  r = ((unsigned int)inlet_s) / 12;
else
  r = -(((unsigned int)(12 - inlet_s)) / 12);
div = r;
rem = inlet_s - (r * 12);
oct = ((r * 12) - 4);

switch (rem > 0 ? rem : 0) {
case 0:
  scl = (param_C) + oct;
  break;
case 1:
  scl = (param_Cis) + oct;
  break;
case 2:
  scl = (param_D) + oct;
  break;
case 3:
  scl = (param_Dis) + oct;
  break;
case 4:
  scl = (param_E) + oct;
  break;
case 5:
  scl = (param_F) + oct;
  break;
case 6:
  scl = (param_Fis) + oct;
  break;
case 7:
  scl = (param_G) + oct;
  break;
case 8:
  scl = (param_Gis) + oct;
  break;
case 9:
  scl = (param_A) + oct;
  break;
case 10:
  scl = (param_Ais) + oct;
  break;
case 11:
  scl = (param_B) + oct;
  break;
default:
  scl = (param_C) + oct;
  break;
}
outlet_o = (param_on) ? scl + param_transpose : inlet_s;

Privacy

© 2024 Zrna Research