how to get the number of channels of a buffer~


    Aug 23 2007 | 4:48 pm
    how can i find out how many channels a file loaded into buffer~ has?
    i tried with sfinfo~ but i cant get it to get me any info on buffer~,
    and info~ has no output of channels
    is there an object im overlooking?
    im trying to make it so if i load a mono file i route the left output
    to both so i can at least get it out of both speakers
    thanks,
    rodrigo

    • Aug 23 2007 | 5:32 pm
      You could do it by using sfinfo~ at the same time as you load the file into buffer~ or force all samples to mono or stereo.
    • Aug 23 2007 | 6:16 pm
      thats perfect!
      most of my samples are stereo, but theres a few that are mono,
      is there a way to full a stereo buffer with a mono file doubled?
      this is the how i would resolve the workaround, although i should
      probably add '*~0.5' to cut the gain in half if im going to doulbe a
      waveform this way?
      max v2;
      On 8/23/07, Leafcutter John wrote:
      >
      > You could do it by using sfinfo~ at the same time as you load the file into buffer~ or force all samples to mono or stereo.
      >
      > #P window setfont "Sans Serif" 9.;
      > #P number 209 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P window linecount 1;
      > #P newex 209 157 68 196617 prepend open;
      > #P newex 209 185 79 196617 sfinfo~;
      > #P button 108 96 25 0;
      > #P newex 108 158 81 196617 prepend replace;
      > #P newex 108 131 56 196617 opendialog;
      > #P newex 108 185 98 196617 buffer~ one 1000 2;
      > #P connect 1 0 2 0;
      > #P fasten 1 0 5 0 113 153 214 153;
      > #P connect 2 0 0 0;
      > #P connect 4 0 6 0;
      > #P connect 5 0 4 0;
      > #P connect 3 0 1 0;
      > #P window clipboard copycount 7;
      >
      > --
      > http://www.leafcutterjohn.com
      >
      > "The Forest And The Sea"
      > Out on Staubgold Records
      > Staubgold 68 CD/LP
      >
    • Aug 24 2007 | 4:52 pm
      Hi Rodriego,
      In your patch the ~* 0.5 causes stereo files to be played half as loud in the left channel than in the right. The following patch produces the desired result.
    • Aug 25 2007 | 12:25 am
      yeah i ended up doing what you posted pretty much
      the *0.5~ was still in there in the patch i post from before adding
      the gate section
      thanks,
      rodrigo
      On 8/24/07, Leafcutter John wrote:
      >
      > Hi Rodriego,
      >
      > In your patch the ~* 0.5 causes stereo files to be played half as loud in the left channel than in the right. The following patch produces the desired result.
      >
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P newex 101 153 31 196617 == 1;
      > #P message 262 37 14 196617 0;
      > #P newex 206 59 38 196617 sig~ 1;
      > #P message 195 40 37 196617 loop 1;
      > #P toggle 216 240 15 0;
      > #P newex 245 262 111 196617 dac~;
      > #P newex 206 84 74 196617 groove~ one 2;
      > #P newex 101 176 115 196617 gate~ 1;
      > #P number 101 132 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 101 82 68 196617 prepend open;
      > #P newex 101 110 79 196617 sfinfo~;
      > #P button 0 21 25 0;
      > #P newex 0 83 81 196617 prepend replace;
      > #P newex 0 56 56 196617 opendialog;
      > #P newex 0 110 83 196617 buffer~ one;
      > #P connect 8 0 7 1;
      > #P fasten 8 0 9 0 211 167 250 167;
      > #P connect 14 0 7 0;
      > #P fasten 8 1 9 1 243 141 351 141;
      > #P connect 6 0 14 0;
      > #P fasten 7 0 9 1 106 232 351 232;
      > #P fasten 13 0 8 0 267 78 211 78;
      > #P fasten 10 0 9 0 221 258 250 258;
      > #P fasten 11 0 8 0 200 80 211 80;
      > #P connect 12 0 8 0;
      > #P connect 4 0 6 0;
      > #P connect 5 0 4 0;
      > #P connect 1 0 2 0;
      > #P fasten 1 0 5 0 5 78 106 78;
      > #P connect 2 0 0 0;
      > #P connect 3 0 1 0;
      > #P window clipboard copycount 15;
      >
      > --
      > http://www.leafcutterjohn.com
      >
      > "The Forest And The Sea"
      > Out on Staubgold Records
      > Staubgold 68 CD/LP
      >
    • Aug 25 2007 | 6:19 pm