• ### Envelope of a signal

Hey!

I'm fairly new to Pure Data, and I'm having a hard time figuring how to extract the envelope of a signal.

Now I'm simply outputting the signal to an array, but I really wanted was to extract the envelope and plot it.

• | Posts 17 | Views 6386
• Hi Pedro,

but I want the envelope of the signal, not the signal itself.

I don't understand. What [env~] outputs is the envelope of the signal as far as I know.

Also, I found this about envelope followers (from Miller's book): http://msp.ucsd.edu/techniques/v0.11/book-html/node158.html

Cheers,
Gilberto

• Yeah, I know that, but when I try to use [env~] on my values and try to plot them, I only get one value (which makes sense, since it only outputts one value).

What I want is something like this in the second plot (sorry for the bad drawing):

I want to plot and be able to save the envelope of the signal like this.
Maybe Im confusing envelope with something else.....

Any help is appreciated, thanks guys!

• Hi Pedro,

I do understand what you want, but I thought that the [env~] does exactly that. Of course it does only for the current signal arriving to it. So my idea was to save [env~]'s output to a table and then plot it, and that's what I tried with that patch I posted above.

Cheers,
Gilberto

• Oh I get it now! Makes sense!

Any idea on how to save those values to a table?
I can't seem to get the grasp on how Pure Data handles arrays and tables :/

I can't use externals because I'm going to use the patch with libpd...

Thanks again! @gsagostinho

• Any idea on how to save those values to a table?

I did it by using [tabletool] but of course you can patch it yourself. The logic I use is as follows:

• when a new value is sent by [env~], use a [trigger float bang]
• the bang will first shift the table to the left (that is, value at index 2 moves to index 1, the value at index 3 moves to index 2, etc.). This is where [tabeltool] is super handy, but you can patch this yourself of course.
• then the float from will be written to the last position in the table by using [tablewrite <tablename>]. See how I dealt with the second inlet on my patch above (the last index was 100 in my case).

Cheers,
GIlberto

• Hm thanks again @gsagostinho! got it working but I don't think this is what I need.

As I showed on the image, I want to do the envelope of a signal after I used FFT on it (now I have an array that tells me for each moment in time what are the frequencies that compose the signal).
And this is right, as I tested it already.

Now I just wanted to use those values and envelope them...

• @PedroPT Hello Pedro, I will post my (not so woofing easy) post again then...
https://en.wikipedia.org/wiki/Envelope_detector
the calculation can most likely be done using [expr~] or reading the table into [expr]
David.

• @whale-av Those equations are related to FM and AM only and are not a general case, so you can't just use [expr~] with them and apply any signal to it.

@PedroPT I thought you had written that you just wanted to visualize the envelope, not use it later. Maybe you can store the envelope in a table, and when necessary recall their values from this table and feed a [line~] into which, and multiply it by the signal. For that you have to make sure that you have amplitude between 0 and 1 ([env~] actually outputs RMS dB). But maybe there is an easier way to do what you want and I am missing it altogether...

• I want to send the values of the signal (as I'm doing now, but now I only have the FFT results, with frequencies distribution) to libpd and present them on an Android tablet.

So far this I have right, but I wanted to send the envelope instead of the FFT values...

But thanks anyway @gsagostinho, @whale-av !!

• Pedro, why don't you try posting your problem on the pd mailling list? Those guys there know a lot about audio programming and they may be able to help you better than I can.

| Posts 17 | Views 6386
Internal error.

Oops! Looks like something went wrong!