Skip to content

why matrix needs to have a numerical value? #132

@telephon

Description

@telephon

Let's relax the constraint in the Matrix class (MathLib) that values must be numbers:

// just this commenting out
put { arg row, col, val;
		super.at(row).put(col, val)
		/*if( val.isNumber,{
			super.at(row).put(col, val)
		},{
			error("not a number in Matrix-put");this.halt
		});*/
	// put an Array of elements
	}

I can write the following, and to my impression it works correctly.

// prepare
~decoder = FoaDecoderKernel.newUHJ;


(

Ndef(\foa_scene, {
	var sound, angle, azimuth, bformat;
	sound = Decay.ar(Impulse.ar(2.3), 0.05, PinkNoise.ar(1));
	// azimuth -> hard left     = back
    //          centre     = centre
    //          hard right     = back
	azimuth = MouseX.kr(-pi, pi);
	// angle ---> top         = push to plane wave
    //            bottom        = omni-directional
	angle = MouseY.kr(pi/2, 0);
	bformat = FoaEncode.ar(sound, FoaEncoderMatrix.newDirection(azimuth, angle));
});

Ndef(\foa_transformer, {
	var in = Ndef.ar(\foa_scene);
	in // for now, just play out the b-format input
});


Ndef(\foa_decoder, {
	var in = Ndef.ar(\foa_transformer);
	var sound = FoaDecode.ar(in, ~decoder);
	Limiter.ar(sound)
});

Ndef(\foa_decoder).play
);

Should we relax the constraint? Since sclang automatically lifts math operations to UGens, it seems overly narrow.

EDIT: I've made a ticklist for methods that work with UGens, Arrays, and Functions as matrix entries, from inspecting the code. See: supercollider-quarks/MathLib#38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions