-
lectronice
Hi folks!
I'm pretty new to pd~ and I'm trying to understand how to use numbers from a text file (technically, it's a .glkdata file generated by Inform 7). So far I've succeeded at printing the content of my file, but I don't understand how to actually send individual values somewhere else.
[bang(
/\
/ \
[print( [read sounds.txt cr]
\ |
\ |
\ |
[textfile]
|
[unpack f f f f f ]
| | | | |
[0\ [0\ [0\ [0\ [0\So far the content of my file outputs in the console when I hit [bang( or [print(, but anything I've tried below [textfile] doesn't seem to pass any value. So I get something like this :
--------- textfile or qlist contents: -----------
* //56CBD4B9-7B09-4D19-8362-249C835E13F7// sounds \;
! Table of sounds (28) \;
5 \;
0 \;
9I'm trying to get individual output for the last tree lines, but nothing updates except in the console. I've also tried to use [msgfile] instead of [textfile], but for some strange reason, I get an instant crash whenever I send the bang. I suppose I miss something pretty obvious here, since I've built this patch after various similar examples without full understanding of how [textfile] / [unpack] works, but I'm running out of ideas... Could someone help me?
-
lectronice
Thanks for your explanations. What I still don't fully understand is what pd~ reads as individual list elements when reading a file. Are elements of a list delimited by spaces or other characters ? Or does each character of the file count as a list element? In my case, if I didn't use "cr", what would be the way to extract these last three floats from a single list? So far, each line produced by [textfile] is a different list, right?
-
lectronice
OK, I think I'm starting to grasp the logic
In fact, I thought a bang to [textfile] would output a single list with each element being separated by a semicolon, not that each bang would give a list per line, hence the misuse of [unpack]. Now I'll try to find a way to automate the process by reading the file at regular intervals and output each float separately.
Thanks, you helped a lot!