trying to build a sampler

Jul 13, 2006 at 2:10am

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
thanks,
dave

#26780
Jul 13, 2006 at 2:35am

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.

#80502
Jul 13, 2006 at 4:48am

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.

#80503
Jul 13, 2006 at 9:15am

As I think I’ve said before: the only reliable way to trigger audio
in sfplay~ is to preload cues.

– N.

nick rothwell — composition, systems, performance — http://
http://www.cassiel.com

#80504
Jul 13, 2006 at 10:37am

better to use play~ and adsr~ probably, in a poly~ object.

#80505
Jul 13, 2006 at 12:28pm

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

Greetings,
Mattijs

#80506
Jul 13, 2006 at 1:06pm

#80507
Jul 14, 2006 at 3:29am

Quote: mattijs@samplemadness.nl 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,
Dave

#80508

You must be logged in to reply to this topic.