[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Yet Another clone of DX7



Hi Marigold,

1 - You need to determine which directories SC checks to load the libraries.

Under macOS, the default user directory is: ~/Library/Application Support/SuperCollider/Extensions/
You can have more info at this address: http://doc.sccode.org/Guides/UsingExtensions.html

2 - Now, you can copy the files produced by the FAUST compiler to this directory.

3 - In the same place, copy the faustDX7preset.sc file (in attachment).

4 - Start SC IDE and try the following examples...

Best,

Sébastien

//////////////////////////////////////////////////////////////////////////////////
// Load a DX7 preset file
b = FaustDX7preset((PathName(thisProcess.nowExecutingPath).pathOnly)++"DX7roms/Bass/BASS001.SYX")

// Or load a DX7 presets folder
b = FaustDX7preset((PathName(thisProcess.nowExecutingPath).pathOnly)++"DX7roms")


// You can see the presets infos like that
b.bank
b.bank.size
b.bank[20]
b.bank[20].family
b.bank[20].name
b.loadArgs(20)




// Load the synthesizer definition and execute it with a preset number

d = Synth(\faustDX7, b.loadArgs(0))

d.release(1)


(
fork{
var d = Synth(\faustDX7,
[\freq, rrand(80, 3000), \amp,0.15] ++ b.loadArgs(b.bank.size.rand));
rrand(1,3).wait; d.release(1)
})



// Pattern
(
p = Pbindf(b.pBind(20),
\instrument, \faustDX7,
\freq, Pwhite(80, 1000, 10),
\dur, 0.5
).play;
)

p.stop;



(
SynthDef(\faustDX7, { arg out=0,
freq=440, amp=0.5, gate=1, bend=1, algorithm=8,feedback=6,

opmode_0=0,opfreq_0=0.5,opdetune_0=1,opratescale_0=4,egr1_0=65,egr2_0=99,egr3_0=99,egr4_0=41,egl1_0=99,egl2_0=99,egl3_0=99,egl4_0=0,level_0=88,keyvelsens_0=0,

opmode_1=0,opfreq_1=0.5,opdetune_1=8,opratescale_1=3,egr1_1=50,egr2_1=26,egr3_1=9,egr4_1=42,egl1_1=94,egl2_1=99,egl3_1=93,egl4_1=0,level_1=85,keyvelsens_1=0,

opmode_2=0,opfreq_2=0.5,opdetune_2=8,opratescale_2=7,egr1_2=64,egr2_2=40,egr3_2=23,egr4_2=42,egl1_2=99,egl2_2=97,egl3_2=94,egl4_2=0,level_2=88,keyvelsens_2=0,

opmode_3=0,opfreq_3=0.5,opdetune_3=9,opratescale_3=6,egr1_3=70,egr2_3=27,egr3_3=16,egr4_3=49,egl1_3=90,egl2_3=99,egl3_3=91,egl4_3=0,level_3=80,keyvelsens_3=0,

opmode_4=0,opfreq_4=0.5,opdetune_4=1,opratescale_4=3,egr1_4=70,egr2_4=27,egr3_4=16,egr4_4=49,egl1_4=90,egl2_4=99,egl3_4=91,egl4_4=0,level_4=73,keyvelsens_4=0,

opmode_5=0,opfreq_5=2,opdetune_5=1,opratescale_5=3,egr1_5=70,egr2_5=27,egr3_5=16,egr4_5=49,egl1_5=90,egl2_5=99,egl3_5=91,egl4_5=0,level_5=89,keyvelsens_5=0;


var sig, env;


sig = FaustDX7.ar(

freq_5:freq, gain_5:amp, gate_5:1, bend_5:bend, algorithm_5:algorithm, feedback_5:feedback,

opmode_0: opmode_0,opfreq_0: opfreq_0,opdetune_0: opdetune_0,opratescale_0: opratescale_0,egr1_0: egr1_0,egr2_0: egr2_0,egr3_0: egr3_0,egr4_0: egr4_0,egl1_0: egl1_0,egl2_0: egl2_0,egl3_0: egl3_0,egl4_0: egl4_0,level_0: level_0,keyvelsens_0: keyvelsens_0,

opmode_1: opmode_1,opfreq_1: opfreq_1,opdetune_1: opdetune_1,opratescale_1: opratescale_1,egr1_1: egr1_1,egr2_1: egr2_1,egr3_1: egr3_1,egr4_1: egr4_1,egl1_1: egl1_1,egl2_1: egl2_1,egl3_1: egl3_1,egl4_1: egl4_1,level_1: level_1,keyvelsens_1: keyvelsens_1,

opmode_2: opmode_2,opfreq_2: opfreq_2,opdetune_2: opdetune_2,opratescale_2: opratescale_2,egr1_2: egr1_2,egr2_2: egr2_2,egr3_2: egr3_2,egr4_2: egr4_2,egl1_2: egl1_2,egl2_2: egl2_2,egl3_2: egl3_2,egl4_2: egl4_2,level_2: level_2,keyvelsens_2: keyvelsens_2,

opmode_3: opmode_3,opfreq_3: opfreq_3,opdetune_3: opdetune_3,opratescale_3: opratescale_3,egr1_3: egr1_3,egr2_3: egr2_3,egr3_3: egr3_3,egr4_3: egr4_3,egl1_3: egl1_3,egl2_3: egl2_3,egl3_3: egl3_3,egl4_3: egl4_3,level_3: level_3,keyvelsens_3: keyvelsens_3,

opmode_4: opmode_4,opfreq_4: opfreq_4,opdetune_4: opdetune_4,opratescale_4: opratescale_4,egr1_4: egr1_4,egr2_4: egr2_4,egr3_4: egr3_4,egr4_4: egr4_4,egl1_4: egl1_4,egl2_4: egl2_4,egl3_4: egl3_4,egl4_4: egl4_4,level_4: level_4,keyvelsens_4: keyvelsens_4,

opmode_5: opmode_5,opfreq_5: opfreq_5,opdetune_5: opdetune_5,opratescale_5: opratescale_5,egr1_5: egr1_5,egr2_5: egr2_5,egr3_5: egr3_5,egr4_5: egr4_5,egl1_5: egl1_5,egl2_5: egl2_5,egl3_5: egl3_5,egl4_5: egl4_5,level_5: level_5,keyvelsens_5: keyvelsens_5);

env = EnvGen.kr(Env.asr(0.01,amp,0.1), gate, doneAction:2);

Out.ar(out, Pan2.ar(sig, 0) * env);
}).add;
)



Le 06/12/2018 à 22:48, Marigold Maripol a écrit :
Hi Sebastien-
Thank you for making this interesting addition to SC. I was hoping, if
you wouldn't mind, helping me to understand how to import it. I
brought the dsp file into the Faust Online Compiler, for use with
SuperCollider/MacOS - but I'm not sure to do with the code that it has
now given to me.
Thanks,
M
On Tue, Aug 14, 2018 at 12:47 PM <sebastienclara@xxxxxxxxxx> wrote:
Hi list,

As an attachment, you can find the SC Faust DX7 extension !

FaustDX7 is experimental and it is incomplete :'(

But with FaustDX7preset lib, you can load SYX files :)


In the archive, FaustDX7 extension is compiled to work under Linux and
for my test, I use SC 3.9.3.

If you are on another platform, use the Faust source code (.dsp) to
compile your extension.

You can do that with the Faust Online Compiler :
http://faust.grame.fr/onlinecompiler/

Enjoy !

Sébastien


    
/*
by Sébastien Clara
v-20181117

Typical user-specific extensions directories:
macOS	~/Library/Application Support/SuperCollider/Extensions/
Linux	~/.local/share/SuperCollider/Extensions/
*/

FaustDX7preset {
	var freqTableCoarse, freqTableFine;

	var <bank;




	*new {  arg folder;
		^super.new.init(folder)
	}




	init { arg folder;

		// Table from d72csound
		freqTableCoarse = [
			[0.5,1,2,3,4,5,6,7,8,9,10,11,12,13,
				14,15,16,17,18,19,20,21,22,23,24,
				25,26,27,28,29,30,31],
			[1,10,100,1000,1,10,100,1000,1,10,
				100,1000,1,10,100,1000,1,10,100,
				1000,1,10,100,1000,1,10,100,1000,
				1,10,100,1000]
		];

		// Table from d72csound
		freqTableFine = [
			[1.00,1.01,1.02,1.03,1.04,1.05,1.06,
				1.07,1.08,1.09,1.10,1.11,1.12,1.13,
				1.14,1.15,1.16,1.17,1.18,1.19,1.20,
				1.21,1.22,1.23,1.24,1.25,1.26,1.27,
				1.28,1.29,1.30,1.31,1.32,1.33,1.34,
				1.35,1.36,1.37,1.38,1.39,1.40,1.41,
				1.42,1.43,1.44,1.45,1.46,1.47,1.48,
				1.49,1.50,1.51,1.52,1.53,1.54,1.55,
				1.56,1.57,1.58,1.59,1.60,1.61,1.62,
				1.63,1.64,1.65,1.66,1.67,1.68,1.69,
				1.70,1.71,1.72,1.73,1.74,1.75,1.76,
				1.77,1.78,1.79,1.80,1.81,1.82,1.83,
				1.84,1.85,1.86,1.87,1.88,1.89,1.90,
				1.91,1.92,1.93,1.94,1.95,1.96,1.97,
				1.98,1.99],
			[1.000,1.023,1.047,1.072,1.096,1.122,
				1.148,1.175,1.202,1.230,1.259,1.288,
				1.318,1.349,1.380,1.413,1.445,1.479,
				1.514,1.549,1.585,1.622,1.660,1.698,
				1.738,1.778,1.820,1.862,1.905,1.950,
				1.995,2.042,2.089,2.138,2.188,2.239,
				2.291,2.344,2.399,2.455,2.512,2.570,
				2.630,2.692,2.716,2.818,2.884,2.951,
				3.020,3.090,3.162,3.236,3.311,3.388,
				3.467,3.548,3.631,3.715,3.802,3.890,
				3.981,4.074,4.169,4.266,4.365,4.467,
				4.571,4.677,4.786,4.898,5.012,5.129,
				5.248,5.370,5.495,5.623,5.754,5.888,
				6.026,6.166,6.310,6.457,6.607,6.761,
				6.918,7.079,7.244,7.413,7.586,7.762,
				7.943,8.128,8.318,8.511,8.718,8.913,
				9.120,9.333,9.550,9.772]
		];


		bank = List.new;

		if(PathName(folder).isFile &&
			(PathName(folder).extension=="syx" || PathName(folder).extension=="SYX"), {
			this.prInBank(folder);
		}, {
			this.prLoadSYX(folder);
		})
	}




	loadArgs {|presetNum|
		^[
			algorithm_5: bank[presetNum%bank.size].algorithm,
			feedback_5: bank[presetNum%bank.size].feedback,

			opmode_0: bank[presetNum%bank.size].opMode[0],
			opfreq_0: bank[presetNum%bank.size].opFreq[0],
			opdetune_0: bank[presetNum%bank.size].detune[0],
			opratescale_0: bank[presetNum%bank.size].scaleRate[0],
			egr1_0:  bank[presetNum%bank.size].opEgR1[0],
			egr2_0:  bank[presetNum%bank.size].opEgR2[0],
			egr3_0:  bank[presetNum%bank.size].opEgR3[0],
			egr4_0:  bank[presetNum%bank.size].opEgR4[0],
			egl1_0: bank[presetNum%bank.size].opEgL1[0],
			egl2_0: bank[presetNum%bank.size].opEgL2[0],
			egl3_0: bank[presetNum%bank.size].opEgL3[0],
			egl4_0: bank[presetNum%bank.size].opEgL4[0],
			level_0: bank[presetNum%bank.size].level[0],
			keyvelsens_0: bank[presetNum%bank.size].velocitySens[0],


			opmode_1: bank[presetNum%bank.size].opMode[1],
			opfreq_1: bank[presetNum%bank.size].opFreq[1],
			opdetune_1: bank[presetNum%bank.size].detune[1],
			opratescale_1: bank[presetNum%bank.size].scaleRate[1],
			egr1_1:  bank[presetNum%bank.size].opEgR1[1],
			egr2_1:  bank[presetNum%bank.size].opEgR2[1],
			egr3_1:  bank[presetNum%bank.size].opEgR3[1],
			egr4_1:  bank[presetNum%bank.size].opEgR4[1],
			egl1_1: bank[presetNum%bank.size].opEgL1[1],
			egl2_1: bank[presetNum%bank.size].opEgL2[1],
			egl3_1: bank[presetNum%bank.size].opEgL3[1],
			egl4_1: bank[presetNum%bank.size].opEgL4[1],
			level_1: bank[presetNum%bank.size].level[1],
			keyvelsens_1: bank[presetNum%bank.size].velocitySens[1],

			opmode_2: bank[presetNum%bank.size].opMode[2],
			opfreq_2: bank[presetNum%bank.size].opFreq[2],
			opdetune_2: bank[presetNum%bank.size].detune[2],
			opratescale_2: bank[presetNum%bank.size].scaleRate[2],
			egr1_2:  bank[presetNum%bank.size].opEgR1[2],
			egr2_2:  bank[presetNum%bank.size].opEgR2[2],
			egr3_2:  bank[presetNum%bank.size].opEgR3[2],
			egr4_2:  bank[presetNum%bank.size].opEgR4[2],
			egl1_2: bank[presetNum%bank.size].opEgL1[2],
			egl2_2: bank[presetNum%bank.size].opEgL2[2],
			egl3_2: bank[presetNum%bank.size].opEgL3[2],
			egl4_2: bank[presetNum%bank.size].opEgL4[2],
			level_2: bank[presetNum%bank.size].level[2],
			keyvelsens_2: bank[presetNum%bank.size].velocitySens[2],


			opmode_3: bank[presetNum%bank.size].opMode[3],
			opfreq_3: bank[presetNum%bank.size].opFreq[3],
			opdetune_3: bank[presetNum%bank.size].detune[3],
			opratescale_3: bank[presetNum%bank.size].scaleRate[3],
			egr1_3:  bank[presetNum%bank.size].opEgR1[3],
			egr2_3:  bank[presetNum%bank.size].opEgR2[3],
			egr3_3:  bank[presetNum%bank.size].opEgR3[3],
			egr4_3:  bank[presetNum%bank.size].opEgR4[3],
			egl1_3: bank[presetNum%bank.size].opEgL1[3],
			egl2_3: bank[presetNum%bank.size].opEgL2[3],
			egl3_3: bank[presetNum%bank.size].opEgL3[3],
			egl4_3: bank[presetNum%bank.size].opEgL4[3],
			level_3: bank[presetNum%bank.size].level[3],
			keyvelsens_3: bank[presetNum%bank.size].velocitySens[3],


			opmode_4: bank[presetNum%bank.size].opMode[4],
			opfreq_4: bank[presetNum%bank.size].opFreq[4],
			opdetune_4: bank[presetNum%bank.size].detune[4],
			opratescale_4: bank[presetNum%bank.size].scaleRate[4],
			egr1_4:  bank[presetNum%bank.size].opEgR1[4],
			egr2_4:  bank[presetNum%bank.size].opEgR2[4],
			egr3_4:  bank[presetNum%bank.size].opEgR3[4],
			egr4_4:  bank[presetNum%bank.size].opEgR4[4],
			egl1_4: bank[presetNum%bank.size].opEgL1[4],
			egl2_4: bank[presetNum%bank.size].opEgL2[4],
			egl3_4: bank[presetNum%bank.size].opEgL3[4],
			egl4_4: bank[presetNum%bank.size].opEgL4[4],
			level_4: bank[presetNum%bank.size].level[4],
			keyvelsens_4: bank[presetNum%bank.size].velocitySens[4],

			opmode_5: bank[presetNum%bank.size].opMode[5],
			opfreq_5: bank[presetNum%bank.size].opFreq[5],
			opdetune_5: bank[presetNum%bank.size].detune[5],
			opratescale_5: bank[presetNum%bank.size].scaleRate[5],
			egr1_5:  bank[presetNum%bank.size].opEgR1[5],
			egr2_5:  bank[presetNum%bank.size].opEgR2[5],
			egr3_5:  bank[presetNum%bank.size].opEgR3[5],
			egr4_5:  bank[presetNum%bank.size].opEgR4[5],
			egl1_5: bank[presetNum%bank.size].opEgL1[5],
			egl2_5: bank[presetNum%bank.size].opEgL2[5],
			egl3_5: bank[presetNum%bank.size].opEgL3[5],
			egl4_5: bank[presetNum%bank.size].opEgL4[5],
			level_5: bank[presetNum%bank.size].level[5],
			keyvelsens_5: bank[presetNum%bank.size].velocitySens[5]
		]

	}

	pBind {|presetNum|
		^Pbind(
			\algorithm_5, bank[presetNum%bank.size].algorithm,
			\feedback_5, bank[presetNum%bank.size].feedback,

			\opmode_0, bank[presetNum%bank.size].opMode[0],
			\opfreq_0, bank[presetNum%bank.size].opFreq[0],
			\opdetune_0, bank[presetNum%bank.size].detune[0],
			\opratescale_0, bank[presetNum%bank.size].scaleRate[0],
			\egr1_0,  bank[presetNum%bank.size].opEgR1[0],
			\egr2_0,  bank[presetNum%bank.size].opEgR2[0],
			\egr3_0,  bank[presetNum%bank.size].opEgR3[0],
			\egr4_0,  bank[presetNum%bank.size].opEgR4[0],
			\egl1_0, bank[presetNum%bank.size].opEgL1[0],
			\egl2_0, bank[presetNum%bank.size].opEgL2[0],
			\egl3_0, bank[presetNum%bank.size].opEgL3[0],
			\egl4_0, bank[presetNum%bank.size].opEgL4[0],
			\level_0, bank[presetNum%bank.size].level[0],
			\keyvelsens_0, bank[presetNum%bank.size].velocitySens[0],

			\opmode_1, bank[presetNum%bank.size].opMode[1],
			\opfreq_1, bank[presetNum%bank.size].opFreq[1],
			\opdetune_1, bank[presetNum%bank.size].detune[1],
			\opratescale_1, bank[presetNum%bank.size].scaleRate[1],
			\egr1_1,  bank[presetNum%bank.size].opEgR1[1],
			\egr2_1,  bank[presetNum%bank.size].opEgR2[1],
			\egr3_1,  bank[presetNum%bank.size].opEgR3[1],
			\egr4_1,  bank[presetNum%bank.size].opEgR4[1],
			\egl1_1, bank[presetNum%bank.size].opEgL1[1],
			\egl2_1, bank[presetNum%bank.size].opEgL2[1],
			\egl3_1, bank[presetNum%bank.size].opEgL3[1],
			\egl4_1, bank[presetNum%bank.size].opEgL4[1],
			\level_1, bank[presetNum%bank.size].level[1],
			\keyvelsens_1, bank[presetNum%bank.size].velocitySens[1],

			\opmode_2, bank[presetNum%bank.size].opMode[2],
			\opfreq_2, bank[presetNum%bank.size].opFreq[2],
			\opdetune_2, bank[presetNum%bank.size].detune[2],
			\opratescale_2, bank[presetNum%bank.size].scaleRate[2],
			\egr1_2,  bank[presetNum%bank.size].opEgR1[2],
			\egr2_2,  bank[presetNum%bank.size].opEgR2[2],
			\egr3_2,  bank[presetNum%bank.size].opEgR3[2],
			\egr4_2,  bank[presetNum%bank.size].opEgR4[2],
			\egl1_2, bank[presetNum%bank.size].opEgL1[2],
			\egl2_2, bank[presetNum%bank.size].opEgL2[2],
			\egl3_2, bank[presetNum%bank.size].opEgL3[2],
			\egl4_2, bank[presetNum%bank.size].opEgL4[2],
			\level_2, bank[presetNum%bank.size].level[2],
			\keyvelsens_2, bank[presetNum%bank.size].velocitySens[2],

			\opmode_3, bank[presetNum%bank.size].opMode[3],
			\opfreq_3, bank[presetNum%bank.size].opFreq[3],
			\opdetune_3, bank[presetNum%bank.size].detune[3],
			\opratescale_3, bank[presetNum%bank.size].scaleRate[3],
			\egr1_3,  bank[presetNum%bank.size].opEgR1[3],
			\egr2_3,  bank[presetNum%bank.size].opEgR2[3],
			\egr3_3,  bank[presetNum%bank.size].opEgR3[3],
			\egr4_3,  bank[presetNum%bank.size].opEgR4[3],
			\egl1_3, bank[presetNum%bank.size].opEgL1[3],
			\egl2_3, bank[presetNum%bank.size].opEgL2[3],
			\egl3_3, bank[presetNum%bank.size].opEgL3[3],
			\egl4_3, bank[presetNum%bank.size].opEgL4[3],
			\level_3, bank[presetNum%bank.size].level[3],
			\keyvelsens_3, bank[presetNum%bank.size].velocitySens[3],

			\opmode_4, bank[presetNum%bank.size].opMode[4],
			\opfreq_4, bank[presetNum%bank.size].opFreq[4],
			\opdetune_4, bank[presetNum%bank.size].detune[4],
			\opratescale_4, bank[presetNum%bank.size].scaleRate[4],
			\egr1_4,  bank[presetNum%bank.size].opEgR1[4],
			\egr2_4,  bank[presetNum%bank.size].opEgR2[4],
			\egr3_4,  bank[presetNum%bank.size].opEgR3[4],
			\egr4_4,  bank[presetNum%bank.size].opEgR4[4],
			\egl1_4, bank[presetNum%bank.size].opEgL1[4],
			\egl2_4, bank[presetNum%bank.size].opEgL2[4],
			\egl3_4, bank[presetNum%bank.size].opEgL3[4],
			\egl4_4, bank[presetNum%bank.size].opEgL4[4],
			\level_4, bank[presetNum%bank.size].level[4],
			\keyvelsens_4, bank[presetNum%bank.size].velocitySens[4],

			\opmode_5, bank[presetNum%bank.size].opMode[5],
			\opfreq_5, bank[presetNum%bank.size].opFreq[5],
			\opdetune_5, bank[presetNum%bank.size].detune[5],
			\opratescale_5, bank[presetNum%bank.size].scaleRate[5],
			\egr1_5,  bank[presetNum%bank.size].opEgR1[5],
			\egr2_5,  bank[presetNum%bank.size].opEgR2[5],
			\egr3_5,  bank[presetNum%bank.size].opEgR3[5],
			\egr4_5,  bank[presetNum%bank.size].opEgR4[5],
			\egl1_5, bank[presetNum%bank.size].opEgL1[5],
			\egl2_5, bank[presetNum%bank.size].opEgL2[5],
			\egl3_5, bank[presetNum%bank.size].opEgL3[5],
			\egl4_5, bank[presetNum%bank.size].opEgL4[5],
			\level_5, bank[presetNum%bank.size].level[5],
			\keyvelsens_5, bank[presetNum%bank.size].velocitySens[5]
		)

	}


	prLoadSYX { |path|
		if(PathName(path).folders.isEmpty, {
			PathName(path).files.collect({|i|
				if(i.extension=="syx" || i.extension=="SYX", {
					this.prInBank(i.asAbsolutePath);
				});
			}).flat;
		}, {
			PathName(path).folders.collect({|i|
				this.prLoadSYX(i.pathOnly);
			}).flat;
		})
	}




	prInBank {|filename|
		var presetFile = File(filename,"r");


		//Read header
		6.do({presetFile.getInt8});

		// Parsing presets and converting them
		// preset file always contain 32 voices
		bank = bank ++ 32.collect({
			this.prConvertPreset(presetFile,
			PathName(filename).fileNameWithoutExtension)
		}).reject({|i| i.isNil});

		presetFile.close;
	}




	prConvertPreset {|presetFile, family|
		var presetName;
		var operators = [];
		var global;

		operators = 6.collect({
			17.collect({presetFile.getInt8})
		});

		global = 16.collect({presetFile.getInt8});

		presetName = this.prFormatName(10.collect({presetFile.getInt8}));

		// (family ++ " > " ++ presetName).postln;


		if(global.any({|i| i.isNil}), { ^nil });

		if(operators.any({|i| i.isNil}), { ^nil });

		if(presetName.isNil, { ^nil });



		^(
			family: family,
			name: presetName,
			opEgR1: this.prOperatorsDistrib(operators, 0),
			opEgR2: this.prOperatorsDistrib(operators, 1),
			opEgR3: this.prOperatorsDistrib(operators, 2),
			opEgR4: this.prOperatorsDistrib(operators, 3),
			opEgL1: this.prOperatorsDistrib(operators, 4),
			opEgL2: this.prOperatorsDistrib(operators, 5),
			opEgL3: this.prOperatorsDistrib(operators, 6),
			opEgL4: this.prOperatorsDistrib(operators, 7),
			scaleBreakpoint: this.prOperatorsDistrib(operators, 8),
			scaleDepthL: this.prOperatorsDistrib(operators, 9),
			scaleDepthR: this.prOperatorsDistrib(operators, 10),
			scaleCurveL: this.prOperatorsDistrib(operators, 11) & 3, //2
			scaleCurveR: this.prOperatorsDistrib(operators, 11) >> 2, //6
			scaleRate: this.prOperatorsDistrib(operators, 12) & 7, //3
			detune: (this.prOperatorsDistrib(operators, 12) >> 3) & -7, //5 //range 0 to 14
			lfoAmpModSens: this.prOperatorsDistrib(operators, 13) & 3, //2
			velocitySens: this.prOperatorsDistrib(operators, 13) >> 2, //6
			level: this.prOperatorsDistrib(operators, 14),
			opMode: this.prOperatorsDistrib(operators, 15) & 1, //1
			freqCoarse: this.prOperatorsDistrib(operators, 15) >> 1, //7
			freqFine: this.prOperatorsDistrib(operators, 16),
			opFreq: this.prComputedopFreq(
				this.prOperatorsDistrib(operators, 15) & 1, //1
				this.prOperatorsDistrib(operators, 15) >> 1, //7
				this.prOperatorsDistrib(operators, 16)),

			pEgR1: global[0],
			pEgR2: global[1],
			pEgR3: global[2],
			pEgR4: global[3],
			pEgL1: global[4],
			pEgL2: global[5],
			pEgL3: global[6],
			pEgL4: global[7],
			algorithm: global[8],
			feedback:  global[9] & 7, //3
			keySync:   global[9] >> 3, //5
			lfoSpeed:  global[10],
			lfoDelay:  global[11],
			lfoPitchModDepth: global[12],
			lfoAmpModDepth: global[13],
			lfoPitchModSens: global[14] & 1, //1
			lfoWaveform: (global[14] >> 1) & 7, //3
			lfoSync:   global[14] >> 4, //4
			transpose: global[15]
		)
	}



	prFormatName { |name|
		var tmp;

		if(name.any({|i| i.isNil}), {
			^nil
		}, {
			// ^name.select({|i| (i >= 48) && (i <= 122) }).asAscii;
			name.select({|i| (i >= 48) && (i <= 122) })
			.do({|i| tmp = tmp ++ i.asAscii});
			^tmp
		})
	}


	prOperatorsDistrib  {|array, index|
		var output=[];

		for(5, 0, {|i| output = output.add(array[i][index])});

		^output
	}





	prComputedopFreq {|mode, coarse, fine|
		var modCoarse = freqTableCoarse.flat.size/freqTableCoarse.size;
		var modFine = freqTableFine.flat.size/freqTableFine.size;

		^mode.size.collect({|i|
			freqTableCoarse[mode[i]%modCoarse][coarse[i]%modCoarse]
			* freqTableFine[mode[i]%modFine][fine[i]%modFine]
		})
	}

}