Sound: Get energy...

A query to the selected Sound object.

Availability

This command becomes available in the Query submenu when you select one Sound. Like most query commands, it is greyed out if you select two Sounds or more.

Behaviour

If you execute this command, Praat should write the energy of the selected Sound (in the time interval you are asking for) into the Info window. If the unit of sound amplitude is Pa (Pascal), the unit of energy will be Pa2·s.

Setting

Time range (s)
the time range (t1, t2). Values outside this range are ignored. If t1 is not less than t2, the entire time domain of the sound is considered.

Definition

The energy is defined as

t1t2 x2(t) dt

where x(t) is the amplitude of the sound. For stereo sounds, it is

t1t2 (x2(t) + y2(t))/2 dt

where x(t) and y(t) are the two channels; this definition, which averages (rather than sums) over the channels, ensures that if you convert a mono sound to a stereo sound, the energy will stay the same.

Related commands

For an interpretation of the energy as the sound energy in air, see Sound: Get energy in air. For the power, see Sound: Get power....

Implementation

In Praat, a Sound is defined only at a finite number of time points, spaced evenly. For instance, a three-seconds long Sound with a sampling frequency of 10 kHz is defined at 30,000 time points, which usually (e.g. when you create the Sound with Create Sound from formula...) lie at 0.00005, 0.00015, 0.00025 ... 2.99975, 2.99985 and 2.99995 seconds. The simple way Praat looks at this is that the first sample is centred around 0.00005 seconds, and the amplitude of that sample (x1) represents x(t) for t between 0 and 0.00010 seconds. Likewise, the second sample is centred around 0.00015 seconds but can be said to run from 0.00010 to 0.00020 seconds, and the 30,000th and last sample is centred around 2.99995 seconds and its amplitude (x30000) represents all times between 2.99990 and 3.00000 seconds. This example sound x(t) is therefore defined for all times between 0 and 3 seconds, but is undefined before 0 seconds or after 3 seconds.

The energy of the whole example sound is therefore

03 x2(t) dt

and we approximate this as a sum over all 30,000 samples:

i=130000 xi2 Δti

where Δti is the duration of the ith sample, i.e. 0.0001 seconds for every sample.

Now consider what happens if we want to know the energy between t1 = 0.00013 and t2 = 0.00054 seconds. The first sample of the sound falls entirely outside this interval; 70 percent of the second sample falls within the interval, namely the part from 0.00013 to 0.00020 seconds; all of the third, fourth and fifth samples fall within the interval; and 40 percent of the sixth sample falls within the interval, namely the part from 0.00050 to 0.00054 seconds (note that the centre of this sixth sample, which is at 0.00055 seconds, even lies outside the interval). The energy is then

i=26 xi2 Δti

where Δt3 = Δt4 = Δt5 = 0.0001 seconds, but Δt2 is only 0.00007 seconds (namely the part of the second sample that falls between t1 and t2), and Δt6 is only 0.00004 seconds (namely the part of the sixth sample that falls between t1 and t2).

This way of integrating the squared signal (technically, a Riemann sum over a partition [of the interval from t1 to t2] that is regular everywhere except at the edges and has central tags everywhere except at the edges) ensures that the result is a continuous function of t1 and t2, i.e., a very small change in t1 or t2 can only lead to a very small change in the computed energy (instead, simply summing over all samples whose centre falls between t1 and t2 would result instead in a sudden jump in the computed energy whenever t1 or t2 crosses a sample centre, which would be unphysical behaviour and therefore not how Praat should behave).

Edge cases

If the sound is not defined everywhere between t1 and t2, then the energy is not defined there either. Those times are skipped in the integral.

Links to this page


© ppgb 20210719