[PD] sigmund~
Frank Barknecht
fbar at footils.org
Fri Sep 30 09:44:14 CEST 2011
Hi,
On Thu, Sep 29, 2011 at 06:35:51PM -0700, Benoît Fortier wrote:
> I'm using the sigmund~ object to get amplitude and pitch information
> for the loudest peaks of a signal (see the sinusoid-tracking help
> patch, which can be found in the sigmund~ help patch). Out of that
> information, I want to create, let's say, 5 midi notes corresponding
> to the 5 loudest peaks of the signal. How would you transform the peak
> amplitude outputs of sigmund, which are linear, into midi velocities
> in order to make those 5 notes sound with the same relative amplitude
> that they have in the analysed signal?
>
> It might be a stupid question but what are those linear peak amplitude
> values exactly? Do they have any unit?
They don't have a "unit", they specify the actual peak amplitude of a
sine component in a signal. If you feed a sigmund~ with an unscaled
[osc~] the peak reported should be close to 1, as the sinewave coming
out of an [osc~] goes from -1 to 1, so the absolute peak is 1. If you
attenuate this [osc~] by multiplying it by 0.5, sigmund~ should report a
peak near 0.5 accordingly. The amplitude is "linear" in that it directly
outputs this multiplication factor - multiplication by constants
("homogeneity of degree 1") and addition ("additivity") are the two
"linear" operations here. See e.g.
http://en.wikipedia.org/wiki/Linear_map for some gory details.
There also are non-linear operations possible. For example
multiplication of a signal with itself is a first step into the
non-linear world. You may remember the parabolic curve if you plot
f(x)=x*x which looks like a glass of wine and obviously is not a
straight line(ar) anymore. dB-curves are similarily skewed, as are
square root, log, or other [pow] curves.
Now it's possible to express the amplitude of signals in various ways.
The peak amplitude above actually already is a modification in that it
only considers the absolute value of the actual amplitude (which is
negative sometimes in the case of an [osc~], but not for a [phasor~]!).
You could also look at the instantaneous amplitude of a signal with
[snapshot~] for example, or calculate some kind of average, or use the
absolute peak-to-peak-amplitude (which would be 2 for an [osc~]!)
A very important amplitude specification is the RMS or root-mean-square
amplitude. This is especially interesting as a signal's power is
proportional to the square of RMS. RMS in Pd is calulated by the [env~]
object.
Now in music you very often are interested in powers, intensities
or loudness (more complicated) values, for example you want something to
be twice as loud as another sound. That's where logarithms and decibels
come in. Check e.g. this
http://hep.physics.indiana.edu/~rickv/Loudness_Scales.html
for some details.
In Pd an important thing to know is its non-standard use of the term dB:
For example [env~] outputs values in "dB" which are scaled so that a
[sig~ 1] will have an RMS of 100, and [sig~ 0] has RMS of 0. But to
convert these into linear amplitude multipliers from 0 to 1 you cannot
just divide by 100, as your intermediate values would be wrong: [sig~
0.5] gives an [env~] of about 93.97 and not 0.5 as might be expected!
Instead use [dbtorms] here, and [rmstodb] for the undo-operation. The
attached file shows these operations in action.
More reading stuff:
http://en.wikipedia.org/wiki/Amplitude
http://www.iu.edu/~emusic/acoustics/amplitude.htm
Ciao
--
Frank
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dB-and-more.pd
Type: application/puredata
Size: 1607 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20110930/ff3ead69/attachment.bin>
More information about the Pd-list
mailing list