[ANN] Scheme for Pure Data 0.1 - script and live-code Pd with Lisp
Hi everyone, I'm excited to announce that Scheme for Pd (aka s4pd) is now code complete for version 0.1 and ready for people to use, though it does still require building from source at the moment. This should "just work" with the Makefile, let me know if not.
Scheme for Pd is an open-source external for live-coding and scripting Pd with an embedded s7 Scheme Lisp interpreter. It is a port of most of Scheme for Max, also by me, for Max/MSP. s7 is an embeddable minimal Scheme implementation by Bill Schottstaedt at CCRMA, with many nice features for algorithmic composition and embedding. It's the Scheme engine used in the Common Music algorithmic composition toolkit and the Snd audio editor, and has keywords, Common Lisp style macros, first-class environments, thread safety, applicative syntax, and a very straight forward FFI (foreign function interface).
Features in beta 0.1:
-
run code from files, and hot reload files during playback
-
evaluate scheme code from Pd messages live with a REPL
-
keeps on playing fine when you go into edit mode
-
output numbers, symbols, lists, vectors (as Pd lists)
-
basic array i/o
-
send messages to named receivers
-
schedule functions with delay, using the Pd scheduler
The GitHub project page is here. Please file issues there if you find bugs or the help is unclear. I'm sure there are still some issues!
https://github.com/iainctduncan/scheme-for-pd
If you've not used Scheme before, I've written a crash course for Scheme for Max which should almost all apply here:
https://iainctduncan.github.io/learn-scheme-for-max/introduction.html
There are various videos on the youtube channel demoing things you can do with the Max version, which might be of interest, as they should mostly port over without issue. I will be making Pd specific ones in the future.
https://www.youtube.com/channel/UC6ftX7yuEi5uUFkRVJbJyWA
If you can help with testing and making builds on Windows and Linux, please let me know. I think this version should be ready for a binary release now.
Enjoy,
iain
[pack] set without output?
The closer PD's user experience gets to Max the more people will expect it to be Max and complain about it not being Max.
That doesn't tend to happen. E.g., [expr]
has been a core Pd Vanilla object for some time. It interprets its args as Max-style ints/floats, but (quite rightly) nobody requests adding the int/float difference to the core.
Also, Pd-l2ork and Purr Data have opportunistically pulled improvements from Max when backward compatible. I don't think I've had any complaints about it being insufficiently Max-like.
I did have a user request the strange Max feature of hiding all wires and xlets. But they didn't even complain when I implemented it as GUI preset named "footgun."
JASS, Just Another Synth...Sort-of, codename: Gemini (UPDATED: esp with midi fixes)
JASS, Just Another Synth...Sort-of, codename: Gemini (UPDATED TO V-1.0.1)
jass-v1.0.1( esp with midi fixes).zip
1.0.1-CHANGES:
- Fixed issues with midi routing, re the mode selector (mentioned below)
- Upgraded the midi mode "fetch" abstraction to be less granular
- Fix (for midi) so changing cc["14","15","16"] to "rnd" outputs a random wave (It has always done this for non-midi.)
- Added a midi-mode-tester.pd (connect PD's midi out to PD's midi in to use it)
- Upgrade: cc-56 and cc-58 can now change pbend-cc and mod-cc in all modes
- Update: the (this) readme
INFO: Values setting to 0 on initial cc changes is (given midi) to be expected.
JASS is a clone-based, three wavetable, 16 voice polyphonic, Dual-channel synth.
With...
- The initial, two wavetables combined in 1 of 5 possible ways per channel and then adding those two channels. Example: additive+frequency modulation, phase+pulse-modulation, pulse-modulation+amplitude modulation, fm+fm, etc
- The third wavetable is a ring modulator, embedded inside each mod type
- 8 wave types, including a random with a settable number of partials and a square with a settable dutycycle
- A vcf~ filter embedded inside each modulation type
- The attack-decay-release, cutoff, and resonance ranges settable so they immediately and globally recalculate all relevant values
- Four parameters /mod type: p1,p2, cutoff, and resonance
- State-saving, at both the global level (wavetables, env, etc.), as well as, multiple "substates" of for-each-mod-type settings.
- Distortion, reverb
- Midiin, paying special attention to the use of 8-knob, usb, midi controllers (see below for details)
- zexy-limiters, for each channel, after the distortion, and just before dac~
Instructions
Requires: zexy
for-entire-state
- O: Open preset. "default.txt" is loaded by...default
- S: Save preset (all values incl. the multiple substates) (Note: I have Not included any presets, besides the default with 5 substates.)
- SA: Save as
- TEST: A sample player
- symbol: The filename of the currently loaded preset
- CL: Clear, sets all but a few values to 0
- U: Undo CL
- distortion,reverb,MASTER: operate on the total out, just before the limiter.
- MIDI (Each selection corresponds to a pgmin, 123,124,125,126,127, respectively, see below for more information)
- X: Default midi config, cc[1,7,8-64] available
- M: Modulators;cc[10-17] routed to ch1&ch2: p1,p2,cutoff,q controls
- E: Envelopes; cc[10-17] routed to filter- and amp-env controls
- R: Ranges; cc[10-17] routed to adr-min/max,cut-off min/max, resonance min/max, distortion, and reverb
- O: Other; cc[10-17] routed to rngmod controls, 3 wavetypes, and crossfade
- symbol: you may enter 8 cc#'s here to replace the default [10-17] from above to suit your midi-controller's knob configuration; these settings are saved to file upon entry
- vu: for total out to dac~
for-all-mod-types
- /wavetable
- graph: of the chosen wavetype
- part: partials, # of partials to use for the "rn" wavetype; the resulting, random sinesum is saved with the preset
- duty: dutycycle for the "du" wavetype
- type: sin | square | triangle | saw | random | duty | pink (pink-noise: a random sinesum with 128 partials, it is not saved with the preset) | noise (a random sinesum with 2051 partials, also not saved)
- filter-env: (self-explanatory)
- amp-env: (self-explanatory)
- rngmod: self-explanatory, except "sign" is to the modulated signal just before going into the vcf~
- adr-range: min,max[0-10000]; changing these values immediately recalculates all values for the filter- and amp-env's scaled to the new range
- R: randomizes all for-all-mod-types values, but excludes wavetype "noise"; rem: you must S or SA the preset to save the results
- U: Undoes R
for-each-mod-type
- mod-type-1: (In all cases, wavetable1 is the carrier and wavetable2 is the modulator); additive | frequency | phase | pulse | amplitude modulation
- mod-type-2: Same as above; mod-type-2 May be the same type as mod-type-1
- crossfade: Between ch1 and ch2
- detune: Applied to the midi pitch going into ch2
- for-each-clone-type controls:
- p1,p2: (self-explanatory)
- cutoff, resonance: (self-explanatory)
- navigation: Cycles through the saved substates of for-each-mod-type settings (note: they are lines on the end of a [text])
- CP: Copy the current settings, ie. add a line to the end of the [text] identical to the current substate
- -: Delete the current substate
- R: Randomize all (but only a few) substate settings
- U: Undo R
- cut-rng: min,max[0-20000] As adr-range above, this immediately recalculates all cutoff values
- res-rng: min,max[0-100], same as previously but for q
- pbend: cc,rng: the pitchwheel may be assigned to a control by setting this to a value >7 (see midi table below for possibilities); rng is in midi pitches (+/- the value you enter)
- mod-cc: the mod-wheel may be assigned to a control [7..64] by setting this value
midi-implementation
name | --- | Description |
---|---|---|
sysex | not supported | |
pgmin | 123,124,125,126,127; They set midi mode | |
notein | 0-127 | |
bendin | pbend-cc=7>pitchbend; otherwise to the cc# from below | |
touch | not supported | |
polytouch | not supported |
cc - basic (for all midi-configs)
# | name | --- | desciption |
---|---|---|---|
1 | mod-wheel | (assignable) | |
7 | volume | Master |
cc - "X" mode/pgmin=123
cc | --- | parameter |
---|---|---|
8 | wavetype1 | |
9 | partials 1 | |
10 | duty 1 | |
11 | wavetype2 | |
12 | partials 2 | |
13 | duty 2 | |
14 | wavetype3 | |
15 | partials 3 | |
16 | duty 3 | |
17 | filter-att | |
18 | filter-dec | |
19 | filter-sus | |
20 | filter-rel | |
21 | amp-att | |
22 | amp-dec | |
23 | amp-sus | |
24 | amp-rel | |
25 | rngmod-freq | |
26 | rngmod-sig | |
27 | rngmod-filt | |
28 | rngmod-amp | |
29 | distortion | |
30 | reverb | |
31 | master | |
32 | mod-type 1 | |
33 | mod-type 2 | |
34 | crossfade | |
35 | detune | |
36 | p1-1 | |
37 | p2-1 | |
38 | cutoff-1 | |
39 | q-1 | |
40 | p1-2 | |
41 | p2-2 | |
42 | cutoff-2 | |
43 | q-2 | |
44 | p1-3 | |
45 | p2-3 | |
46 | cutoff-3 | |
47 | q-3 | |
48 | p1-4 | |
49 | p2-4 | |
50 | cutoff-4 | |
51 | q-4 | |
52 | p1-5 | |
53 | p2-5 | |
54 | cutoff-5 | |
55 | q-5 | |
56 | pbend-cc | |
57 | pbend-rng | |
58 | mod-cc | |
59 | adr-rng-min | |
60 | adr-rng-max | |
61 | cut-rng-min | |
62 | cut-rng-max | |
63 | res-rng-min | |
64 | res-rng-max |
cc - Modes M, E, R, O
Jass is designed so that single knobs may be used for multiple purposes without reentering the previous value when you turn the knob, esp. as it pertains to, 8-knob controllers.
Thus, for instance, when in Mode M(pgm=124) your cc send the signals as listed below. When you switch modes, that knob will then change the values for That mode.
In order to do this, you must turn the knob until it hits the previously stored value for that mode-knob.
After hitting that previous value, it will begin to change the current value.
cc - Modes M, E, R, O assignments
Where [10..17] may be the midi cc #'s you enter in the MIDI symbol field (as mentioned above) aligned to your particular midi controller.
cc# | --- | M/pgm=124 | --- | E/pgm=125 | --- | R/pgm=126 | --- | O/pgm=127 |
---|---|---|---|---|---|---|---|---|
10 | ch1:p1 | filter-env:att | adr-rng-min | rngmod:freq | ||||
11 | ch1:p2 | filter-env:dec | adr-rng-max | rngmod:sig | ||||
12 | ch1:cutoff | filter-env:sus | cut-rng-min | rngmod:filter | ||||
13 | ch1:q | filter-env:re | cut-rng-max | rngmod:amp | ||||
14 | ch2:p1 | amp-env:att | res-rng-min | wavetype1 | ||||
15 | ch2:p2 | amp-env:dec | res-rng-max | wavetype2 | ||||
16 | ch2:cutoff | amp-env:sus | distortion | wavetype3 | ||||
17 | ch2:q | amp-env:rel | reverb | crossfade |
In closing
If you have anywhere close to as much fun (using, experimenting with, trying out, etc.) this patch, as I had making it, I will consider it a success.
For while an arduous learning curve (the first synth I ever built), it has been an Enormous pleasure to listen to as I worked on it. Getting better and better sounding at each pass.
Rather, than say to much, I will say this:
Enjoy. May it bring a smile to your face.
Peace through love of creating and sharing.
Sincerely,
Scott
how to limit DS array value range
By the way, i found a method to make the mouse plugin at least work without error messages: mouse-plugin.tcl
This creates a hidden file that contains a [r mouse_receive], opens it in the background and deletes the hidden file. This way there are no error messages, because there is always a receive present. It is still unclear how to determine the correct window from the focused window code.
Usage: Put the mouse-plugin.tcl in the extra directory, restart Pd, open a patch, create a [r mouse_receive] and connect it to a [print]. You can now see mouse movements and mouse up and down events.
Maybe this can be improved if a method like "ifexist" exists.
how to limit DS array value range
the problem also for me with the mouse plugin is, that you always need the [mouse receive] object in your patch if you want no error message. i think the best vanilla solution for getting mouse coordinates is this https://forum.pdpatchrepo.info/topic/10854/xy-abstraction-to-get-mouse-click-and-drag-coordinates-vanilla, but there is still a lot going on just for getting the mouse coordinates. an easy way to get mouse coordinates and a resizable drag area would be a nice addition to the data structure functionality (not sure if that would be possible...). yes, in some aspects they are unsatisfying
what can a blender make? the best blenders are incredible kitchen appliances
Most families have a kitchen blender of certain sorts. A portion of those blenders are more remarkable than others. A few clients are more proficient than others with regards to recognizing what a blender can do. Recognizing what your blender can do can set aside you cash and enhance your cooking experience just as spare you https://goodfoodblogph.com/ time in the kitchen.
Mixed Drinks
Each child realizes that blenders are remarkably acceptable at making mixed beverages. Blenders can make milk shakes, smoothies, natural product shakes, solidified beverages, and the more remarkable blenders can make squashed ice for margaritas and daiquiris. These beverages can be made with and without liquor. Blenders are ideal for family social occasions, local gatherings or for the each morning power drink.
The blender's capacity decides how smooth your beverage will be. On the off chance that for instance you are including almonds or carrots they will be separated into a lot littler parts the more remarkable your blender is. What's more, in the event that you do like lumps in your beverage and you have an exceptionally ground-breaking blender then you simply need to decrease the mixing time. Anyway it doesn't work the reverse way around. In the event that your blender comes up short on the force it will always be unable to deliver a truly smooth mixed beverage, particularly when utilizing more strong things.
Purees, Dips, Salsas and Soups
Blenders are the ideal kitchen apparatuses with regards to making purees, plunges, salsas and soups. You can make any kind of soup you need, simply include 1 cup of cooked vegetable, some cooked boneless chicken on the off chance that you like, and a ¼ cup of water to your blender. At that point mix until it is smooth enough for you.
You can without much of a stretch mix any of the accompanying: avocado cream, guacamole, cream of mushroom/tomato, Mexican salsa, dark bean plunge, new organic product yogurt, new pesto sauce, fruit purée, and some more. Numerous sound and fun suppers and bites can without much of a stretch be made with the correct blender, frequently setting aside you time and cash all the while.
Infant Foods
Who would not like to take care of its infant new and solid food. Blenders are a simple method to make a variety of various enhanced and supporting infant nourishments. From fruit purée to carrot puree to verdant green squeezes, all can be newly made and individualized to give you 100% control of what you feed your child. This will likewise spare you a great deal of cash as well.
Pounded Spices and Fresh Grinded Coffee
Envision pounding your own new espresso each morning, or on the ends of the week. Envision the smell and the full flavor that you get from newly crushed espresso. There is then no requirement for you to stop by a coffeehouse on your approach to work and drop $4 or more dollars each time you need great new espresso. The more impressive blenders can crush espresso beans as fine as you might want them to be.
Make your own newly ground pepper from peppercorns. You can even make your own pepper mix by combining various kinds of peppercorns. Do likewise with nutmeg, cinnamon and other dried flavors. Whenever you have visitors over for supper or BBQ dazzle them by revealing to them that you made the flavor blend yourself.
Crushed/Shred Meat
Make your own burger patties from lean cut meats and set aside cash all the while. Additionally, another preferred position is that you know precisely what meat is truly in your patty. Shred cooked meats for sandwiches, e.g., chicken or pork. For this Best Blenders suggests an incredible blender.
Cleaved Vegetables
Do you scorn cleaving onions? Why not utilize your blender? You need hacked carrots as well? Not an issue, utilize your blender. Utilize a low setting or the beat highlight on your blender https://www.flickr.com/people/blenderforsmoothiesreviews/ and the activity will be done right away. It doesn't make a difference on the off chance that they are dry or wet, a decent blender will cleave them to an ideal serving size in no time flat, sparing you time and tears.
Ground Cheese
You like including ground cheddar your pasta or making new pizza or meal? At that point why not utilize newly ground cheddar? It is exceptionally easy to do - cut your cheddar into 3D squares, throw into your blender and utilize your blender's heartbeat include until you have the cheddar ground to your ideal size. Newly ground cheddar consistently tastes better!
Serving of mixed greens Dressings and Mayonnaise
Practically any blender can make serving of mixed greens dressing. Pick your dressing fixings and mix until smooth. At that point bottle it for next time or to take it to the workplace or cookout.
For mayonnaise the fundamental formula is two eggs, 1 tsp. mustard and ½ crushed lemon (whenever liked), mix at fast until foamy, at that point gradually include 1 ¼ cup cooking oil and keep on mixing at rapid until thick and rich. Spot not utilized segment into a container and store in cooler. All new and scrumptious, and everything is without additives.
Crushed Whole Grains
You like eating entire grains? What about creation entire grain flapjacks? It is without a doubt less expensive than locally acquired blends, and truly easy to do as well. Most don't know that a blender can deliver a fine powder from entire grains. The blender ought to have more force than a normal home blender for this errand.
Frozen yogurt
Make the most extravagant seasoned frozen yogurts ever with your blender. Ideal for birthday celebrations or home film evenings. Truly easy to do as well, as relatively few fixings are required. It is additionally remarkably simple to store your newly made frozen yogurt in the cooler until one week from now or the end of the week after. With a bit of testing your companions will before long be advising you to bundle your frozen yogurt and sell it. To make frozen yogurt your blender will require enough mixing capacity to have the option to deal with solidified products of the soil in the event that you decide to utilize them. The more remarkable the blender the creamier and smoother the frozen yogurt.
Additive Free Fresh Nut Butters
Make your own new nutty spread, or almond or cashew margarine. Ideal for snacks, picnics or bites. This can be a solid and reasonable choice to locally acquired items. Envision the expression on your companions faces when you disclose to them that you make it yourself. Here is the way to make new nutty spread https://gab.com/topbestblenderreviews without any preparation utilizing your blender.
First mix 2 cups of cooked peanuts and ½ tablespoon of vegetable or nut oil until it becomes glue like. At that point taste and if necessary include minuscule amounts of earthy colored sugar, nectar or salt to fit individual taste. On the off chance that you like your nut spread crunchy, include some more peanuts at the end and mix just for a couple of moments. Best Blenders suggests the more remarkable blenders for this kind of mixing.
Cloning kslider object from Max 7 - GUI keyboard
@ingox, first
Thanks a lot!!
Now, I have no errors in pd window! thanks for the Find -> Find Last Error TIP!
Concern to mouse click selecting more than one key, I make a test and have some strange behavior...
I draw the keyboard without bounds
and in black key bounds I can select a white key simultaneously!! So weird... :/
Here the patch => kslider_draw4.1.pd
I will report it to pd-list, sounds like a bug for me.. I don't know...
Wherever can be exist another solution for this problem. Once I need to enable mouse click and drag to press the keyboard keys dynamically, the color change behavior can be controled with mouse position tracking in GOP.
For that I think:
-
Use external [iemgui/iem_event] to track mouse in GOP
-
Use [cyclone/mousestate] to track mouse click
2.1 when click create a tiny scalar with data structure on mouse position
2.2 map x y pos of tiny scalar
2.3 mouse click off destroy tiny scalar.
The think 2 are better, once I want to submit these object to cyclone library.
I don't find documentation to delete scalar from data-window yet. Any documentation I lost..??
Thanks again!
[Experimental] Vanilla xy-pad / Very heavy data structure
@ingox I see! you want to arbitrarily pick up the x/y position of the mouse click then output the mouse x/y while the mouse button is pressed.
Without the output of the mouse x/y when clicked and no tracked x/y mouse-movement and then no mouse-up x/y, I would say not possible without externals
send list to outlet in external
Thanks for your advise about the clock method. As this is quite important, this information should be given somewhere (In externs/dspobj~.c which comes with pd for example)
What are own inlets? Is a second inlet~ already an own inlet?
Can you point me to the source of [pack]? (Couldn't find a file "pack.c" or similar in pd's repository on github.)
Do I have to free memory I allocated myself with malloc?
(I just started with C (coming from Python), so I'm still unsure about how things work exactly.)
To leave a working example, here's my corrected code:
#include "m_pd.h"
static t_class *maximum_tilde_class;
typedef struct _maximum_tilde {
t_object x_obj;
t_float f;
t_clock* m_clock;
t_inlet* x_in1;
t_outlet* f_out;
t_atom at[2];
} t_maximum_tilde;
t_int maximum_tilde_tick(t_maximum_tilde *x) {
outlet_list(x->f_out, &s_list, 2, x->at);
}
t_int *maximum_tilde_perform(t_int *w)
{
t_maximum_tilde *x = (t_maximum_tilde *)(w[1]);
t_sample *in1 = (t_sample *)(w[2]);
int n = (int)(w[3]);
float max[] = { 0,-1 };
float abs_val = 0;
for (int i = 0; i < n; i++) {
abs_val = fabs(in1[i]);
if (abs_val > max[0]) {
max[0] = abs_val;
max[1] = i;
}
}
SETFLOAT(x->at, (t_float)max[0]);
SETFLOAT(x->at + 1, (t_float)max[1]);
clock_set(x->m_clock, 0.f);
return (w + 4);
}
void maximum_tilde_dsp(t_maximum_tilde *x, t_signal **sp)
{
dsp_add(maximum_tilde_perform, 3,
x,
sp[0]->s_vec,
sp[0]->s_n);
}
void *maximum_tilde_new(t_floatarg f)
{
t_maximum_tilde *x = (t_maximum_tilde *)pd_new(maximum_tilde_class);
x->f_out = outlet_new(&x->x_obj, &s_list);
x->m_clock = clock_new(x, (t_method)maximum_tilde_tick);
return (void *)x;
}
void init_maximum(void) {
maximum_tilde_class = class_new(gensym("max~"),
(t_newmethod)maximum_tilde_new,
0,
sizeof(t_maximum_tilde),
CLASS_DEFAULT,
A_DEFFLOAT, 0);
class_addmethod(maximum_tilde_class,
(t_method)maximum_tilde_dsp, gensym("dsp"), 0);
CLASS_MAINSIGNALIN(maximum_tilde_class, t_maximum_tilde, f);
}
void helloworld_setup(void) {
init_maximum();
}
send list to outlet in external
Hi,
I try to write an external, which sends a list to an outlet.
The following code is an example of calculating the maximum of a signal and send the maximum and it's index to the outlet.
But line 30 outlet_float(x->f_out, (max[0], max[1]) ); does only send one value to the outlet.
How can I achieve to send lists?
Thanks for help in advance,
Xaver
#include "m_pd.h"
static t_class *maximum_tilde_class;
typedef struct _maximum_tilde {
t_object x_obj;
t_sample d;
t_inlet*x_in1;
t_outlet*f_out;
} t_maximum_tilde;
t_int *maximum_tilde_perform(t_int *w)
{
t_maximum_tilde *x = (t_maximum_tilde *)(w[1]);
t_sample *in1 = (t_sample *)(w[2]);
int n = (int)(w[3]);
float max[] = { 0,-1 };
float abs_val = 0;
for (int i = 0; i < n; i++) {
abs_val = fabs(in1[i]);
if (abs_val > max[0]) {
max[0] = abs_val;
max[1] = i;
}
}
outlet_float(x->f_out, (max[0], max[1]) );
return (w + 4);
}
void maximum_tilde_dsp(t_maximum_tilde *x, t_signal **sp)
{
dsp_add(maximum_tilde_perform, 3,
x,
sp[0]->s_vec, data forum
sp[0]->s_n);
}
void maximum_tilde_free(t_maximum_tilde *x)
{
inlet_free(x->x_in1);
}
void *maximum_tilde_new(t_floatarg f)
{
t_maximum_tilde *x = (t_maximum_tilde *)pd_new(maximum_tilde_class);
x->f_out = outlet_new(&x->x_obj, &s_list);
return (void *)x;
}
void init_maximum(void) {
maximum_tilde_class = class_new(gensym("max~"),
(t_newmethod)maximum_tilde_new,
0,//(t_method)maximum_tilde_free,
sizeof(t_maximum_tilde),
CLASS_DEFAULT,
A_DEFFLOAT, 0);
class_addmethod(maximum_tilde_class,
(t_method)maximum_tilde_dsp, gensym("dsp"), 0);
CLASS_MAINSIGNALIN(maximum_tilde_class, t_maximum_tilde, d);
}
void helloworld_setup(void) {
init_maximum();
}