Thanks Frank and Michael.
So I understand that linearity of amplitudes in this case and, i guess in many other case as far as pd is concerned, refers to the -1 to 1 scale used to calculate waveform. I do understand the whole idea of linearity and non-linearity but I guess my confusion come from that I tend to see linearity in a relative way. For example, one could say that a linear increase in decidel does not correspond to a linear increase of peak amplitude, and vice et versa (of course). None of the two correspond to a "linear" increase of the sound that we ear either(as in twice the value = twice the volume).I'll go have a look at all the readings you suggested to me, thanks you again for that. I do remember I've read something about it in Miller's book.
Is there anyone else out there using pd to make tools for composers? stuff like spectral analysis that outputs notes in midi format, or tools that transform and modulate melodic patterns in various ways, and then output the result in midi?
Thanks again! Benoît
De : Frank Barknecht fbar@footils.org À : pd-list@iem.at Envoyé le : Vendredi 30 Septembre 2011 3h44 Objet : Re: [PD] sigmund~
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
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list