[PD] loading dir of soundfiles

vincent rioux vincent.rioux at no-log.org
Tue Feb 14 03:29:56 CET 2006


with pyext and glob python module, it is quite easy.
for example the following simple sample code (call it simple_dir.py 
e.g.) will output files path each time you send it the next message 
(after you sent it the message 'pictures' or 'sounds').
the number of files is len(self.fs).
one instantiate this object in puredata with
|pyx simple_dir visit_dir|

greetings,
vincent


import pyext
import glob

class visit_dir(pyext._class):
    _inlets = 1
    _outlets = 1

    def pictures_1(self):
        self.fs = glob.glob('my_path/*png')

    def sounds_1(self):
        self.fs = glob.glob('my_path/*ogg')

    def next_1(self):
       if self.fs:
            self. _outlet(1,  self.fs.pop())
 
cdr wrote:

>On Mon Feb 13, 2006 at 08:39:43PM -0500, Mark Polishook wrote:
>  
>
>>thanks ---
>>
>>- is there a tot for darwin?
>>    
>>
>
>[shell] or [popen] and GNU Find works great for this sort of thing... i tended to cache the current dir's filenames in a maphash or pool object, so that you could randomly select other files w/o going back to the shell.. 
>
>  
>
>>On Feb 13, 2006, at 8:31 PM, patco wrote:
>>
>>    
>>
>>>Hello,
>>>Folderspiller is a set of patches designed for loading from any  
>>>directory the filetypes you
>>>choose.
>>>http://impala.utopia.free.fr/pd/patchs/selection/OUTILS/ 
>>>folderspiller+fbox/
>>>
>>>--- Mark Polishook <polishook at optonline.net> a ?crit :
>>>
>>>      
>>>
>>>>just wondering if there's an example or documentation somewhere for
>>>>loading a directory of soundfiles (rather than reading one in at a
>>>>time) so that the patch can figure out how many files exist and then
>>>>load them, etc.
>>>>        
>>>>
>>>***   ***   ***
>>>
>>>
>>>	
>>>
>>>	
>>>		
>>>______________________________________________________________________ 
>>>_____
>>>Nouveau : t?l?phonez moins cher avec Yahoo! Messenger ! D?couvez  
>>>les tarifs exceptionnels pour appeler la France et l'international.
>>>T?l?chargez sur http://fr.messenger.yahoo.com
>>>      
>>>
>>_______________________________________________
>>PD-list at iem.at mailing list
>>UNSUBSCRIBE and account-management -> 
>>http://lists.puredata.info/listinfo/pd-list
>>    
>>
>
>_______________________________________________
>PD-list at iem.at mailing list
>UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
>  
>





More information about the Pd-list mailing list