Dear list,
I have been creating 2D and 3D oscilloscope graphics with audio signals in Pure Data for some time now. I've started digging deeper into 3D math and have found that the ability to do matrix operations at audio rate would be extremely useful.
Right now, the only option I can see is to use [matrix~] from IEMmatrix lib, and to pack my other audio vectors using [mtx_pack~] in a subpatch with [block~ 1] to get samplewise operations.
Is this the best/only way to do this? Seems like the [block~] could make it unnecessarily expensive.
Thanks! Derek
On deeper inspection: [mtx_pack~] gives the same value to an entire row, so that is not what is needed.
A practical example, a 3D rotation matrix:
1 0 0 0 0 cosR sinR 0 0 -sinR cosR 0 0 0 0 1
If [matrix~] is used to process the vectors which represent a cube, let's say, and I want the cos, sin, and -sin of the rotation angle R to be audio signals, how could I use [matrix~] to do that?
Thanks! D.
On 16/05/2018 17.43, Derek Holzer wrote:
Dear list,
I have been creating 2D and 3D oscilloscope graphics with audio signals in Pure Data for some time now. I've started digging deeper into 3D math and have found that the ability to do matrix operations at audio rate would be extremely useful.
Right now, the only option I can see is to use [matrix~] from IEMmatrix lib, and to pack my other audio vectors using [mtx_pack~] in a subpatch with [block~ 1] to get samplewise operations.
Is this the best/only way to do this? Seems like the [block~] could make it unnecessarily expensive.
Thanks! Derek
On 05/16/2018 04:56 PM, Derek Holzer wrote:
On deeper inspection: [mtx_pack~] gives the same value to an entire row,
how so? if i feed an [osc~ 440] into the first inlet of [mtx_pack~ 3] the first row will contain 64 samples of a sine wave.
If [matrix~] is used to process the vectors which represent a cube, let's say, and I want the cos, sin, and -sin of the rotation angle R to be audio signals, how could I use [matrix~] to do that?
first: [matrix~] is deprecated. you should use [mtx_*~] instead. (you should get a big fat red warning for each and every [matrix~] object you create; if you don't, you are using a version of iemmatrix that is more than 15 years old).
anyhow, what you want to do can be done without [mtx_*~], doing the matrix multiplication on paper and then building the patch discretely.
for simplicity here's a 2D version using [expr~]:
R
|
X Y [expr~ cos($v1);sin($v1)] | | | | [expr $v1*$v3+$v2*$v4; $v2*$v3-$v1*$v4] | |
gfmasrd IOhannes
OK that kind of answers my question: it would be easier to write the matrix equations out linearly since the use of the [mtx_*~] object is not immediately clear to me. Very much still learning this kind of math.
Best! D.
On 16/05/2018 19.46, IOhannes m zmölnig wrote:
On 05/16/2018 04:56 PM, Derek Holzer wrote:
On deeper inspection: [mtx_pack~] gives the same value to an entire row,
how so? if i feed an [osc~ 440] into the first inlet of [mtx_pack~ 3] the first row will contain 64 samples of a sine wave.
If [matrix~] is used to process the vectors which represent a cube, let's say, and I want the cos, sin, and -sin of the rotation angle R to be audio signals, how could I use [matrix~] to do that?
first: [matrix~] is deprecated. you should use [mtx_*~] instead. (you should get a big fat red warning for each and every [matrix~] object you create; if you don't, you are using a version of iemmatrix that is more than 15 years old).
anyhow, what you want to do can be done without [mtx_*~], doing the matrix multiplication on paper and then building the patch discretely.
for simplicity here's a 2D version using [expr~]:
R |
X Y [expr~ cos($v1);sin($v1)] | | | | [expr $v1*$v3+$v2*$v4; $v2*$v3-$v1*$v4] | |
gfmasrd IOhannes
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
how about some dynamic patching using only simple objects such as *~,
sin~, etc.? although it will be hard to set it up with the necessary
matrix models, it could be more versatile in the long run (don't know how
many different operation combinations you'll need)
OK that kind of answers my question: it would be easier to write the
matrix equations out linearly since the use of the [mtx_*~] object is
not immediately clear to me. Very much still learning this kind of math.Best! D.
On 16/05/2018 19.46, IOhannes m zmölnig wrote:
On 05/16/2018 04:56 PM, Derek Holzer wrote:
On deeper inspection: [mtx_pack~] gives the same value to an entire
row,how so? if i feed an [osc~ 440] into the first inlet of [mtx_pack~ 3] the first row will contain 64 samples of a sine wave.
If [matrix~] is used to process the vectors which represent a cube, let's say, and I want the cos, sin, and -sin of the rotation angle R to be audio signals, how could I use [matrix~] to do that?
first: [matrix~] is deprecated. you should use [mtx_*~] instead. (you should get a big fat red warning for each and every [matrix~] object you create; if you don't, you are using a version of iemmatrix that is more than 15 years old). anyhow, what you want to do can be done without [mtx_*~], doing the matrix multiplication on paper and then building the patch discretely. for simplicity here's a 2D version using [expr~]: R | X Y [expr~ cos($v1);sin($v1)] | | | | [expr $v1*$v3+$v2*$v4; $v2*$v3-$v1*$v4] | | gfmasrd IOhannes