Forums > Jitter

[Newbie] 2D matrix to 1D matrix ?

August 2, 2008 | 4:20 pm

Hi,
What would be the most simple and efficient way to convert "[jit.matrix 4 char 1200 700]" to : "[jit.matrix 4 float32 840000 1]" ? (1200*700=840000)

(This is to put this matrix into jit.buffer~ after.)

Thanks by advance,
Alexandre


August 2, 2008 | 5:35 pm

You can use jit.poke~ to put the signal directly from the 2D matrix
into the buffer. For one cell per sample, use phasor~ with frequency
(sample rate / width) to index dim[0] and so on.

-Randy

On Aug 2, 2008, at 9:20 AM, Alexandre wrote:

>
> Hi,
> What would be the most simple and efficient way to convert
> "[jit.matrix 4 char 1200 700]" to : "[jit.matrix 4 float32 840000
> 1]" ? (1200*700=840000)
>
> (This is to put this matrix into jit.buffer~ after.)
>
> Thanks by advance,
> Alexandre


August 2, 2008 | 7:42 pm

Well, perhaps it was not really clear, but i don’t want to deal with any audio here, i want to convert the stuff as instantaneously as possible. Just forget my parenthese about buffer~.

The question is only:
What is the most Efficient way to convert a 2D matrix of 1200*700 pixels like [jit.matrix 4 char 1200 700] to a 1D matrix of 840000 pixels(*), and float32 : [jit.matrix 4 float32 840000 1] ?

I should do something like: [uzi 700] -> ….

Thanks by advance,

Alexandre

(*) 1200 * 700 = 840000


August 2, 2008 | 8:42 pm

In that case, jit.scanwrap is your friend – probably to most efficient way of doing this:

Zachary

– Pasted Max Patch, click to expand. –

August 2, 2008 | 9:07 pm

Thats’s perfect, thank a lot !

Note: this "jit.scanwrap" was not in the jitter.overview.maxpat..


Viewing 5 posts - 1 through 5 (of 5 total)