Hi... I'm trying to make a sampler for drum hits and I want the sounds to be pitch-able. I'm wondering how to tell pd to play each sound file only once with [tabread4~] instead of looping it.
I'm planning to use something like the set up in this video.
Thanks
-
tabread4~ for drum hits?
-
To play an array once:
[0, $1 $2(
|
[line~]
|
[tabread4~ xyz]$1 is the number of samples to play. $2 is the duration in ms.
From [soundfiler] you can get the file's size (in samples) = $1 and sample rate (which may be different from DSP sample rate). So then $2 should be size / samplerate * 1000. Pack those two into a list, send to the message box, and it'll play.
hjh
-
thank you I'll give it a try this morning
-
I'm not really sure how to pack the message... or even if I've created the right message. The print out is saying '$2: argument out of range' when I click the message box in run mode. I've also noticed that the print out shows that $2 is in fact very high and for some reason is a float as well. Here's how I've set it up.
Thanks again for your help
-
@liamorourke You have the old [soundfiler] that only gives the total samples, but as you know the samplerate that is fine.
The [pack] needs to be [pack f f ] ..... the $ variables come from abstraction arguments and you don't have any (you are not using your patch as an abstraction)..
You need a trigger after [soundfiler] to set the message order..... so.....
I hope it's correct...... untested......
The zero could be included in a message as @dde_music posted..... and that is tidier... but this shows what is going on.
David.
-
I thought it was working perfectly for a minute but it seems as though the samples are not sounding right. they are playing but they are pitched wrong. I would imagine they are all 44100 though.
-
yeah... I've just checked. they are indeed 44100. strange
-
@liamorourke It Pd audio settings set to 44100 ......?
But should it not be total samples/samplerate (gives no. of seconds) * 1000 for msecs....?
So...... [expr $f1 / 44100 * 1000]
Or just [expr $f1 /44.1] simplified
Or just [/ 44.1] simplified again...... and which allows you to change samplerate automatically for each file by banging a new number into the right inlet.
David. -
that's the one. thank you again David. that seems to be working nicely now ☺