• ### Newbie stuck on canvas colour control.

Hi how are you, ye or y'all?

I am having a problem with a simple connection math issue.

I am trying to write a programme which would be a learning tool for the 12 times tables. 2 sliders (left and right) both numbered 1 to 12. I have a subpatch which is controlling the arithmetic.
Each number on the left is a colour, each number on the right is a progressively darker shade of that colour so that the answer is displayed numerically and visually (3x1 = light yellow, 3x12 = very dark yellow) . there's the basic premise.

MY ISSUE.
The left slider bangs the sum, the right slider needs to be moved and then banged which is annoying. The sum is at least correct.
If I wire it differently both sliders bang the sum but the answers are all wrong.
How can I wire it so each slider bangs the answer (and colour canvas) as well as giving the correct answer?

I hope this makes sense.

• Posts 29 | Views 18666
• I guess you need [trigger]. Check its help patch. The right slider should connect to a `[t b f]` ("t" is short for trigger, "b" for bang", and "f" for float). then `[t b f]`'s left outlet will go to the left inlet of the multiplication object. the right outlet will go to the right inlet of the multiplication object. `[t b f]` has a right-to-left execution order, so the float will go out first to the right inlet of `[* ]` and then the bang to its left inlet, triggering the output.

BTW, it's better if the title of your thread describes your problem better, "Newbie here stuck on a simple problem" doesn't say much, and many people might not even bother to take a look.
Also, once solved, better edit the title and put a "[SOLVED]" in the beginning...

• @alexandros
Thanks for the reply, I'll give it a try and get back to you. I had tried 't f f' and 't b b' but I never thought of t b f

• Thats great thanks so much. i was close but there's quite alot of guess work/ trial and error gos on this end.

Would it be too cheeky to pose another query?
(let me know if it warrants another thread.)

Its the mechanics of this one as much as the actual connections that are keeping me up at night.

As before (same programme/ patch) 2 sliders 12 numbers each.

How would you go about allocating number 1 (left slider) to a particular colour (same for each number all the way to twelve).

And theeeen allocating each number on the right slider to a particular shade of that colour.

I'm thinking a send object from number box under slider to colour subpatch ( a receive object for red, green and blue) That will give me a good start, but that doesn't really give any control. The right slider will need the same with even more specific.

If I could attach my file here I would.

Any thoughts would be much appreciated.

• Attaching your patch would help a lot, cause describing it is too much theoritical...
Anyway, what do you want to color? The slider or a canvas? Check the help files of both and check the [pd edit] subpatch. All the messages that change their attributes are in there. That should be a good start..

• number by colours.pd

Thanks so much for your input.

I am trying to colour a canvas with the sliders controlling the colour. Where I want the left slider to be just green (for 6 times tables lets say), I want the right slider to control shades of green (1 being very pale green, 12 being very dark green)

So for kids with difficulty learning multiplication the have a visual colour reference. For example they can remember that the 5 times tables are red. 5x1= very pale red, 5x2 is slightly darker etc etc and 5x12 is dark red. 6 times tables are green, 7 times tables are orange etc etc.

Where some people have perfect pitch some have perfect perception of colour.

Please excuse my messy little patch, the notes are my way of not forgetting what I want to do!! I've only been doing this for a few weeks so I'm still quite confused by alot of it.

Thanks again for taking the time,
Cheers.

• @delphineTA Hello again Delphine...
Sorry, I have no time to build you the patch straight away (someone else might) but here is a pointer..... Magic.zip
Open the file "no_magic" as the other one is just for fun, and rather confusing.......(that was a health warning!!).....

To get rid of your red rectangle "right click" on your canvas and de-select "Graph_on_Parent".

In my patch click the top bang, or press key 1 on your keyboard.
As you will see, you can fade out a colour because 255 255 255 is white, so you just need to reduce the 3 values progressively from your strong colour selection.
You need to make good strong colours from the rainbow for your left slider, and you can send messages (as in my patch above) to set those colours. Then for your right fader divide those colour numbers by the fader number to get the colour brightness (s)....
David.

• Thanks very much, I'll have a look at that after my lunch. I think my biggest problem is that there is a way of thinking involved with pd that is confusing me. I found other programmes ok such as Csounds but I'm a bit at sea with this!!

Thanks again.

• @delphineTA Hello Delphine,
Here is an approximate patch for the colours and their brightness. As you will see, being able to really tell them apart is difficult...... Maybe I have misunderstood though?
colours.zip
David.

• @whale-av Thats quite close to my idea. For some reason all the text in the boxes is un-readable. Is my pd acting up?
The text colour and background colour are all the same. The only colour I can chamge is that of the canvas.
The sliders you have used were changing for me and now the black box has stopped. My copy of pd can get quite buggy and sticky at times.

If I get my head around your patch would it be ok to use elements of it?

• @delphineTA I have very slightly advanced on your patch....... "colours.pd" is what we call an abstraction. You can place it as an object by putting the object [colours] and then connecting to its inlets (left inlet bold colour, right inlet brightness).
colours3.zip
open your "number_by_colours.pd" patch............ (we never put spaces in names, because they are special....... you will see why later).......

You still need to add some strong colours........ like cyan? [0 110 90( to the colours.pd abstraction so as to get to your 12 colours!

I have placed it twice in your patch. Because it contains \$0 as a variable every instance is an "individual" copy and they do not interfere with each other.
So.......... if you edit colours.pd then you will edit every copy used in your patch. It's as though you typed [random].......... you can use it as often as you like (but keep it in the same folder so that Pd can find it.
I know....... I am hitting you with new stuff that is a bit hard to understand, but once you get your head around it the power of Pd will be yours!!
You will see as well that I am using the "Graph_on_Parent" red box (that you could not get rid of), so as to show the coloured canvas in colours.pd on your ("parent") patch......... enjoy!
David.

• @delphineTA Hello Delphine............ a couple of corrections, and an idea for a "pretty" slider/fader, as I don't know of a way to add ticks to a slider.... I have added it ([fader_mine]) to your patch........colours4.zip
David.

• Thank you so much for your help. I'll sit down and tackle it later and report back to you.
If you were a neighbour there would be a bottle on your doorstep in the morning

• @delphineTA You are very welcome..
Here are some small refinements, and some fun!......
colours5.zip
David.

• Thanks again, got some great ideas on how to connect up the colours to correspond with the numbers. Weird thing is on your patch the slider bar doesn't slide but the slider does work! The wacky world of computers eh?!

• i think that is because of the [metro 1] which bangs once per millisecond change that to [metro 10] and you have a bang every 10ms, or even 100ms, that should relax the GUI..
@david thanks for the cool color-patch summary

• @Johnny-Mauser Hello Johnny.......
I think it's more likely a gop problem, as the slider is actually working.... just not displaying on the parent.......
http://forum.pdpatchrepo.info/topic/8226/dynamicaly-created-gop-s-frozen-until-child-opened-the-first-time
If this is happening for you as well maybe you can investigate it. I don't have the problem on my system. I wonder here if it might have something to do with the internal canvas co-ordinates in tcl, as the original patch that I added these abstractions to had scaled really abnormally on my windows system (huge fonts and the canvas "3 screens" wide).
David.

• Yea, I tend to put the font at around 16 and I use a large external monitor which I tend use all of. I find it a real strain to stare at all that tiny detail on my laptop screen.
Interesting to note that it may interfere with the GUI.

• Right,
I have tried frankensteining various ideas and have come up with this:
number by colours G.pd

My slider stopped moving so as a work around I plugged in a bang, so the user chooses number and hits bang. Thats fine. Left slider seemED to work well, each number having a colour.

When I tr plug in the shade patch the slider doesn't work at all
If you go into my colours subpatch you will see how I tried to incorporate the incremental shade element.
Copy and then delete everything on the right and the left slider should come back to life.

Why?

Im close to finished, The random sum generator and colour works well and Im happy with it. All I need is to get the shades working, which is nearly there but now the sliders are dead!

I just cant get it to work.

• number by colours G 1.pd

Look at the left slider in all its glory

• @delphineTA Hello Delphine....... that will take some investigation. Do you need the faders, or would clicking on the numbers be enough? I have posted a newer version below.... please let me know if it works.......
I know that the faders will not move if you click on the numbers alongside, but you should be able to drag the faders and they should move. Also, clicking the numbers alongside the fader should change the colour even if the fader does not move.
I have removed the metro as well as Johnny suggested.......
A last question...... what is your operating system and what version of Pd are you using?
colours6.zip
And here is your patch (number by colours G 1), corrected I think. Everything should work, and the correct answer will give green and the wrong answer red..........
delphine_g1.pd
David.

Posts 29 | Views 18666
Internal error.

Oops! Looks like something went wrong!