Forums > MaxMSP

Sfplay~ in a Pluggo acting strange

September 1, 2008 | 6:47 am

trying to make a looper type vst using max 4.6. ( attached below ) It uses sfrecord~ to record an incomming piece of audio. when i am done recording my loop, i click a message and that stops the recording and immediately starts playing it back using sfplay~. there is a gate~ to not let incomming audio through when the recorded loop/sample is playing back.
so far so good, works great in max/msp, but when i build a pluggo vst, the plugin doesnt playback the recorded file properly. basically the tail of the file sounds really garbled and is stretched out about 20x how long it is supposed to be. If I import this file into Live 7, it plays fine, but again doesnt play right in the pluggo. also if i open existing wave or aif files in this pluggo, most of them play and loop fine.

Tried a bunch of things and found that when i send sfplay an offset message of 8 or 12 the sample plays back pretty nicely. This i have to do after i send sfplay a 1 to start playing.

Two problems with this though, since i have to send the offset message after play message, the shortest time after the play message i could get this to work ( the offset message ) is a 20ms. also, there is a very noticeable pop/click at the begining of the loop.
would anyone have any idea of what i could do to get this to work properly in a pluggo vst, hopefully without having to send sfplay the offset message? id like to use sfplay for this and not buffer based playback, so i can utilize cuepoints. if anyone has any ideas please let me know…also, Live is the only vst host i have to test it out on…

thanks,
Michael

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 386 301 14 196617 1;
#P message 348 301 37 196617 loop 1;
#P toggle 124 130 15 0;
#P newex 478 281 38 196617 del 20;
#P number 526 280 39 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 526 301 52 196617 offset $1;
#P message 478 301 46 196617 offset 8;
#P button 488 264 16 0;
#P newex 404 41 48 196617 loadbang;
#N plugconfig;
#C useviews 1 1 1 1;
#C numprograms 64;
#C preempt 1;
#C sigvschange 1;
#C sigvsdefault 32;
#C windowsize;
#C defaultview Interface 0 0 0;
#C dragscroll 1;
#C noinfo;
#C package ????;
#C uniqueid 128 115 6;
#C initialpgm 1;
#P newobj 67 72 53 196617 plugconfig;
#P newex 279 375 33 196617 *~ 0.;
#N pp 1 "volume" 0. 10.;
#P newobj 263 397 104 196617 pp 1 "volume" 0. 10.;
#B color 14;
#P flonum 225 399 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 225 375 33 196617 *~ 0.;
#P newex 26 407 48 196617 plugout~;
#P comment 234 446 39 196617 output;
#P newex 123 198 63 196617 plugin~;
#P newex 26 122 51 196617 r thruOff;
#P message 339 146 14 196617 0;
#P newex 308 169 51 196617 s thruOff;
#P message 404 431 14 196617 1;
#P button 404 411 15 0;
#P newex 26 154 48 196617 r thruOn;
#P newex 404 449 48 196617 s thruOn;
#P comment 172 43 80 196617 start recording;
#P newex 64 295 35 196617 gate~;
#P newex 26 295 35 196617 gate~;
#P newex 368 160 32 196617 del 1;
#P button 368 124 15 0;
#P message 272 61 14 196617 0;
#B color 5;
#P message 404 67 14 196617 0;
#B color 12;
#P message 315 301 30 196617 open;
#P newex 124 158 42 196617 adc~;
#P user number~ 123 312 162 327 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 191 151 14 196617 1;
#P newex 209 131 27 196617 t b i;
#P toggle 208 173 15 0;
#P button 368 216 15 0;
#P toggle 8 375 15 0;
#N sfplay~ 2 120960 0 ;
#P newobj 225 338 119 196617 sfplay~ 2;
#P newex 25 435 49 196617 dac~;
#P newex 226 219 87 196617 prepend set;
#P message 225 242 243 196617 open Tiger:/Users/bang/Music/Record/wave7.wav;
#P newex 226 193 291 196617 sprintf open Tiger:/Users/bang/Music/Record/wave%ld.wav;
#P message 221 96 24 196617 dec;
#P message 193 59 22 196617 inc;
#B color 14;
#P user incdec 193 111 15 15 0 0;
#P number 209 111 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 123 283 63 196617 sfrecord~ 2;
#P window linecount 5;
#P comment 288 44 59 196617 stop recording an start playback of recording;
#P window linecount 3;
#P comment 419 62 100 196617 stop recorded playback and hear audio through;
#P window linecount 1;
#P comment 145 448 39 196617 input;
#P newex 431 376 89 196617 prepend samptype;
#P window setfont "Sans Serif" 0.;
#P user umenu 431 347 100 196611 1 64 368 0;
#X add int8;
#X add int16;
#X add int24;
#X add int32;
#X add float32;
#X add float64;
#X add mulaw;
#X add alaw;
#P window setfont "Sans Serif" 9.;
#P message 424 301 52 196617 offset 12;
#P button 232 265 15 0;
#P message 249 302 14 196617 1;
#P newex 235 283 32 196617 del 0;
#P connect 53 0 52 0;
#P connect 15 0 18 0;
#P connect 15 0 2 0;
#P fasten 15 0 50 0 230 260 493 260;
#P connect 54 0 51 0;
#P connect 50 0 54 0;
#P fasten 4 1 5 0 526 368 436 368;
#P connect 37 0 34 0;
#P connect 36 0 37 0;
#P fasten 27 0 18 0 409 327 230 327;
#P connect 27 0 36 0;
#P connect 49 0 27 0;
#P connect 30 0 20 0;
#P fasten 29 0 39 0 373 143 344 143;
#P connect 29 0 30 0;
#P fasten 28 0 21 0 277 167 213 167;
#P fasten 28 0 29 0 277 120 373 120;
#P fasten 39 0 38 0 344 165 313 165;
#P connect 45 0 44 1;
#P connect 45 0 46 0;
#P connect 45 0 47 1;
#P connect 18 1 47 0;
#P connect 0 0 1 0;
#P fasten 2 0 0 0 237 278 240 278;
#P hidden fasten 14 0 9 0 231 217 128 217;
#P connect 14 0 16 0;
#P connect 22 1 14 0;
#P connect 46 0 45 0;
#P connect 18 0 44 0;
#P fasten 26 0 18 0 320 327 230 327;
#P fasten 56 0 18 0 353 327 230 327;
#P fasten 57 0 18 0 391 327 230 327;
#P fasten 3 0 18 0 429 327 230 327;
#P fasten 51 0 18 0 483 327 230 327;
#P fasten 52 0 18 0 531 327 230 327;
#P connect 1 0 18 0;
#P connect 16 0 15 0;
#P fasten 20 0 15 0 373 238 230 238;
#P hidden connect 10 0 11 0;
#P connect 10 0 22 0;
#P hidden connect 11 0 10 0;
#P fasten 23 0 31 0 196 192 31 192;
#P lcolor 7;
#P fasten 23 0 32 0 196 191 69 191;
#P lcolor 7;
#P connect 23 0 21 0;
#P connect 12 0 11 0;
#P connect 13 0 11 0;
#P fasten 22 0 23 0 214 151 196 151;
#P connect 41 1 32 1;
#P connect 41 1 9 1;
#P connect 25 1 41 1;
#P connect 55 0 25 0;
#P connect 9 0 24 0;
#P hidden fasten 21 0 9 0 213 217 128 217;
#P connect 41 0 31 1;
#P connect 41 0 9 0;
#P connect 25 0 41 0;
#P connect 43 1 17 1;
#P connect 32 0 43 1;
#P connect 47 0 43 1;
#P fasten 35 0 32 0 31 191 69 191;
#P lcolor 7;
#P fasten 40 0 31 0 31 184 31 184;
#P lcolor 7;
#P fasten 40 0 32 0 31 192 69 192;
#P lcolor 7;
#P connect 31 0 43 0;
#P connect 44 0 43 0;
#P fasten 35 0 31 0 31 191 31 191;
#P lcolor 7;
#P hidden fasten 19 0 17 0 13 430 30 430;
#P connect 43 0 17 0;
#P window clipboard copycount 58;


September 1, 2008 | 10:38 am

For what you are trying to do it sounds like you would be better to use record~ and play~/groove~ with a buffer. Much more flexible this ways and means there is no writing or reading from disk as you create your loops.


September 1, 2008 | 11:45 pm

thanks for the response. thing is my patch works perfectly in max/MSP, once i pluggo it and bring it into Live as a VST, it acts like it does, which i think has to do with writing a bad wave file.
also, as i mentioned id like to utilize cuepoints and lastly, with buffer, i have to predefine a size, when i dont know how long the loop/sample will be. i know i can get around this with a clocker/timer to groove~ loop points, but dont want to spend all that time figuring that out…and again it works in max…


September 2, 2008 | 2:55 pm

Sfplay~ and friends use disk access for their audio files. No matter how well you can get this patch to work it will never perform as well as a RAM based approach using buffer~.

Lots of things work in MaxMSP but not in MaxMSP hosted in something else (aka Pluggo). This is a reality of Pluggo programming we all have to work around when we hit it every now and then.

You’ll be much happier with a buffer~ based solution. Just make your buffer~ really big to start with and record~ into it with different offsets for your different loops, or use a poly~ based approach.

-A


September 2, 2008 | 3:21 pm

Hi,

I had similar probs both on mac and ‘doze and finally gave up trying to get it to work. I tried searching for the thread from around 6 monthsago but couldn’t find it- anyway the consensus was that it Seems like sfplay is pretty much broken in pluggo. Hopefully this problem will be resolved with a max 5 version of pluggo.

Best
B


September 2, 2008 | 9:34 pm

There are technical reasons why hard disk playback is difficult within a plug-in. First, the host does not give the plug-in enough time to perform the necessary file reading. This is reasonable because hosts expect that plug-ins will consume as little of the CPU as possible. Second, the host could be engaged in its own disk reading activity, which obviously limits the bandwidth available for the plug-in to do anything similar. You can try to increase the buffer size to a large value and see if this helps, but the OS doesn’t always pay attention to what an application requests. So don’t hold out any hope that the situation with sfplay~ will ever improve.

David Z.


September 2, 2008 | 11:02 pm

Thanks all for the replies. me, not having much patience i have since rewritten the small app using buffer~ and play~. works fine.

>Lots of things work in MaxMSP but not in MaxMSP hosted in programming we all have to work around when we hit it every now >and then.

this is kinda scary. such a beautifully implemented framework. guess theres always more than one way to do something though.


September 3, 2008 | 6:21 pm

i need the mail-ad from christopher murtag, urgent, the macgill-mailing-list-man…
> > _______________________________________________> maxmsp mailing list> mMessenger to go! Hol’ Dir Messenger aufs Handy!

http://windowslivemobile.msn.com/BrowserServiceMessenger.aspx?lang=DE-DE


September 3, 2008 | 7:31 pm

Ask Netochka ;-)
(sorry , couldn’t resist)
Cheers
Roger

On 03/09/2008 19:21, "steffen scholl" wrote:

> i need the mail-ad from christopher murtag, urgent, the
> macgill-mailing-list-man…
>
>
>
>> >
>
>
>
> Zeigen Sie es Ihren Freunden! Erstellen Sie kostenlos Fotoalben und Diashows
> in Ihrem Space!
> < http://redirect.gimas.net/?cat=hmtl=M0809Fotoalbum=http://spaces.live.com/api
> .aspx?wx_action=addModule=de-DE_ru=http%3a%2f%2f%7bspacesapi%3aid%7d.spaces.li
> ve.com%2fphotos%2f_targetSite=PersonalSpaces_url=%2fphotoalbum.aspx>
>


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