Cool object. This is a late response but I was checking out your code and wound up making a bunch of changes to it to address 3 bugs I found:
- 1 - [n! ] doesn't instantiate on its own. it needs a prior instantiation of [factorial] to load. Normally to fix that, what you'd do is make a copy of the binary and rename it to n!.pd_darwin, but there still needs to be a setup function with the object's name in it, or a function that's just called "setup", which you should probably try to avoid just because it's not very self-documenting.
- 2 - It doesn't successfully find the help file. Pd automatically adds "-help" or "-help.pd" on its own. It also automatically creates a help file reference. The sethelpsymbol function is pretty much only good for when you have multiple objects of different classes that need to refer to a common help file.
- 3 - It freezes and sometimes crashes pd if it's fed a really big number, because it'll start looping endlessly..
Performs binop arithmetic with 2 hot (active) inlets, which means that the usage of either inlet will trigger an output. Some of the objects require the hexloader library to load properly.
The naming convention is a # symbol, followed by the expression.
examples: [#+ ] [#- ] [#== ] [#!= ] [#&& ] [#|| ] etc.
The collection is based on the binop objects found in x_arithmetic.c. This includes:
binops 1: +, -, *, /, pow, max, min
binops 2: ==, !=, >, <, >=, <=
binops 3: &, |, &&, ||, <<, >>, %, mod, div
Performs binop arithmetic with the inlets having switched roles. Some objects require the hexloader library.
The naming convention is an @ symbol, followed by the expression.
examples: [@- ] [@/ ] [@pow ] [@<< ] etc.
The collection consists of binop objects where the swapping of inlets would have a noticeable difference in results. These include:
-, /, pow, <<, >>, %, mod, div
Consists of two bitwise objects to perform bitwise negation [!~ ] and XOR ([^ ] and [#^ ]). Bitwise negation has another alias of [~ ] but it will not load unless [!~ ] is loaded first, or if the object is placed in pd/extra/!~ and "!~" is added to your list of libraries.
splits and joins the sign, exponent, and mantissa of a float
accepts bangs and floats
accepts 1 creation argument for assigning the stored value
has 1 extra inlet for assigning the stored value
outputs the sign, exponent, and mantissa of the stored float
accepts bangs and floats (mantissa is assigned the float)
accepts 3 creation arguments for assigning the mantissa, exponent, and sign
has 3 extra inlets for assigning these values
outputs a float by combining these values together
help file included
A number base converter that accepts 1 creation argument to specify which number base to convert to. If nothing is specified, or the number is out of range (1-32), it defaults to 16. The converted number is sent in the form of a symbol type. The order of letters is a bit unconventional:
You can see AB has been replaced with NE. N('en' short for 'ten') and E('el' short for 'eleven') are sometimes used in duodecimal(12). Letters B, I, O, and S are taken out as they are too similar looking to certain numbers.
Similar to [muse], containing many of the same functions, except that [muse] sends new midi/frequency values through the same two outlets, whereas [harm] uses a 1-to-1 note-to-outlet approach, which allows us to make chords. More creation arguments results in more inlets and outlets, of which there should be an equal amount. If we created the object:
[harm 45 22 26 29 33]
This would have 6 inlets and 6 outlets.
The first inlet receives lists, floats, and bang messages. Numeric lists reassign the scale, floats send a single frequency through the appropriate outlet, and bang messages send the respective frequencies through each available outlet. The inlets that follow assign each of the creation arguments to a new value. An additional outlet is created to handle all octaves.
use the message [midi 0 | 1( to switch between using either midi notes or frequencies (default).
They're like [mtof] and [ftom], but now the objects accept 2 parameters:
- the reference pitch for middle A (default value is 440)
- the number of tones (default value is 12)
So let's say you want your reference pitch to be 432, considered by some to be a more mellow frequency, you would write:
- [ntof 432]
and to split an octave into just 8 distinct tones instead of the most conventional 12, you'd write:
- [ntof 432 8]
You can change these values after instantiation by using messages:
- [ref $1(
- changes the reference pitch
- [tet $1(
- changes the number of tones (in equal temperament)
It also comes with two counter objects: [cupq], and [cupqb]
[cupq] has three inlets:
- left inlet decrements
- right inlet increments
- middle inlet changes the step size.
[cupqb] is similar, but it includes an atom box, allowing you to slide the current count. It has two inlets:
- first inlet receives [+ $1( and [- $1( messages
- second inlet controls the step size.
[cupq] and [cupqb] are .pd files, so there's actually more you can do with them than what I've specified here.
These files are also on my github page under pd-externals.
EDIT: My musical scale object [muse] now also takes advantage of the ref and tet messages. Its help file allows you to play around with these features. The files have now also been added to the zip.
Thanks guys, I'm really glad you like the objects.
There's actually one more I made just recently called [rind], which uses less logic, about as much as the original [random] except that with [random], a double value is created and is then cast to an int, whereas with [rind], the double value is left intact. It's somewhat analogous with leaving the rind on cheese, hence the name. It uses time for seeding and allows for one or two arguments (min and max).
If you look at the source code for [random] (x_misc.c) you'll see the seed in the makeseed function:
static unsigned int random_nextseed = 1489853723;
so changes made to random_nextseed will hold across all new instantiations of [random] because it's static, but after a full restart of pd, the int returns back to 1489853723