• ### A Strange Idea

This is a little tricky to explain but...

I have been trying for a while to create something which measures the amount of change in a signal, regardless of if it is positive or negative.

e.g. if a signal went from 0 to 1 then to -1 the signal would have 'travelled' 3. But I am not simply after a static number, I want something that is operating in real time.

This is where (for me at least) it get complicated, as it will need to act like a compressor having an attack, and decay, but no threshold. The measurement of the amount of change will be a number.

My difficulty is trying to imagine how the latter part of this would work. I can make the change of the signal a continuously ascending number, but I can get much further beyond this.

I know this is kind of vague, but I'm still struggling at the conceptual stage and would appreciate the input of more experienced people than myself.

Thanks for any help and apologise if the quantity of the word change in the above made you have flashbacks to America's previous election.

Fly

• Posts 11 | Views 5039
• What I think you might be looking for is the integral of the absolute value of the derivative. the 'change' is the delta, the 'amount' is the undercurve, and the 'regardless of positive or negative' is the absolute value.

http://www.pdpatchrepo.info/hurleur/change.amount.regardless.pd

any technology distinguishable from magic

• Hey Sunji,

Thanks for the help; I've actually got that far, although your code is more concise than mine. It's the next part I'm stuck on:

All we currently have is an ascending number. The next part is to measure the rate at which that number is ascending i.e. the rate of change in the signal. I intend to use this to actually measure waveforms in real time.

To give an example:

I'd like to measure a waveform and have the "change rate" control the cutoff for a filter. As the change increased the cutoff pitch gets higher, and as its change decreases the cutoff pitch goes down. This will require both an attack and decay otherwise there will be clipping when the change starts and stops.

My problems with this are:

How to sample the signal and turn the change into a readout
How often to sample the signal? 44000 sounds like a lot, but if it's audio should that be the rate?
How to effectively add an attack and decay

I hope this makes some sense - its not the easiest idea to communicate.

Thanks again,

Fly

• If you want the rate of change of your continually ascending value, just [delta] it again. That value will be the same as:

[delta]
|
[abs]

in the patch I uploaded. What is the goal here?

any technology distinguishable from magic

• that does give me the change, but the problem is that if it is used to control and audio signal there will be clicks.

The aim is this: to have a complex waveform which controls the pitch, and the rate of change controls the amplitude. For this to sound good there must not be clicks, and some level of control over how much the change alters the amplitude.

I hope that makes some sense?

• i think i see what you're trying to do, and my recommendation is that you look into working with the [env~] object. you can set this to run at faster window sizes, and it might be a good base for you here.

for what you're doing, maybe try taking the change between each two successive [env~] readouts? not sure how fast you want to set the window, but i just tried [env~ 16] and it gives the expected curve for a 400hz sine wave, so that's probably fast enough for most applications. You might want to set it higher even, say [env~ 64] or something.

• oh ya signals...

[delta~]
|
[abs~]

does that make clicks?

any technology distinguishable from magic

• Thanks again,

I think I'm a bit closer. I've attached what I've done.

It seems to be in the wrong range.

As I calculate it, it should be an incredibly small number, but when I snapshot~ it, it's actually often a very large one?

Am I on the right track?

Fly

http://www.pdpatchrepo.info/hurleur/Change_Measure.pd

• Actually, they are incredibly small. When you see something like "4.587e-05", that is scientific notation meaning 4.587 * 10^(-5) = .00004587.

• Ahh, okay. I guess my question then is how can I accurately normalize the signal? To make is something meaningful.

• Well, if you're trying to measure the rate of change, normalizing might make it less meaningful. But if you want to do that, I'm not really sure what the best way to go would be. My guess is that you would have to know beforehand what the highest frequency present in the signal would be, and figure out what the highest rate of change for that frequency would be. Then you could use that for a scalar. That would be for an arbitrary signal, and if the signal is assumed to have a spectrum up to half the sample rate, then the scalar would just be one, and thus it would be "assumed" normalized, because you can't really be sure what the maximum rate of change in the signal is.

But if you're just analyzing a sample, then you could record the rate of change into a

Posts 11 | Views 5039
Internal error.

Oops! Looks like something went wrong!