How to pick the 7 peak (more repeated) numbers among a group of hertz value.
I want to pick the most repeated, relevant, or peak numbers from a group of about 140 numbers, where the respective distance among the values be about 10 consecutive numbers.
After obtaining the 7 or 10 relevant numbers, how will I set the list of groups be changed to these relevant numbers (to the 7 or 10 numbers)? Change all the numbers and be substituted by the relevant chosen numbers.
Here are some sample numbers: 1st is the index, 2nd is the time measure, 3rd is the value of a note. The interesting value numbers are the hertz value numbers, according to the 3rd colon in the list.
I don't really understand what you want to do,
but look into zl objects and maybe coll.
This patch extracts the 7 most frequent values, in decreasing order, out of a list of 140 numbers (Edited):
Dear Sebastien,
I appreciate your input; the file you sent me will greatly help me.
I wish I could talk to you about a similar issue.
With kind regards.
Berhane
Dear Sebastien,
The first issue is solved. This means that the more repeated numbers are found. I will take them as having seven notes of music scale, of course, they are a little different from the European style. But I am interested in the algorithm process.
The second issue is to change all those numbers into the 7 relevant, more repeated numbers. How can I tell the computer to change all the available numbers in the basket, that is different from the 7 notes be changed into the new note or code. Therefore any number that is very close to the 7 note be assigned one from the 7 notes. Any different that the 7 number should stick with the available 7 notes only.
I appreciate your input. Berhane
Berhane, could you provide real concret examples of what you want to do ? It may be easier for me (and others) to understand what you want to do with those numbers.
you talk about Hz, means you have audio recording ?
And try to notate it using diatonic scale ?
After retuning notes ?
look into ftom
Dear Sèbastien,
Thanks for your quick reply.
I thought you had some helpful and further support from your part or someone you know. I would like to have someone to help me out on this issue, even with decent pay.
Thanks for asking, anyway, Berhane
Hey Berane. I wasn't available today. Did you delete your last post ? I'm still trying to figure out what you concretely want to do.
As suggested by Source Audio, [ftom] can convert frequencies into midi notes values. Like this for instance (where [fzero~] calculates the fundamental frequency of each note received from the audio source ) :
I dont't know it really helps ....
if you want to find the most frequent identical list elements, and you want to avoid comparing each against each, the first thing you should do is to sort the list.
Thanks dear Roman, Berhane
Dear forum,
How can I compile a group of numbers with too many short gups? I want to order all of them according to the scales, set them in 5 or 7 chosen numbers, or use a scale of notes. Here are samples of data with a relative scale.
Here is the data:
187 187 187 132 141 141 141 162 168 168 207 213 210 189 165 174 216 222 216 222 216 225 213 207 207 168 171 207 210 150 138 150 153 171 207 174 168 177 186 186 141 171 171 207 213 225 216 219 228 225 213 171 168 174 216 225 228 216 231 177 177 177
And here is the scale: 108 132 150 168 207.
The data should be replaced according to the scale, so the numbers should turn up and down to match with the scale.
Thanks, Berhane
you want to quantize Set A to Set B?
(this is not answer, this is question)
like this what you want?
***there is no 108 in your first long list
this one map the first list to list 2
Dear Wil,
I checked the results, but the reply seems to be the same as the list printed on the scale.
According to me, the given lists should be replaced by a number that exists in the list of the scale. Therefore all the available lists should be replaced by a value that exists in the scale, which means any list different than the scale should adjusted to a very close number on the scale. The solution should include all numbers in the list, and not be sorted for I need to follow up the existing list of order.
For example, the solution of the list above should be replaced as the following. Here is a sample solution of the above list that I should get:
168. 168. 168. 132. 132. 132. 132. 168. 168. 168. 207. 207. 207. 168. 168. 207. 207. 168. 168. 207. 207. 150. 132. 150. 150. 168. 207. 168. 168. 168. 168. 168. 132. 168. 168. 207. 168. 168. 168. 168. 168. 168.
Ok.
You want to swap the scale into each closest number on the larger list. I Understand.
This:
187 187 187 132 141 141 141 162 168 168 207 213 210 189 165 174 216 222 216 222 216 225 213 207 207 168 171 207 210 150 138 150 153 171 207 174 168 177 186 186 141 171 171 207 213 225 216 219 228 225 213 171 168 174 216 225 228 216 231 177 177 177
Replace each number with closest from this:
108 132 150 168 207.
187 becomes 168 (three in a row) then 132 stays 132, then 141 becomes 132 etc..
That would be what Roman said- quantize
Quick&dirty ;-) ?
SÉBASTIEN GAY nice and dirty!
I really want to figure out a dynamic version - been looking for a way to do dynamic multisplit for my own work :0
Dear Sebastien,
exactly, this outcome is the correct answer I need it.
If I can, I would like to know if there is a short wys to get the same output. Or if there is a formula that can be built the outcome that comes from the split. I mean a mathematical formula that solves the algorithms of the "split" object.
Thanks for the solution, and for your quick reply dear. Berhane
yeah, he wants to-nearest, which makes it tricky. i have something like that, but will not post it because with my old version of max such things are getting really huge.
i´d start similar to sebastien:
- iter Set B into groups of 2 elements
- find the mean of these pairs (the split point)
- check the incoming values from Set A for >, == or < against all those mean values of Set B
- route the result to three different directions / let pass or not, aka dynamic mapping. (if not passed, try next mean value until you find a match)
>> I mean a mathematical formula that solves the algorithms of the "split" object.
i don´t think there is such a solution, but you might try to use generic iteration/forloop methods or poly~.
otoh it should be ok to limit it to 80 or so serial split objects.
if you have somewhat experience with vexpr this can also help to make that patch shorter.
Just waiting for SOURCE AUDIO :0
thanks - will reverse engineer this for later
here is the patch
Here is the source code, dear Wil:
good stuff, much shorter than mine. how would you add round-up to yours?
Dear Source Audio,
the last patch is done perfectly, the one I dreamed about. I find it very efficient to resolve a very complicated scale issues. Thanks so much
Good to try to understand what happening
for using later
@Roman
do you mean to snap to higher of 2 closest matches ?
if value is 111 and list to snap is 100 150 200, then 150.
if 99 then 100
if 151 then 200
if 3000 then 200
maybe like this
i havent tried yet but i just thought of a solution: one could simply invert the values of both sets to round into the other direction. but i do not get it to work.
if value is 111 and list to snap is 100 150 200, then 150.
nono - but that would also be an interesting mode. ("truncate"?)
i mean just rounding in both directions when a value is exactly between the values from Set B, like 15 vs. 10/20
(if we are sure that input is int-only, we could do + 0.1 (or + 1), but that seems unelegant.)
Ok, I see.
about simplest solution - adding 0.1 or 1.
would be ok in this case, as I don't think values
to quantize to would be so close to make a difference if input would be higher that little.
complicated solution is to check if sorted list has more than 1 "winner"
and if yes than retreive 2 values and pick higher one.
in case input is exactly in between 2 quantize values, result has 2 indentical values.
that 2 values get sorted and higher one picked.
i mean just rounding in both directions when a value is exactly between the values from Set B, like 15 vs. 10/20
I too need this solution rounding pitch frequency when playing bass - slightly out of tune, vibrato etc.
Kind of like pitch detection, but instead finding the distance between each pitch and map the nearest correct pitch
Pitch frequencies get further apart as they get higher
But instead of sending a list to quantize. Just need to quantize individual frequencies
In some sense this might also work to quantize motion sensor distances
Also I can use bass to play synths along with the bass! - really good for ear training
for pitch in between, it is enough to use mtof and mtof 0.
get float difference, and snap up or down depending on closer match.
when i think about it, this application/problem basically only exists for the int-mode of a quantize Set A to Set B patch, isn´t it?
so eventually +1 would be good to go already.
silently moving the offset to Set B
Dear Forum People, I appreciated all the effort made to best solve the question. The addition of using a decimal place also collaborated to finish up optimal evaluation.
Thanks, Berhane
@ Berhane - You are welcome !
@ Roman - that is good one with switch to round up.
P.S.
I forgot about zl.lookup in my first patches, it is easier to deal with then with zl.mth & zl.reg.
Dear Source Audio,
I liked the observation made on your comment.
About the zl.lookup & zl.reg is interesting point. If your know where to refer to get better explanation would be good, beside the reduced info edited in the documentations.
While the zl.mth issue is about the starting point with zero.
I appreciated your input. Berhane
if you want to know more about zl objects see their help file and reference.
In this case zl.lookup serves the same as combination of zl.reg and zl.mth.
so zl.lookup is better because only 1 object is used.
zl.lookup was not part of zl objects in max 4 - max version I spend most time with.
and even that it is kind of obsolete since many years, I still refer to it in my mind.
Dear Source Audio,
Thanks for the illustration sent recently. I greatly appreciated it. Berhane
zl.lookup was not part of zl objects in max 4 - max version I spend most time with.
OT: luckily i got at least working solutions for @scalarmode and .sort in v.4. :)
Dear Roman,
[silently moving the offset to Set B]
the above patch wwritten before the last one doesn't work properly. It didn't work out for me, and the true value comes always 0. Can you check that algorithm please? Thanks, Berhane
i am out of ideas, maybe @source audio could check it?
all it does is this additional -1 to Set B before the matrix comparison even starts.
This is one of several threads from berane9 that should serve
(if I understand it correctly... ) transcription of recordings of Ethiopian or
similar music .
Questions about it started 5 years ago, without really providing simplest description
about the process he/she goes about managing that task.
Which could be done fairly simply, if one knew what to deal with.
For that reason I don't see how to help really, because we are trying to fix here
some bits and pieces of the process which might or might not be the right one at all to do the task.
Dear Forum,
The issue here is that the last patch was not working properly. I raised the problem of that patch. But I am interested on this specific patch. For me, it didn't work and that's it. Thanks for the feedback.
However, the previous solution are best solution, I am taking advantage of them. Thanks.
if you relate to 2 screenshots Roman posted on
Oct 20 2024 | 3:41 pm and Oct 20 2024 | 3:48 pm
they both work as expected, and that's it.
Problem could be that you typed something wrong ?
Can happen easily when trying to make a screenshot into a patch.
here comparison of both:
also as patch