Beginner needs some help!

smaria's icon

I want to use "mouestate" to have sound of a song be controlled by the user. The goal of my patch would be that when the mouse (use the mousestate object) goes up the highs would be magnified and isolated, when the mouse goes down the lows will be magnified and isolated. To pair visuals with this, I would like to add "bgcolorfill" to the patcher so that when the frequencies are higher the patcher turns red and when the frequencies go lower the patch turns green - again probably using "mousestate" in order to control the color by moving the mouse up and down; ie up = red, down = green. I just need some general help on how one might get started with this project. Thank you so much if you took the time to read this and help in anyway!! all tips are appreciated sincerely.

👽!t W∆s ∆lienz!👽's icon

check out the helpfile for the "filtercoeff~" object(try a 'gain' of "0.8" and a 'q' of "2." to start with for the 2 parameters there), you could choose "bandpass" from the mode-menu there, and instead of the cycle~ object going into the frequency input, you can just use the vertical-position outlet of 'mousestate'(except you'll need to scale for the vertical resolution of your screen by dividing by the maximum - if your screen's resolution goes up to 900. for example, you divide the mouse-state outlet by 900., this gets you the range of 0. to 1., then send the rest(via [sig~]) into the multiply-by-400 in that patch).
from there, you just need to tune the range and the center-freq: the multiply by 400 gives you a range of frequencies up-and-down within 400Hz, while the [+~ 1500] object sets the minimum freq around 1500Hz(allowing you to sweep between 1500Hz and 1900Hz: a 400Hz range starting from 1500; i'd try 4000 instead of 400, and 150 instead of 1500 to sweep between 150Hz and 4150Hz).
two last things, is that you'll need the 'sig~' object to turn the mousestate's floating-point output into signal, which can then be fed into the rest of the helpfile patch there, but it's best to do the divide by 900(or whatever your vertical resolution is) outside of the signal realm.... and also, the bottom of the screen is usually the higher value, so you'll need to invert things after the divide by subtracting everything from 1(use a [!- 1.] object for this).
so it might look something like this, all can be tested from within that "filtercoeff~" helpfile:
[mousestate] -> [/ 900.] -> [!- 1.] -> [sig~] -> [*~ 4000] -> [+~ 150] -> [filtercoeff~ left/frequency-inlet] -> the rest is same as the "filtercoeff~" helpfile from there.

for the coloring part of your question, you can basically just connect the coloring to mousestate since mousestate controls the frequencies(as an example the output from [/ 900.] could go to "red" value, while [/ 900.] -> [!- 1.] could go to "green" value, this would raise one by lowering the other in tandem(that might give you a mix of coloring in the middle which might not be what you want...)... but if you try it in patch form first, upload here if you have troubles and someone can help you further more easily)

for more information on filtering, there are tutorials here under the "Filters and Subtractive..." section:
https://docs.cycling74.com/max8/tutorials/00_mspindex

hope that helps get ya started 🍻

smaria's icon

Thank you so much for the encouragement and help!! I will be looking into everything you said. I already have a better understanding of what this will look like.

Cheers!
-Sam

Roman Thilenius's icon


even if you want to run it in "fullscreen mode", it CAN be easier to do the mousetracking and the color using the [lcd] object.

smaria's icon

Oh okay I will be looking into that. Thank you!