[PD] [command] output

IOhannes m zmoelnig zmoelnig at iem.at
Wed Feb 2 12:06:17 CET 2022

On 2/2/22 09:04, martin brinkmann wrote:
> On 01/02/2022 22:25, Roman Haefeli wrote:
>> As I tried to explain previously, this is expected behavior in Pd land.
> yes, but the float is coming out of the leftmost output, and this only 
> happens when the commands output is a number (and only a number).
> "exec echo 123456789" for example,
> while "exec echo number123456789" works

well, this is just how FUDI works.
- everything that looks like a number, is interpreted as a number.
- numbers are internally represented as single-precision floating point
and Pd will not show you the *exact* number, but "print" it using %g to 
make it more visually pleasant.

(I'm not going into details; this has been discussed in the past. more 
than once; check the archives if you are interested).

- if your script outputs "123456789", this looks very much like a number 
and is thus converted to one.
- since the number is a single precision floating point number, it will 
not be *exactly* "123456789" (since this number cannot be represented by 
a 32bit floating point number). instead it will be stored as 123456792.0f
- if you display your number with [print] or a numberbox, it will show 
as "1.23457e+08". the same string-conversion happens if you use $arg 
expansion (e.g. "[open mysound.$1.wav(").

you can use your own conversion if you send the number to [makefilename].
e.g. [makefilename mysound.%d.wav] will give you the integer part of the 
full number (but it's still a 32bit floating point number, so you won't 
get  "123456789")

> adding a string, and afterwards splitting it off is a workaround.

this is of course very ugly.
Pd is not exactly good at string manipulation.

better use zexy's [date] and [time], create a list of the values you are 
interested in and then do a piecewise assembly:

[12 34 56 79 90]
[open mysound.$1$2$3$4$5.wav(

>> flag implemented. However, only the released version v0.1 is available
>> through Deken.
> i use
> command[v0.1](Linux-amd64-32).dek
>      Uploaded by rdz @ 2021-10-01 22:20:51
> installed via deken a few days ago

i just like to confirm that the version available via deken will indeed 
output single number printout on the 1st outlet.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20220202/bf90eb23/attachment.sig>

More information about the Pd-list mailing list