[PD] symbols with zero paddings and spaces

Christof Ressi info at christofressi.com
Wed Mar 17 14:25:39 CET 2021


pdsend/pdreceive uses the FUDI protocol (= Pd messages), where strings 
that look like floats are converted to a float atom. When serializing 
between FUDI strings and Pd atoms, the textual result is not guaranteed 
to be the same for number atoms.

> the resulting output from [netreceive -u 3001] will be:
>
> udp: "01 2 3 4 05.txt" 
Are you sure? Because I get

1 2 3 4 05.txt

which is what I would expect. The float atoms are properly serialized to 
their string representation (Pd doesn't remember the original text!) and 
"05.txt" is actually a symbol.

> is there any way to sent such a symbol untruncated using the methods 
> above,
If you want to send it as a single symbol, that's possible, you just 
have to escape the whitespace:

"01\ 02\ 0003\ 004\ 05.txt"

Now, if you want to send the tokens as individual symbols, you can 
escape them with a backslash:

"01 \02 \0003 \004 \05.txt"

Note the different position of the backslash! I'm not sure if this 
particular escaping behavior is actually intended or just works by 
chance... Generally, it would be great to document Pd's string escaping, 
because it is not entirely obvious.

Christof

On 17.03.2021 11:40, oliver wrote:
> hi, dear list !
>
> when i try to send a symbol containing spaces AND numbers prepended by 
> zeros with [pdsend], the zeros get truncated in unpredictable ways.
>
> to see what i mean, please do the following:
>
> 1.) open the [netreceive] help patch
> 2.) open a console and try the following command:
>
> ========================== LINUX/OSX: ===============================
>
> ~$ echo "01 02 0003 004 05.txt" | /usr/bin/pdsend 3001 localhost udp
>
> =========================== WINDOWS: ================================
>
>> echo "01 02 0003 004 05.txt" | "C:\Program Files\Pd\bin\pdsend.exe"  
>> 3001 localhost udp
>
> =====================================================================
>
> the resulting output from [netreceive -u 3001] will be:
>
> udp: "01 2 3 4 05.txt"
>
>
> the same is true if a symbol like this is sent from a .tcl script to a 
> corresponding [receive] object in a PD patch
> (using the "::pd_connect::pdsend" function).
>
> is there any way to sent such a symbol untruncated using the methods 
> above, other than transforming them first to ascii code numbers and 
> send them as a list of numbers, using [list tosymbol] later in the 
> "PD-world" to symbolize it?
>
> thanks for all clarifications
>
> oliver
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20210317/4342dedb/attachment-0001.htm>


More information about the Pd-list mailing list