Tracker style "FX" list
@cfry said:
The problem that arise is that when I start to improvise I kind of "break the (your) concept". And I would like to avoid ending up in another patch that is so messy that I can not use it if I bring it up after a half a year or so. Lets continue working on it!
You are definitely getting parts of it and seeing how to develop it but there are parts you don't quite have yet and I can't quite identify what those are so I can explain things. I made a sizable patch that adds a lot of commands but last night I realized I went to far and it would probably confuse things for you, so I will reduce it down to just the things you mentioned, I will follow your lead.
Passing the text name as an argument is just a matter of using your dollar arguments, [text get $1], but you will want to tweak your input for text symbols some.
So our right inlet for text symbols goes to a send now so we can easily access that text anywhere in the patch, like in our commands, and we also reset the counter which uses a value for its float for the same reason, we will want to be able to access and change its value from commands. "pc" is short for program counter and it is important that we increment its value before sending a float to the text get otherwise if we change its value in some command it will get overwritten, so having a [t f f] here is almost a must. This also means that [v $0pc] points to the next line to be run and not the one that is currently being run, this is important, fairly useful, and occasionally irksome.
The left inlet has change some as well, we have a [route bang float], bangs and floats go to the counter so we can increment the program or set the next line to be run, the right outlet sends to our [list-drip] which enables us to run commands from the parent patch so when things don't work you can run that print command to print the stack and get some insight or just run commands from a listbox to test things out or whatnot. We also have [r $0bang] on the counter, this lets us increment the counter immediately from a command and start the next line. And finally we have a new outlet that bangs when we reach the end of the text file so we can turn off the metro in the parent patch which is doing the banging, reset the counter to zero, load a new program, or what ever you want to do when the program completes. Middle outlet I did away with, globals can be done as a command, as can most everything.
Variables we can implement with some dynamic patching and a simple abstraction to create the commands for setting and getting the value of any variable.
This looks more complicated than it is. If we have the line var val1 10
in our program it runs the var
command which bangs [v $0pc] and subtracts 1 from it to get the current line from the text holding our program and then appends our $0 to it giving us the list var val1 10 $0
. The first message it goes to creates an instance of the var.pd abstraction in [pd $0var] with the second and fourth elements of the list as arguments, val1 and $0. Second message sends $3 to $4->$2, 10 to $0->val1. To finish off we use that new $0bang receive to bang [v $0pc] so we don't execute the rest of the line which would run val1
pushing 10 to the stack and then push another 10 to the stack. Variable name with a >
prepended to it is the command for setting the value of a variable, 22 >val1
in your program would set the value of val1 to 22, val1
would push 22 to the stack. If we could see how pd expands all those dollar arguments in the abstraction it would look like this:
Now you can create as many variables as you would like in your programs and a couple tweaks you can have the abstraction global.pd and subpatch [pd $0globals] so you can have the line global val2 0
and get a global variable that all instances of tracky can read and write from. There are a couple catches, each variable definition must appear on its own line with nothing else after it and with our simple parsing there is nothing to stop you from creating multiple instances of the same variable, if you run the line var val1 10
a second time it will create a second abstraction so when you run val1
it will bang both and each will push 10 to the stack giving you an extra 10 and screw up your program. We can fix this with adding a registry to the var command which searches a [text] to see if it has been created already, something like this after the [list $0] should do it:
And you will want to create a command to clear all variables (and the text if you use it) by sending [clear( to [pd-$0var], or get fancy and add another command in var.pd which bangs [iemguts/canvasdelete] so you can delete individual variables. Using [canvasdelete] has the advantage of not needing a registry for variables, you can just always run ```delete-<variable name>, or what ever you name your delete command, before creating a new variable. Each method has advantages.
Your loop does not work because the unpack needs to go into the left inlet of the float, that triggers the first loop and causes it to go back, each time the program gets back up to the loop command it increments [v $0loopi] until the select hits the target number of loops which sets $0loopi to -1 which ends the looping.
Not sure what you mean by groups/exclusive groups, can you elaborate or show it with a patch?
None of the above has been tested, but I did think them through better than I did the loop, fairly certain all is well but there might be a bug or two for you to find. Letting you patch them since we think about how things work more when we patch than when we use a patch. Try and sort out and how they work from the pictures and then patch them together without the pictures, following your understanding of them instead of your memory of how I did it. And change them as needed to suit your needs.
Plugdata file glob invalid
Why can I access the contents of the msp folder using file glob in Puredata, but not in Plugdata. No matter how I click, there is no response. I tried versions 0.9.1 and 0.9.2 but all encountered the same problem.
save float to sysex/restore float from sysex
Well, I ended up having to use %.8e because %.7e did not quite capture the precision of many floats, but I tried to make up for the bloat by encoding all ints between 0 and 999999 as %i. Sadly, it's still not compact enough because I think [sysexin] is dropping characters somewhere around the 400 char mark. Here's a test patch that demonstrates it on Win10, i7-5960X @ 3GHz, 32G RAM using loopMIDI for loopback. Monitoring the loopback channel with PocketMIDI shows that the char drops are not happening in loopMIDI.
sysex test.pd
I've returned to the possibility of encoding floats as 5 7 bit words, i.e. 4 bytes with 7 significant bits and 1 byte with 4 significant bits. If I was doing this in C, I'd access the single as though it were an unsigned long and extract 4 or 7 bit chunks using masks and a bit shifts. In Pd, I see that there is else/float2bits. I also see iemlib/float24 which suggests that there might be a different way, but maybe not. Are there more convenient ways of accessing the bits of a single precision floating point? And converting them back? Converting back seems to be tricky--not sure if it's possible to compute the single prec float from exp, sign, and mantissa in binary.
Edit: holy smokes, I just coded up something naively and it seems to work:
floatTo7Bit test.pd
I mean, look at that [expr]: how is it possible to multiply $f1 by pow(2, -23) and then add one to it without incurring the wrath of the overflow/underflow gods???!
pack s s s , pak s s s
Firstof all , I 'd like to say that is the second forum I am posting this on because it is doing my head in .
If I have a pak object (PAK ) with s s s as arguments , it accepts and outputs a list , but I can not conclude if these are considered symbols or not ( see next )
Like this
If I use a pack ( PACK ) with s s s , the messages 'x ' and '-' in the second and third inlet , need to be converted to symbols in order for the pack object to work , the first inlet does not need it
Like this
Now have a look at pack without the symbol boxes ,
When pressing the second and third toggle , the console says : expected symbol but got "x" or "-" ( there is no symbol box involved ) .
When pressing the first toggle , the "- "or "x" is send and received , does the pack see this as a symbol ? ( if so how can we examine this )
Furthermore , why doesn't it see the second and third as a symbol ?
This is were it's so cumbersome to actually see what's going on under the hood ..
Now I change the first argument of pack to integer , so pack = i s s , then the console says : Pack_symbol wrong type
From this I can conclude that the first message is indeed interpreted as a symbol (and rejected because it expected an integer ) , so why do the next and third inlet need an explicit symbol box , and why doesn't PAK need any at all ?
Just when I got the hang of lists and it's selectors , I bump into new issues
select - when input is a list
Again having an issue here with lists because pure data is so unforgiving compared to max
Scenario 1 : I have a text define object where each entry is a number and some are symbol "-" which indicates rests .
The output of "text get" goes into a select module with argument "-" , as expected the incoming symbols "-" are banged out the left output (not using them ) , and the rejected ( number data ) out of the right output , iow : works a charme .
Scenario 2 : when I switch to another " text define " where some entries are intervals of two notes , I get the error from select : inlet: expected 'symbol' but got 'float' , altough it still works as expected ( altough the intervals are not played yet but that get s resolved later on )
This error most likely comes from the two note intervals which are now a list and the sel expected a symbol as selector .
I can't put a symbol object in front of the select because then the notes are not understood anymore , a list trim doesn't work either
In the end I replaced the " select - " with a " route - " and " list trim in front and this works , playing the intervals with a " zl iter 1 " after it .
I am aware that select does not output lists ( out of it's rejected output ) but why the error inlet message and how to resolve it ?
Puredata, Jack and multi channel audio (only 2 channels showing, not 4)
I am trying to get the four channels available from puredata into the Jack audio server. I have selected 4 channels in the audio output settings.
For some reason, Jack only appears with 2. Anyone know why this is the case and how I might go about getting the other two channels appear? I am trying to achieve this so I can send audio from puredata to different speakers in a bluetooth syste (two seperate bluetooth modules, with a stereo channels).
The same thing happens with pipewire- only two channels are available in the virtual audio stream. Ive also attached photos for both of these audio servers. Help would be greatly appreciated.
The channels DO appear in pulseaudio however, and I have included pictures of this
Thanks for your help. Below photos demonstrating some of the settings. I am running linux mint
pd media settings
the four channels setup to go to ALSA: jack
there are only two channels appearing in Jack from puredata, not four
however, the channels do appear in pulseaudio volume control
but also does not appear in pipewire
Windows - 3 beginner questions
@suresh I should have downloaded Pd 0.55 before replying..... but I have no time.... I will try tomorrow.
For the font it should work in a shortcut.....
But it's probably best to add it to preferences... it will work after restarting Pd and then at every new start.
The path to externals should already be in preferences..... in this screenshot "pd/extra".
You have to add search paths as the whole path from root.
MrPeach does not need to be declared at startup (-lib mrpeach) as the library contains separate binaries for every object..... the path should be sufficient.
You could try putting mrpeach objects preceeded by the name....... e.g. [mrpeach/udpreceive~].... which could work....... the "else" library has a similar requirement I think..... but it should not be necessary once the search path is set.
Is there some security you need to overcome in windows 11? As the preferences are written to the registry.
David.
Pd compiled for double-precision floats and Windows
@ddw_music I love that story but am scratching my head over the 1/10 example you gave. Here's a test I made in Arduino c++:
I went out 40 digits and didn't see anything unexpected. Was that example you gave just a metaphor for the issue, or is my test naive?
Getting back to how Pd seems to differ from other programming languages, I'm going to hazard a guess and say that Pd hasn't separated the value of a float from its display/storage format. In my Arduino code I declare values, but it's not until the print statements that I specify their display formats. It's similar in Java and c#. I wonder if Pd could do something similar without upsetting users or making it too unfriendly? Maybe number boxes and arrays have an extra property that is a numeric format string? Or set messages for messages end in a numeric format string? Format strings shouldn't be too unfamiliar to those who've used makefilename. And if the format string is missing, then Pd defaults to it's current single-precision truncation strategy?
PS I hope my attempt at humor didn't discourage @porres from responding to @oid's question. I'm sure he would have something more meaningful to contribute.
Edit: hmm, but here's Pd64.
Yet another edit: I found this in Microsoft Excel help, but it suggests the value should be slightly less, not more that 0.1. Plus, Excel shows 0.1 exactly.
Yet another edit edit: disregard my comment about expecting it to be less, I didn't account for normalization of the mantissa. Carry on.
Line~ only two pairs in message , right ?
@ddw_music said:
The reference panel says "Origin: cyclone." This tells you that it did not load the vanilla [line~] object -- it loaded the one from cyclone, which is modeled after Max's [line~], which does accept a series of breakpoint pairs.
hjh
It does not accept multiple pairs , even the cyclone one.
This should go to 1 instantlly , to 0 in 200ms, back to 1 in 100mS and back to 0 in 100 ms
It doesn't
As a matter of fact , I think the reference to cyclone is just wrong , because pure data vanilla loads it fine and I don't have any externals at all