Forums > MaxMSP

detecting mono/stereo files

December 15, 2006 | 5:09 am

if i have a simple sampler application with drag and drop
and a file open dialog, how can i find out if a file
is mono or stereo so that the 1 or 2 channel version
of the sampler (built around buffer or groove) is chosen?

-110


December 15, 2006 | 8:35 am


December 15, 2006 | 8:47 am


December 15, 2006 | 9:00 am


December 16, 2006 | 4:21 am

okay, so since there is no "bufferinfo~" i will use
[sfinfo~] to find out the channel number _before
loading it into my buffers.
(here: one buffer subpatch for stereo and one for mono!)

-110 ?


December 16, 2006 | 9:03 am



f
December 16, 2006 | 11:34 am

On 16.12.2006, at 05:21, Roman Thilenius wrote:

>
>
> okay, so since there is no "bufferinfo~" i will use
> [sfinfo~] to find out the channel number _before
> loading it into my buffers.
> (here: one buffer subpatch for stereo and one for mono!)

hello roman,
there’s the getChannels method for mxj buf.Op

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 319 145 87 196617 mxj buf.Op asdf2;
#P newex 202 136 72 196617 buffer~ asdf2;
#P message 202 108 43 196617 replace;
#P newex 319 179 73 196617 print channels;
#P message 319 110 63 196617 getChannels;
#P connect 0 0 4 0;
#P connect 4 0 1 0;
#P connect 2 0 3 0;
#P window clipboard copycount 5;

or you can do it with sfinfo~ too of course. in the example only 1
buffer subpatch needed (the stereo one).

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 365 399 99 196617 one or two channels;
#P comment 403 455 62 196617 keep stereo;
#P message 307 455 95 196617 clear , 0 0 1 , 1 1 1;
#P comment 403 433 78 196617 mono -> stereo;
#P user meter~ 71 424 129 436 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user meter~ 56 407 114 419 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user meter~ 48 555 106 567 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user meter~ 33 538 91 550 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user ezdac~ 62 624 106 657 0;
#P comment 276 290 150 196617 then load into buffer and resize;
#P comment 408 256 61 196617 length (ms);
#P comment 395 238 63 196617 sample rate;
#P comment 382 220 25 196617 bits;
#P number 362 255 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 349 237 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 336 219 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 323 201 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 194 308 66 196617 buffer~ asdf;
#P newex 49 382 78 196617 groove~ asdf 2;
#P newex 49 505 65 196617 matrix~ 2 2;
#P newex 323 175 79 196617 sfinfo~ asdf;
#P newex 323 156 68 196617 prepend open;
#P newex 194 46 56 196617 opendialog;
#P message 194 29 35 196617 sound;
#P newex 194 289 81 196617 prepend replace;
#P newex 194 76 30 196617 t s s;
#P comment 369 202 69 196617 num channels;
#P comment 323 127 198 196617 first open header to get info about the
file;
#P comment 230 27 183 196617 click to load mono or stereo soundfiles;
#P newex 49 335 41 196617 sig~ 1.;
#P message 78 311 51 196617 startloop;
#P message 307 433 95 196617 clear , 0 0 1 , 0 1 1;
#P newex 323 398 41 196617 sel 1 2;
#P connect 12 3 19 0;
#P connect 12 2 18 0;
#P connect 12 1 17 0;
#P connect 16 0 0 0;
#P connect 12 0 16 0;
#P connect 11 0 12 0;
#P connect 7 1 11 0;
#P connect 0 1 30 0;
#P connect 0 0 1 0;
#P connect 8 0 15 0;
#P connect 7 0 8 0;
#P connect 10 0 7 0;
#P connect 9 0 10 0;
#P connect 14 1 28 0;
#P connect 14 1 13 1;
#P connect 13 1 26 0;
#P connect 13 1 24 1;
#P connect 13 0 25 0;
#P connect 13 0 24 0;
#P connect 14 0 27 0;
#P connect 30 0 13 0;
#P connect 1 0 13 0;
#P connect 14 0 13 0;
#P connect 3 0 14 0;
#P connect 2 0 14 0;
#P window clipboard copycount 33;

#|
fredrikolofsson.com klippav.org musicalfieldsforever.com
|#


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