[PD] array read -resize according to file ?
Jack
jack at rybn.org
Fri Oct 7 11:58:12 CEST 2016
Le 07/10/2016 à 11:50, Jack a écrit :
> If you need [array] or [table] to do operations on them, you could use :
> [text define] to load your list of float,
> [0( on [text size] to get the number of float in your text file.
>
> Then use this number to resize your [array] and then load your textfile
> in this array.
I think, it is better to do :
[0( on [text get] (instead of reload the text file) and send result to
[array set].
++
Jack
>
> I don't test it, and maybe there is a more elegant way to achieve this.
> ++
>
> Jack
>
>
>
> Le 07/10/2016 à 11:10, Raphaël Ilias a écrit :
>> Hello Jack,
>>
>> Yes [text] is great, but I'm currently using tables/arrays that I want
>> to be stored on filesystem.
>> I actually can [read array.txt ( containing an array (i.e. a list of
>> floats) with [text], and the whole array is loaded as a list on first
>> line, but I'm concerned about performance while loading/parsing data.
>>
>> Then this would mean using :
>>
>> [0 $1 1 (
>> |
>> [text get dataAsText]
>>
>> instead of :
>>
>> [$1 (
>> |
>> [tabread dataAsArray]
>>
>> I will give this solution a try, but I'm using quite large tables (more
>> than 10,000 float values)... do you think it's as fast as [tabread] ?
>>
>> (PS : I'm also looking for a way to know if a specified file (giving its
>> path) exists or not. I did this once with the [shell] external, but I
>> would prefer a vanilla solution...)
>>
>> have a nice day,
>>
>> Raphaël
>>
>> 2016-10-06 18:08 GMT+02:00 Jack <jack at rybn.org <mailto:jack at rybn.org>>:
>>
>> Hello Raphaël,
>>
>> For textfiles ?
>> Maybe you should use [text] ?
>> ++
>>
>> Jack
>>
>>
>>
>> Le 06/10/2016 à 18:00, Raphaël Ilias a écrit :
>> > Hello list
>> >
>> > For an array used as data storage (i.e. not audio), is there a way to
>> > load data from a file AND have it resized according to file's length ?
>> > ...like with soundfiler : [read -resize filename.wav tablename (
>> >
>> > I want to load textfiles into arrays but their may vary and cannot be
>> > predicted...
>> >
>> > I feel my english isn't very clear today ! So I attached an example patch.
>> >
>> > Any idea ?
>> >
>> > have a good day !
>> >
>> > --
>> > Raphaël Ilias
>> > ___________________________________
>> > * phae.fr <http://phae.fr> <http://phae.fr>*
>> > 10 rue des Deux Haies - 49100 Angers / France
>> > phae.ilias at gmail.com <mailto:phae.ilias at gmail.com>
>> <mailto:phae.ilias at gmail.com <mailto:phae.ilias at gmail.com>> / 06 04
>> 45 79 78 <tel:06%2004%2045%2079%2078>
>> > ___________
>> >
>> >
>> > _______________________________________________
>> > Pd-list at lists.iem.at <mailto:Pd-list at lists.iem.at> mailing list
>> > UNSUBSCRIBE and account-management ->
>> https://lists.puredata.info/listinfo/pd-list
>> <https://lists.puredata.info/listinfo/pd-list>
>> >
>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at <mailto:Pd-list at lists.iem.at> mailing list
>> UNSUBSCRIBE and account-management ->
>> https://lists.puredata.info/listinfo/pd-list
>> <https://lists.puredata.info/listinfo/pd-list>
>>
>>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>
More information about the Pd-list
mailing list