[PD] Controlling / looping a list of audio files loaded in by reading a text file.

James Dunn james at 4thharmonic.com
Wed Feb 27 12:34:46 CET 2013


Quoth Rick T, on 27/02/2013 09:04:
> Greetings All
>
> I'm trying to control how a text file with a list of audio files in it
> are read/played.
>
> Example:
> I have a text file which is read and plays several audio files one
> right after the other till the end.  I would like to have it read/play
> the text file list in reverse, forward, or loop play on the current
> file.
>
> So if I have a text file with.
> one.wav,
> two.wav
> three.wave
>
> When a button is clicked for Forward it reads the text file and plays
> the audio files like:
> one.wav
> two.wav
> three.wav
>
> When a button is clicked for Reverse  it reads the text file and plays
> the audio files like:
> three.wav
> two.wav
> one.wav
>
> When a button is clicked for Loop  it reads the text file and plays
> the audio files like:
> one.wav
> two.wav
> two.wav
> two.wav .... until I cancel the loop or hit another button to go
> forward or reverse
>
> I've gotten the buttons to work as a selection but I'm having issues
> in getting the text list to change directions and loop.  I was
> thinking of using a list to read in all the lines in the text file but
> I wasn't sure how to get the list to read/play in the forward,
> reverse, and loop options.  Is their another way I should be trying to
> do this?  I've attached what I have so far.
>
> Thanks
>
To loop the current file you need to know where in the playlist you are. 
[textfile] doesn't really have this information ( [msgfile] in zexy does 
though so you might want to look at that ). Or you can make a counter to 
keep track of where you are so you can then loop the track, or reverse 
the playback. See attached patch.

James
-------------- next part --------------
#N canvas 596 234 452 418 10;
#X obj 57 155 textfile;
#X obj 57 184 b;
#X obj 57 235 f;
#X obj 104 235 + 1;
#X floatatom 197 287 5 0 0 1 Current_file - -;
#X msg 84 206 0;
#X obj 57 40 openpanel;
#X obj 57 22 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 226 26 r nextFile;
#X obj 226 100 sel 1 2 3;
#X msg 57 61 read \$1 cr \, rewind \, bang;
#X obj 57 83 t a b;
#X obj 89 314 f;
#X obj 89 344 until;
#X obj 243 122 t b b;
#X msg 287 175 rewind;
#X obj 150 294 - 1;
#X obj 135 314 f;
#X obj 260 147 t b b;
#X obj 226 79 f;
#X obj 105 93 r textfile;
#X obj 89 365 s textfile;
#X obj 241 47 r keypress;
#X obj 236 341 readsf~ 2;
#X obj 236 374 dac~;
#X obj 236 227 l2s;
#X msg 236 250 open \$1 \, 1;
#X obj 287 387 s nextFile;
#X obj 297 368 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 323 32 hradio 15 1 0 3 empty empty empty 0 -8 0 10 -262144 -1
-1 0;
#X obj 323 50 + 1;
#X connect 0 0 1 0;
#X connect 0 0 25 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 2 1;
#X connect 3 0 4 0;
#X connect 3 0 12 1;
#X connect 3 0 16 0;
#X connect 5 0 2 1;
#X connect 6 0 10 0;
#X connect 7 0 6 0;
#X connect 8 0 19 0;
#X connect 9 0 0 0;
#X connect 9 1 14 0;
#X connect 9 2 18 0;
#X connect 10 0 11 0;
#X connect 11 0 0 0;
#X connect 11 1 5 0;
#X connect 12 0 13 0;
#X connect 13 0 21 0;
#X connect 14 0 12 0;
#X connect 14 1 15 0;
#X connect 15 0 0 0;
#X connect 15 0 5 0;
#X connect 16 0 17 1;
#X connect 17 0 13 0;
#X connect 18 0 17 0;
#X connect 18 1 15 0;
#X connect 19 0 9 0;
#X connect 20 0 0 0;
#X connect 22 0 19 0;
#X connect 23 0 24 0;
#X connect 23 1 24 1;
#X connect 23 2 27 0;
#X connect 23 2 28 0;
#X connect 25 0 26 0;
#X connect 26 0 23 0;
#X connect 29 0 30 0;
#X connect 30 0 19 0;


More information about the Pd-list mailing list