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 !
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 ___________________________________
10 rue des Deux Haies - 49100 Angers / France phae.ilias@gmail.com mailto:phae.ilias@gmail.com / 06 04 45 79 78 ___________phae.fr <http://phae.fr>*
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
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@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 ___________________________________
10 rue des Deux Haies - 49100 Angers / France phae.ilias@gmail.com mailto:phae.ilias@gmail.com / 06 04 45 79 78 ___________phae.fr <http://phae.fr>*
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/
listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
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 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@rybn.org mailto:jack@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@gmail.com <mailto:phae.ilias@gmail.com> <mailto:phae.ilias@gmail.com <mailto:phae.ilias@gmail.com>> / 06 04 45 79 78 <tel:06%2004%2045%2079%2078> > ___________ > > > _______________________________________________ > Pd-list@lists.iem.at <mailto:Pd-list@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@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list>
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@rybn.org mailto:jack@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@gmail.com <mailto:phae.ilias@gmail.com> <mailto:phae.ilias@gmail.com <mailto:phae.ilias@gmail.com>> / 06 04 45 79 78 <tel:06%2004%2045%2079%2078> > ___________ > > > _______________________________________________ > Pd-list@lists.iem.at <mailto:Pd-list@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@lists.iem.at <mailto:Pd-list@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@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Also, if the file has numbers on separate lines, you can use the "-cr" flag to the "read" message to text to get each one on its own line in the object - this should make it easier to manipulate. But "array" objects are much more efficient - it might be worth writing a loop that simply loads the numbers from text into an array one by one at startup.
OTOH the "soundfiler" object really should be able to read/write ascii numbers - that's been on my dolist for a decade or more.
cheers Miller
On Fri, Oct 07, 2016 at 11:58:12AM +0200, Jack wrote:
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@rybn.org mailto:jack@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@gmail.com <mailto:phae.ilias@gmail.com> <mailto:phae.ilias@gmail.com <mailto:phae.ilias@gmail.com>> / 06 04 45 79 78 <tel:06%2004%2045%2079%2078> > ___________ > > > _______________________________________________ > Pd-list@lists.iem.at <mailto:Pd-list@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@lists.iem.at <mailto:Pd-list@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@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 10/06/2016 06:00 PM, Raphaël Ilias wrote:
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 (
why don't you just use [soundfiler]? (and store the data in binary rather than text, which will give youhigher resolution with smaller files)
gfasrd IOhannes