[PD] loading random samples

Claude Heiland-Allen claude at mathr.co.uk
Fri Feb 12 17:15:11 CET 2016


On 12/02/16 16:04, Alexandros Drymonitis wrote:
> [readsf~] outputs a bang out its right outlet when the current sample it's
> playing has finished. You can send that bang to [random] (the argument of
> which will be the number of your samples) and the output of [random] to a
> message [open ./samples/P$1.wav, 1(
> I don't think that you can use 01, 02, etc., but 1, 2, etc. If you really
> want to name your samples like that, your message could be [open
> ./samples/P0$1.wav, 1(, but any sample greater than 9 would have to be
> named P010.wav. There should be a work around that though.

Easiest to have files that are named with numbers rather than a number 
plus some extra sample-specific name.  Otherwise you really do need a 
way to get a list of existing filenames into Pd somehow, either by a 
text file that you prepare beforehand, or a more complicated system with 
externals.

For leading 0 with fixed number of digits (here 2):

[nbx\
  |
[makefilename P%02d.wav]
  |
[open $1, 1(

> In this example there's a directory called "samples" in the directory of
> the patch.
>
> On Fri, Feb 12, 2016 at 5:31 PM, Pagano, Patrick <pat at digitalworlds.ufl.edu>
> wrote:
>
>> ​you need a folder playlist object attached to a file player
>>
>> i suggest the browser/folder from the MTL abstractions and the player~
>> external from Eric lyon Potpourri
>>
>>
>>
>>
>> *Patrick Pagano B.S, M.F.A*
>> Audio and Projection Design Faculty
>> Digital Worlds Institute
>> University of Florida, USA
>> (352)294-2020
>> ------------------------------
>> *From:* Pd-list <pd-list-bounces at mail.iem.at> on behalf of Spyros
>> Polychronopoulos <spypolymail at gmail.com>
>> *Sent:* Thursday, February 11, 2016 6:50 PM
>> *To:* pd-list at mail.iem.at
>> *Subject:* [PD] loading random samples
>>
>> Hi list,
>>
>> I have a question if you could enlighten me:
>>
>> I would like to make a patch that loads randomly a sample from a folder
>> (if I can make it open randomly any file begging with P01 ie. P01*.wav) and
>> when the sample ends loads automatically another sample randomly (ie.
>> P02*.wav).
>>
>> thank you in advance
>> --
>> Spyros Polychronopoulos
>> Music Composer / BSc / PhD
>> www.spyweirdos.com
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>>
>>
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>




More information about the Pd-list mailing list