Select Modes of the Circular Membrane

Hey, i have this 2D array with the different Modes of a Circular Membrane to be used for additive or modal synthesis. The modes in the upper left corner for example ~jn_zeros[0][1] are more important compared to for example ~jn_zeros[7][8]. So i would like to know if there could be a function for selecting the different items across the subarrays, to control the density of the spectrum. maybe better visualized:

i know that there are even fancier things where one could use the 2D freqs Array together with a 2D Array for the amplitudes and a position parameter for simulating the different timbres of the membrane. but im fine right now with just selecting some modes / partials from the freqs Array and see how it sounds. thanks alot :slight_smile:

// Modes of the Circular Membrane

~jn_zeros = [
	[1.0, 2.295417267427694, 3.5984846739581138, 4.903280573212368, 6.208732130572546, 7.514500962483965, 8.820447105611922, 10.126502295693772, 11.432629299891353, 12.738806093605008],

	[1.593340505695112, 2.9172954551172228, 4.230439127905234, 5.5403985098530635, 6.848991602808508, 8.1568737689496, 9.464339027734203, 10.77153891878896, 12.078559478862408, 13.385453180985621],

	[2.1355487866494034, 3.5001474903090264, 4.831885262930598, 6.152609171589257, 7.468242109085181, 8.781093075730398, 10.092254814868133, 11.402312929615599, 12.711609953449942, 14.020359772593565],

	[2.6530664045492145, 4.058931883331434, 5.412118429982582, 6.746213299505839, 8.071028338967128, 9.390589484063241, 10.706875023386747, 12.020976194473256, 13.333546087983708, 14.645000185525108],

	[3.155464815408362, 4.6010445344331075, 5.976540221648715, 7.325257332462771, 8.66047555520746, 9.98784275554081, 11.310212368186301, 12.6291936518746, 13.945767336219362, 15.260566826272614],

	[3.6474511791052775, 5.1307689067016575, 6.528612451522295, 7.892520026843893, 9.238840557670077, 10.574713443493692, 11.903823217314876, 13.228284530761863, 14.549405125286688, 15.868040174411112],

	[4.131738159726707, 5.650842376925684, 7.0707081490386905, 8.45000551018646, 9.807815107462856, 11.152639282954734, 12.48894011894477, 13.819314942198952, 15.145389465652915, 16.4682379099555],

	[4.610051645437306, 6.1631367313038865, 7.604536126938166, 8.999214496283312, 10.368705458854519, 11.722758172320448, 13.066558649839825, 14.40316086180383, 15.734495694194743, 17.061850311878718],

	[5.083567173877822, 6.668996900654446, 8.131374173240902, 9.541304590034361, 10.922544696482962, 12.285988718162267, 13.637496463055456, 14.980552310159315, 16.317378143958635, 17.649466343804967],

	[5.5531264771782425, 7.169426625276353, 8.652206694443466, 10.077190497330994, 11.470166256051801, 12.84308496674913, 14.202434689932657, 15.552105165163068, 16.89459494845585, 18.23159325633044]
];

If I understand correctly, you are trying to select a subset of rows and columns from this 2D array? If that is the case you could do something like this:

(// select values from the top left corner:
var n = 5; // get a 5x5 subset
~subset = n.collect{|row|
    n.collect{|col|
        ~jn_zeros[row][col]
    }
}
)

(// select values from specific rows and columns:
var rows = [0, 1, 3, 5, 6];
var cols = [0, 2, 4, 6, 8];
~subset = rows.collect{|row|
    cols.collect{|col|
        ~jn_zeros[row][col]
    }
}
)

I think there are more elegant ways of getting Array2D slices like you mentioned, but I’ve never used Array2D. There is also the Matrix class in the MathLib quark if you need to do other matrix operations (like matrix multiplication).

check out the slice method

https://doc.sccode.org/Guides/J-concepts-in-SC.html

(lots of other cool multi-dimensional matrix stuff too)

1 Like

thank you very much i will try these out :slight_smile:

some side question: should the new collection of items then be sorted, when using a -3db spectral tilt for the amps?

EDIT: ive thought about this question another time and think they should not be sorted to mimic the freqs/amplitudes of the membrane.

A nice summary from our own Nathan Ho Exploring Modal Synthesis | Nathan Ho

2 Likes

hey, thanks a lot. ive read it already and implemented most of the formulas :slight_smile: