## [Newbie] 2D matrix to 1D matrix ?

Aug 2, 2008 at 4:20pm

# [Newbie] 2D matrix to 1D matrix ?

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.)

Alexandre

#39103
Aug 2, 2008 at 5:35pm

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.)
>
> Alexandre

#137238
Aug 2, 2008 at 7:42pm

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] -> ….

Alexandre

(*) 1200 * 700 = 840000

#137239
Aug 2, 2008 at 8:42pm

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

Zachary

– Pasted Max Patch, click to expand. –

#137240
Aug 2, 2008 at 9:07pm

Thats’s perfect, thank a lot !

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

#137241

You must be logged in to reply to this topic.