• ### Filtering numbers

Hi.

Im making a simple step sequencer and using midi faders to control the value of each step.
At the moment im taking the 0 - 127 value of each fader, converting that to a frequency with mtof to control an osc.
Quite simple, but i was hoping i could implement some way of filtering out the numbers i dont need to fit the output to a specific key.

So far, my idea is to divide the 128 into 8 distinct ranges that correspond to one note of a musical scale.

For example, if the fader reads anything from 0-15, then i would like to output 24 to a float. If the fader reads 16 - 31, i would like to output 26 to the float and so on.

Ive tried using logical objects to achieve this, which had some success but the patch became quite complex and unreliable in ways that i couldnt troubleshoot. There are a number of gaps in my knowledge, so i am sure im not approching this as efficiently as I could be.

Im quite new to puredata and programming in general and i hope im explaining myself properly, so please forgive me if im missing something obvious, but a few pointers, or any ideas on how to proceed at all would be great.

Thanks.

• Posts 7 | Views 404
• @dbts There will be many ways to do this.
Or you could use the [expr] object...
or.....

It can be used as an abstraction...... so used many times...... and could be given arguments (\$ values) so as to produce different results.
Have a look at this...... https://forum.pdpatchrepo.info/topic/9774/pure-data-noob/4....read the text before playing with the patch...... and you will quickly get an idea of how abstractions help you to work faster and to keep your patches tidy and easy to read.......
David.

• @dbts I made an abstraction that maps incoming midi values to a given scale. The scale can be set freely and also be changed on the fly. With simple arithmetic you can adjust the input to a desired range if necessary.

https://forum.pdpatchrepo.info/topic/11722/mscale-transpose-notes-according-to-given-scale-and-root

• as @whale-av pointed out there are many ways to do this, but the most appealing to me is
[div 16]
I
[* 2]
I
[+ 24]

this way you can scale your ranges and shift your notes up and down, i.e. [+ 36] would be one octave higher.

• @dbts I'll add to the discussion the two ways I did it:

[f2scale] remaps the input float to a scale chosen from a list, you specify the scale name and the base midi note. I find this is handy for standard scales (I found the included scales on some website somewhere, I'm not sure they are completely accurate), but you can add your own custom ones at the end of the [text] object.

[subset] is simpler and just quantises to a specified list, you can provide the list in the arguments which I find very practical. I made it to use with other abstractions for alternative equal temperaments and just intonation tunings, but I guess it's helpful on it's own too.

f2scale_subset.zip

See the relative help files for how to use them (the other abstractions are just used in the help files).

• @weightless thanks for sharing!

• Thank you all for your suggestions.

Posts 7 | Views 404
Internal error.

Oops! Looks like something went wrong!