Hi!
I can't understand why the first of these is working while the second isn't (with error $2: argument number out of range)
test_route_object.pd
-
[route] behaviour
Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
-
Because only messages beginning with a float as first atom are implicitely handled as lists by puredata.
If you suppress this first atom with [route], you get a message with 2 atoms, the first being treated as a selector, and the second as a float.
This message is handled as a message --like, for example, the message [ set 1( -- , not as a list.
You must prepend the "list" selector to further process it as a list : just insert a [list] object after the output of [route]. -
This post is deleted!
-
And if you print the output of the pack on the left, you'll see that it prepends "list" to [samplerate 44100(
-
ok, I get it! it is working now...
thank you both!Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
-
well, I really have trouble with data types in PD: how can I write simple text? I want to write log messages that I can print to the console (without backslashes!), through the network, and maybe to a text file.
| messages like this are seen as lists, right? (Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
-
@rph-r Yes, that will be a list...... and "messages" will be the selector followed by 'like' 'this' etc. as symbols.
[rawprint] is a useful external to analyse formats.
This should help...... concat.zip
Sending [symbol( into the right inlet of [concat] before passing the message will turn the whole message (including the selector) into a single symbol, keeping the spaces between the original atoms.
I am pretty sure that it was made by @jameslo...... but I could be mistaken...
The comma in your message will always be interpreted as "new message" though.The MrPeach library has an external [str] which can manipulate different message
formats in many ways.
And the old cxc library from Pd extended..
cxc was updated for 64-bit Pd by Lucarda in 2018 (for windows and maybe for other os's)....
.....very useful for string manipulation in Pd.
David. -
[concat] helps thank you!
But still, it keeps backslashes. I pass the whole message through a [$1(, then it displays the text correctly at least in the terminal.
I won't use externals in this project since it will run on a Bela board.Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
-
@rph-r That's good news. The [$1( removes the "symbol" tag..... I had forgotten that.... or I never knew.
It is a very useful thing to know....
As you have found it changes the message from symbol to text.
David. -
Nice!
is thre another way to do that, just to know?Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
-
@rph-r The right outlet of [route] will turn the symbol into a list and then [list trim] will remove the "list" tag..... but it is not as elegant.
There might be other ways too.
David. -
@rph-r For easy printing to the console without backslashes you can use my pdlog plugin/abstraction, it should work just fine on bela assuming you are running pd's gui which I assume you are since you mention printing to the console but don't know much about bela so possibly not. This plugin has the advantage of being able to also print proper error message that come up in red as well as debug and fatal messages. Just drop the files anywhere in your path. This should also be more efficient than alternate vanilla ways of removing those backslashes assuming I actually understand how pd works, offloads it all onto the gui thread which is pd's only other thread unless you use [pd~]
pdlog.zipEdit: It could possibly hiccup in some situations when trying to print tcl's special symbols (\, $ and the like) but I have never had any issues. An escaped space causes Tcl to make a sublist so the symbol
asd\ f
comes out in Tcl as{asd {f}}
and I went the easy path to flatten it usingjoin
which supposedly could cause problems on those symbols. I think it is safe but I was warned about it so I am warning you about it. I think since no processing of the list is being done and we can't use { and } in pd we are safe.