Re: [PD] forcing array size based on text file size

2018-04-06 Thread Jack
OK, thanks.
Nice example using pointer.
On My side, I used to use [text define] (to load the text file) and
[text size] (to query the size with a 'bang' message).
++

Jack



Le 06/04/2018 à 16:36, Fede a écrit :
> Hi Jack, 
> 
> Well, yes, it was something ‘like’ that.
> 
> here it is with the missing [t b p] and [text size -s text t] 
> 
> 
> 
> 
> On Apr 6, 2018, at 4:21 PM, Jack  wrote:
> 
>> Hello,
>>
>> Le 06/04/2018 à 10:55, Fede a écrit :
>>> Hi Jim, 
>>>
>>> Like [soundfiler]’s “-resize” flag, this would be a very useful feature for 
>>> array loading.
>>>
>>>
>>> You can load a text file and then query its size, something like:
>>>
>>> [read -c your_file, bang( 
>>> |
>>> [text] 
>>> |\
>>> [text size]
>>> |
>>> [array size your_array]
>>
>> Hmm, not sure this patch will work fine.
>> Did you try it ?
>>
>> Jim, What do you want to store in the array. That doesn't seem entirely
>> clear to me ? Do you need to store each character ? [array]s, in Pd,
>> only store floats. So you will be able to store each character as its
>> decimal ASCII representation (or maybe better to use Unicode here) in
>> the array. For instance, "A" will be 65.
>> ++
>>
>> Jack
>>
>>
>>
>>>
>>> Best,
>>>
>>> fede
>>>
>>> On Apr 6, 2018, at 10:38 AM, Jim Ruxton  wrote:
>>>
 I am reading a text file into an array. I would have expected the array 
 size to grow to the same as the number of lines/elements in the text file 
 but it seems to default to a size of 100. Is there a way for the size of 
 the array to take on the size of the text file automatically? If not how 
 do I get the number of lines in the text file so I can resize the array 
 accordingly?

 Thanks,

 Jim


 ___
 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
>>>
>>
>>
>> ___
>> 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


Re: [PD] forcing array size based on text file size

2018-04-06 Thread Jack
Le 06/04/2018 à 16:21, Jack a écrit :
> Hello,
> 
> Le 06/04/2018 à 10:55, Fede a écrit :
>> Hi Jim, 
>>
>> Like [soundfiler]’s “-resize” flag, this would be a very useful feature for 
>> array loading.
>>
>>
>> You can load a text file and then query its size, something like:
>>
>> [read -c your_file, bang( 
>> |
>> [text] 
>> |\
>> [text size]
>> |
>> [array size your_array]
> 
> Hmm, not sure this patch will work fine.
> Did you try it ?
> 
> Jim, What do you want to store in the array. That doesn't seem entirely
> clear to me ? Do you need to store each character ? [array]s, in Pd,
> only store floats. So you will be able to store each character as its
> decimal ASCII representation (or maybe better to use Unicode here) in
> the array. For instance, "A" will be 65.

Even simpler in Pd (instead of unicode), use directly 'UTF8' encodage to
store a character as number in an array. For instance, 'Ɲ' will be store
as '198 157'.
With [list tosymbol], you can get back the right character.
++

Jack


> ++
> 
> Jack
> 
> 
> 
>>
>> Best,
>>
>> fede
>>
>> On Apr 6, 2018, at 10:38 AM, Jim Ruxton  wrote:
>>
>>> I am reading a text file into an array. I would have expected the array 
>>> size to grow to the same as the number of lines/elements in the text file 
>>> but it seems to default to a size of 100. Is there a way for the size of 
>>> the array to take on the size of the text file automatically? If not how do 
>>> I get the number of lines in the text file so I can resize the array 
>>> accordingly?
>>>
>>> Thanks,
>>>
>>> Jim
>>>
>>>
>>> ___
>>> 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
>>
> 
> 
> ___
> 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


Re: [PD] forcing array size based on text file size

2018-04-06 Thread Fede
Hi Jack, 

Well, yes, it was something ‘like’ that.

here it is with the missing [t b p] and [text size -s text t] 



array-resize.pd
Description: Binary data


your_file
Description: Binary data

On Apr 6, 2018, at 4:21 PM, Jack  wrote:

> Hello,
> 
> Le 06/04/2018 à 10:55, Fede a écrit :
>> Hi Jim, 
>> 
>> Like [soundfiler]’s “-resize” flag, this would be a very useful feature for 
>> array loading.
>> 
>> 
>> You can load a text file and then query its size, something like:
>> 
>> [read -c your_file, bang( 
>> |
>> [text] 
>> |\
>> [text size]
>> |
>> [array size your_array]
> 
> Hmm, not sure this patch will work fine.
> Did you try it ?
> 
> Jim, What do you want to store in the array. That doesn't seem entirely
> clear to me ? Do you need to store each character ? [array]s, in Pd,
> only store floats. So you will be able to store each character as its
> decimal ASCII representation (or maybe better to use Unicode here) in
> the array. For instance, "A" will be 65.
> ++
> 
> Jack
> 
> 
> 
>> 
>> Best,
>> 
>> fede
>> 
>> On Apr 6, 2018, at 10:38 AM, Jim Ruxton  wrote:
>> 
>>> I am reading a text file into an array. I would have expected the array 
>>> size to grow to the same as the number of lines/elements in the text file 
>>> but it seems to default to a size of 100. Is there a way for the size of 
>>> the array to take on the size of the text file automatically? If not how do 
>>> I get the number of lines in the text file so I can resize the array 
>>> accordingly?
>>> 
>>> Thanks,
>>> 
>>> Jim
>>> 
>>> 
>>> ___
>>> 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
>> 
> 
> 
> ___
> 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


Re: [PD] forcing array size based on text file size

2018-04-06 Thread Jack
Hello,

Le 06/04/2018 à 10:55, Fede a écrit :
> Hi Jim, 
> 
> Like [soundfiler]’s “-resize” flag, this would be a very useful feature for 
> array loading.
> 
> 
> You can load a text file and then query its size, something like:
> 
> [read -c your_file, bang( 
> |
> [text] 
> |\
> [text size]
> |
> [array size your_array]

Hmm, not sure this patch will work fine.
Did you try it ?

Jim, What do you want to store in the array. That doesn't seem entirely
clear to me ? Do you need to store each character ? [array]s, in Pd,
only store floats. So you will be able to store each character as its
decimal ASCII representation (or maybe better to use Unicode here) in
the array. For instance, "A" will be 65.
++

Jack



> 
> Best,
> 
> fede
> 
> On Apr 6, 2018, at 10:38 AM, Jim Ruxton  wrote:
> 
>> I am reading a text file into an array. I would have expected the array size 
>> to grow to the same as the number of lines/elements in the text file but it 
>> seems to default to a size of 100. Is there a way for the size of the array 
>> to take on the size of the text file automatically? If not how do I get the 
>> number of lines in the text file so I can resize the array accordingly?
>>
>> Thanks,
>>
>> Jim
>>
>>
>> ___
>> 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
> 


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] forcing array size based on text file size

2018-04-06 Thread Fede
Hi Jim, 

Like [soundfiler]’s “-resize” flag, this would be a very useful feature for 
array loading.


You can load a text file and then query its size, something like:

[read -c your_file, bang( 
|
[text] 
|\
[text size]
|
[array size your_array]

Best,

fede

On Apr 6, 2018, at 10:38 AM, Jim Ruxton  wrote:

> I am reading a text file into an array. I would have expected the array size 
> to grow to the same as the number of lines/elements in the text file but it 
> seems to default to a size of 100. Is there a way for the size of the array 
> to take on the size of the text file automatically? If not how do I get the 
> number of lines in the text file so I can resize the array accordingly?
> 
> Thanks,
> 
> Jim
> 
> 
> ___
> 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