trying to build a sampler
so i sampled this little kids toy that i love into the computer in the attampts to build a sampler of it.
there is not much of an envelope to the sounds at all, so i chopped each note into 3 so there is an attack, sustain, and release. these all have their own sound files.
now, i have it set up in max/msp so that each note has 3 sfplay~ objects. when a button is first pressed, it tells the first sfplay~ (attack) to play. i use the ‘bang when done playing’ output to tell the second sfplay~ (sustain) to start. when that ones done, it looks to see if the button is still pressed. if it is it tells the second sfplay~ to play again, if the button is no longer pressed, it tells the third sfplay~ (release) to play.
this almost works. . .
my problem is that the bang when done playing isnt immediate so there is a tiny bit of silence between each section which results in an AM sounding effect.
i know that sfplay~ has a loop feature, so that has helped with the problem in the sustain section, but there are still problems with the attack and release sections.
any suggestions would be GREATLY appreciated
Any reason you are interested in using sfplay~ for a sampler rather than a
ram/buffer based sound object.
Why not trigger your attack sample.
Use a delay of some sort to trigger the sustain/loop with a little fade in
so the attack can crossfade into the sustain.
Then trigger the release sample while fading out the sustain loop.
…If there is not one already… It would be great to see a multi-segment
polyphonic sample player tutorial.
well, like i said, there is not much envelope to the sound…
so i am going to cut the samples into single loopable pieces and forget about the attack and release. its sounds almost identical anyways.
better to use play~ and adsr~ probably, in a poly~ object.
> i use the ‘bang when done playing’ output to tell the second sfplay~ (sustain) to start.
> there is a tiny bit of silence between each section
The reason for this is that bang is sent as an event, not in the dsp thread. This is not sample-accurate so you never know exactly when your bang will be processed compared to the audio processing. To trigger the next section you would need a signal output to report ‘done playing’.
In this case I would use a wave~ with a phasor~ (as shown in the wave~ help file). Connect the phasor~ to ==~ 1 to find out when the end of the sample has been reached. The ==~ has a signal output that you can use, for example to tell another phasor~ to start playing another wave~.
Quote: firstname.lastname@example.org wrote on Thu, 13 July 2006 08:28
> The reason for this is that bang is sent as an event, not in the dsp thread. This is not sample-accurate so you never know exactly when your bang will be processed compared to the audio processing. To trigger the next section you would need a signal output to report ‘done playing’.
hmmm, thats very interesting. i have been using max/msp only for several months and thought that a bang was as immediate as a signal output. im glad that i know this now.
in this patch, i have decided to only use one sample per note and loop that, but i will probably attempt some sort of sampler again in the near future and now i wont have (as many) headaches over it.
thanks for all the info guys.
it is much appreciated,
Forums > MaxMSP