Signal processing (lists, maximum and values appeared most times)

G Mrln's icon

Hello,

In a patch I am trying to make, I use first of all the fzero object to obtain signal frequencies. From the out left outlet, I get the estimated fundamental frequency in Hz. I haven't managed to find which is the sampling time (i.e. one frequency sample every second)?
Apart from that, I use the peak object to get the maximum numbers from a signal. Do you maybe know how I could store each maximum until I reach the highest one? I would like at the end of the signal to have a list with all the highest numbers appeared.

Also does anyone know how I could find which was the value that appeared most times? I tried to do that using mathematics, but what I thought until now doesn't really match MAX/MSP objects.

Roman Thilenius's icon

if i am not mistakten, the "sampling time" of fzero will always one vector.

regarding a collection of running max signal values, maybe you can use maximum~, reset it from time to time, and then convert the max values to a message? as numbers those values are much easier to store somewhere.

first thing i would do to find the number which appears most would be
zl sort
zl iter 1

then you can compare each number with the next one and count how often each different value appears.

mzed's icon

fzero~ reports a new frequency value based on the period attribute. The default is 256 samples, but can be other higher or lower powers of two, down to the signal vector size. Look at the settings tab in the help file.

G Mrln's icon

Thank you for your reply.
Roman I think that what you said for finding the values that appeared most times wouldn't work because by reseting maximum once in a while, I will get again values that might be smaller than the previous maximum if you get what I mean. So I am still kind of stuck with this.

Also I managed to take the different maximums from a signal, but I would like to store each one of them in a message to use those numbers later on in real time.

Do you maybe have any ideas on that?