hi toby
since [textfile] doesn't provide any mechanism to jump to a certain line, you need to step through all lines from the beginning. this conflicts with your intention to only read certain lines out, not all of them. you could solve this conflict by appending a [spigot] object to [textfile]. [spigot] lets you choose, if messages should get passed or not, by sending to its right inlet '1' or '0'. a solution would be to set [spigot] to '0' until [textfile] reaches the line you want. then you could set [spigot] to '1', so that the output of [textfile] is sent to the array.
if you are on pd-extended or you have the zexy external installed, then you could also use [msgfile] (on pd-extended you may need to create a [import zexy] first). it works similar to [textfile], but provides more 'commands'. you could send it a 'goto 2' message in order to set the read pointer to line 2. sending it a 'bang' now, will let it output line 2.
roman
On Fri, 2007-06-22 at 12:11 +0100, toby zardoz wrote:
Hello PD list I'm trying to extract one of three number columns from a text file to drive the pitch of an audio oscillator. I have the .txt file reading all 3 columns of numbers into an array at present but I only want the second column. Ideally I'd like to extract the 2nd column before being read into the array but another solution in this case may also be limiting the numbers read from the array to the oscillator to within a particular range (i.e. the number value range of the 2nd column; 840 - 890). Though the latter wouldn't provide a pure solution it would be workable in this case. As you may have guessed, I'm grapping with pd fundamentals here as an abolute beginner, so I'd really appreciate any suggestions/ patch examples/ explanations etc. thanks Toby
Yahoo! Answers - Get better answers from someone who knows. Try it now. _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de