Re: [PD] ggee shell does not work in 0.52

2022-02-01 Thread Roman Haefeli
On Tue, 2022-02-01 at 21:17 +0100, martin brinkmann wrote:
> On 30/01/2022 21:43, Roman Haefeli wrote:
> 
> 
> > If you want to preserve the exact output, use the binary format
> > invoked
> > with the -b flag [command -b]. This returns the results as list of
> > bytes. You could use [list tosymbol] to convert the whole thing to
> > a
> > single symbol.
> 
> i have tried this (and used list/tosymbol before with filenames as
> numeric characters), and it works. but the problem is, that
> 
> exec date +%S%M%H%m%d
> 
> (my randomseed which looks like 3401210201 for example)
> 
> apparently prepends a parsed numeric value to LS_EXIT (first)
> outlet of [command]).

I'm confused. The left outlet of [command] outputs the exit code of the
command, not the stdout of it. The middle inlet is supposed to output
the stdout of the command.

> the output is something like
> print: 5.70921e+09
> print: 0
> and nothing at the middle (and right) outlet.

As I tried to explain previously, this is expected behavior in Pd land.
If you want to preserve the exact output, use the -b flag and convert
the result to a symbol with [list tosymbol]:

[exec date +%S%M%H%m%d(
|
[command]
|   <- middle outlet
[list tosymbol]
|
[print]

Gives me: symbol 4416220201

Note:
If your [command] outputs stdout on the left, then you're using a
unreleased beta version of [command] that probably even hasn't the -b
flag implemented. However, only the released version v0.1 is available
through Deken.


Roman








signature.asc
Description: This is a digitally signed message part
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] ggee shell does not work in 0.52

2022-02-01 Thread martin brinkmann

On 30/01/2022 21:43, Roman Haefeli wrote:



If you want to preserve the exact output, use the binary format invoked
with the -b flag [command -b]. This returns the results as list of
bytes. You could use [list tosymbol] to convert the whole thing to a
single symbol.


i have tried this (and used list/tosymbol before with filenames as
numeric characters), and it works. but the problem is, that

exec date +%S%M%H%m%d

(my randomseed which looks like 3401210201 for example)

apparently prepends a parsed numeric value to LS_EXIT (first)
outlet of [command]).

the output is something like
print: 5.70921e+09
print: 0
and nothing at the middle (and right) outlet.

with any character (non numeric) added to the date string, everything 
woks as expected.


bis denn!
martin




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


Re: [PD] ggee shell does not work in 0.52

2022-01-30 Thread Roman Haefeli
On Sun, 2022-01-30 at 18:59 +0100, martin brinkmann wrote:
> i have switched to 
> [command] and it works fine (except for numeric values being
> converted 
> to floats and coming out of the left outlet (!?), but adding a (non 
> numeric) character to the output helped.)

[command] parses stdout and stderr of the command as a FUDI message.
Numeric values are returned as floats, symbolic values as symbols and
leading, trailing, or multiple spaces (or tabs) are discarded. I
_think_ quite a few objects interfacing the outside world behave like
this, so I assume it is kind of a standard. 

If you want to preserve the exact output, use the binary format invoked
with the -b flag [command -b]. This returns the results as list of
bytes. You could use [list tosymbol] to convert the whole thing to a
single symbol. If you want more sophisticated parsing, you can do it,
though it probably takes a little effort.

Roman


signature.asc
Description: This is a digitally signed message part
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] ggee shell does not work in 0.52

2022-01-30 Thread martin brinkmann

On 28/01/2022 08:53, IOhannes m zmölnig wrote:


it's of course always nicer to be vanilla only.
i suggested zexy mainly because you were *already* using an external 


that is true, though i try to use as few externals as possible, and i 
had already to use something to invoke commands. i have switched to 
[command] and it works fine (except for numeric values being converted 
to floats and coming out of the left outlet (!?), but adding a (non 
numeric) character to the output helped.)


but if you do want a vanilla solution for setting initial values, i'd go 
the other way round: create a script that invokes Pd, providing whatever 
unique values you need.


that is a good idea! maybe i'll add some system info to my pd-startup 
script. though i have to think of some kind of fallback, in case pd

is not invoked from this script...

bis denn!
martin



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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread IOhannes m zmölnig


On 1/28/22 08:23, martin brinkmann wrote:

On 27/01/2022 23:05, IOhannes m zmölnig wrote:

On 1/27/22 20:06, martin brinkmann wrote:

i need the date-as-a-filename


but concatenating a bunch of numbers into a symbol is not exactly 
rocket science,even in Pd.


yes, and that was what i did.

but without a date (and withouth a unique random number as
a fallback (shell not working))
my old soundfiles are replaced when a new one is recorded,
which is not exactly what i want.



so that's when you use zexy's [date].

i was under the impression, that you simply dismissed zexy's [date] 
because you "need the date-as-a-filename".

on re-reading i see that i was wrong.
sorry.

instead you wrote:
> so speed does not matter much.
> platform independence would be nice though, and a 'vanilla'-solution
> even nicer...

it's of course always nicer to be vanilla only.
i suggested zexy mainly because you were *already* using an external 
(leaving aside that zexy is my library and somebody else's :-))


the thing with ggee is, that it practically has been unmaintained for 15 
years or so.
zexy otoh is still actively maintained (i consider it stable so there is 
not much new development going into it; but bugs are fixed regularly - 
if they are reported)



but if you do want a vanilla solution for setting initial values, i'd go 
the other way round: create a script that invokes Pd, providing whatever 
unique values you need.

something like:

```
#!/bin/sh
timestamp=$(date +%Y%m%d-%H%M)
pd -send "timestamp ${timestamp}" -open mypatch.pd
```

and in the patch you need something like this for filename generation

```
|
[t b]  [r timestampe]
|  |
|  [symbol]
|  |
[symbol XXX]
|
[symbol sound-$1.wav(
|
```

mgfds
IOhannes


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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread martin brinkmann

On 27/01/2022 23:05, IOhannes m zmölnig wrote:

On 1/27/22 20:06, martin brinkmann wrote:

i need the date-as-a-filename


but concatenating a bunch of numbers into a symbol is not exactly rocket 
science,even in Pd.


yes, and that was what i did.

but without a date (and withouth a unique random number as
a fallback (shell not working))
my old soundfiles are replaced when a new one is recorded,
which is not exactly what i want.



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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread IOhannes m zmölnig

On 1/27/22 20:06, martin brinkmann wrote:

i need the date-as-a-filename


i have no idea what that means.
but concatenating a bunch of numbers into a symbol is not exactly rocket 
science,even in Pd.


ffdsxy
IOhannes



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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread martin brinkmann

On 27/01/2022 10:33, IOhannes m zmoelnig wrote:
> On 1/27/22 10:10, martin brinkmann wrote:
>> thanks, i'll do that. i used [shell] basically for getting a random-seed
>> (and filenames) via date, and it affects only a few patches,
> if you need to read the date, you probably should use zexy's [date]
> (resp [time]).
> it works on all platforms, and is *much* faster than a call to an
> external program.

i need the date-as-a-filename and seeding [random] only
when the patch is loaded, or when a file is saved,
so speed does not matter much.
platform independence would be nice though, and a 'vanilla'-solution 
even nicer...


> if you want to generate a seed for your random number, you can use the
> new built in [file] to read some bytes from /dev/random (from your usage
> use [shell] together with date, i figure you already use a unix-like
> system).

yes. and  i'll try that.

> the randomness should be much better than just using some date-based
> thingy.

and better randomness would be great. [random] feels a bit
more like a random walk, it looks like it tends to repeat recent
values. (i might be mistaken, i tend to see patterns in noise...)

bis denn!
martin



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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread IOhannes m zmoelnig


On 1/27/22 10:10, martin brinkmann wrote:

thanks, i'll do that. i used [shell] basically for getting a random-seed
(and filenames) via date, and it affects only a few patches,
and should be easy to change to [command].


if you need to read the date, you probably should use zexy's [date] 
(resp [time]).
it works on all platforms, and is *much* faster than a call to an 
external program.



if you want to generate a seed for your random number, you can use the 
new built in [file] to read some bytes from /dev/random (from your usage 
use [shell] together with date, i figure you already use a unix-like 
system).

the randomness should be much better than just using some date-based thingy.


mfgadr
IOhannes


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


Re: [PD] ggee shell does not work in 0.52

2022-01-27 Thread martin brinkmann

On 26/01/2022 15:03, Roman Haefeli wrote:


example: the shell help-patch "getting the date".

it receives a bang from the right outlet, but nothing from
the left outlet.


I cannot reproduce with ggee 0.28 from Deken with Pd 0.52-1 from git on
Ubuntu 20.04. What OS are you using?


i am using 0.52.1 on xubuntu 20.04.3.
it is strange that it seems to work elsewhere, though, iir the first
time i tested after upgrading to 0.52 it seemed to work.
but maybe i do not remember right...


  ggee is version 0.28, but it happend
with an older version (and current pd) as well.



it is about a new project, I'd recommend to use it instead of [shell].


thanks, i'll do that. i used [shell] basically for getting a random-seed
(and filenames) via date, and it affects only a few patches,
and should be easy to change to [command].

bis denn!
martin



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


Re: [PD] ggee shell does not work in 0.52

2022-01-26 Thread Roman Haefeli
Hi

On Wed, 2022-01-26 at 10:21 +0100, martin brinkmann wrote:
> or at least getting something from stdout does not work
> anymore. (everything is fine in older versions
> (0.51 and below).
> 
> example: the shell help-patch "getting the date".
> 
> it receives a bang from the right outlet, but nothing from
> the left outlet.

I cannot reproduce with ggee 0.28 from Deken with Pd 0.52-1 from git on
Ubuntu 20.04. What OS are you using?

>  ggee is version 0.28, but it happend
> with an older version (and current pd) as well.
> i wonder if this affects other externals too...

As Alexandros already pointed out, there is also [command] which was
specifically developed to overcome a few short-comings of [shell]. If
it is about a new project, I'd recommend to use it instead of [shell].
Personally, I'm inclined to put effort rather into [command] than into
[shell], since the latter has some limitations which cannot be
addressed without breaking backwards compatibility. Then again, it
would be nice if it could be kept working for existing patches using
it.

Roman  


signature.asc
Description: This is a digitally signed message part
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] ggee shell does not work in 0.52

2022-01-26 Thread IOhannes m zmoelnig

On 1/26/22 10:21, martin brinkmann wrote:

or at least getting something from stdout does not work
anymore. (everything is fine in older versions
(0.51 and below).

example: the shell help-patch "getting the date".

it receives a bang from the right outlet, but nothing from
the left outlet. ggee is version 0.28, but it happend
with an older version (and current pd) as well.
i wonder if this affects other externals too...




i cannot reproduce this with:
- Pd-0.52.1-1 (as found in Debian/sid on amd64)
- pd-ggee 0.26-7¹ (as found in Debian/sid on amd64)

ggee-0.28 switched from `system()` to `execve()` to actually run the 
commands with [shell], which might well be the culprit here...



fdmsatg
IOhannes

¹ that reminds me that i obviously missed ggee-0.28, so there are no 
newer Debian packages available...


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


Re: [PD] ggee shell does not work in 0.52

2022-01-26 Thread Alexandros
Try [command] found in deken. It's a replacement for [shell], if I'm not 
mistaken.


On 26/1/22 11:21, martin brinkmann wrote:

or at least getting something from stdout does not work
anymore. (everything is fine in older versions
(0.51 and below).

example: the shell help-patch "getting the date".

it receives a bang from the right outlet, but nothing from
the left outlet. ggee is version 0.28, but it happend
with an older version (and current pd) as well.
i wonder if this affects other externals too...

bis denn!
martin



___
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