/* block loop */
aubio_pitch_do (o, ibuf, pitch);
smpl_t freq = fvec_read_sample(pitch, 0);
- smpl_t amp = powf(10., aubio_db_spl(ibuf)*.05 );
- aubio_wavetable_set_amp ( wavetable, amp );
+ aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
if (freq != 0.0) {
aubio_wavetable_set_freq ( wavetable, freq );
} else {
}
smpl_t
-fvec_local_energy (fvec_t * f)
+aubio_level_lin (fvec_t * f)
{
smpl_t energy = 0.;
uint_t j;
smpl_t
aubio_db_spl (fvec_t * o)
{
- return 10. * LOG10 (fvec_local_energy (o));
+ return 10. * LOG10 (aubio_level_lin (o));
}
uint_t
*/
smpl_t fvec_sum (fvec_t * v);
-/** compute the energy of a vector
-
- This function compute the sum of the squared elements of a vector, normalised
- by its length.
-
- \param v vector to get the energy from
-
- \return the energy of v
-
-*/
-smpl_t fvec_local_energy (fvec_t * v);
-
/** compute the High Frequency Content of a vector
The High Frequency Content is defined as \f$ \sum_0^{N-1} (k+1) v[k] \f$.
*/
smpl_t aubio_zero_crossing_rate (fvec_t * v);
+/** compute sound level on a linear
+
+ This gives the average of the square amplitudes.
+
+ \param v vector to compute dB SPL from
+
+ \return level of v
+
+*/
+smpl_t aubio_level_lin (fvec_t * v);
+
/** compute sound pressure level (SPL) in dB
This quantity is often wrongly called 'loudness'.
+ This gives ten times the log10 of the average of the square amplitudes.
+
\param v vector to compute dB SPL from
\return level of v in dB SPL
for (j = 0; j < newmag->length; j++)
newmag->data[j] = fftgrain->norm[j];
/* detect only if local energy > 10. */
- //if (fvec_local_energy(newmag) * newmag->length > 10.) {
+ //if (aubio_level_lin (newmag) * newmag->length > 10.) {
//hfc = fvec_local_hfc(newmag); //not used
aubio_pitchmcomb_spectral_pp (p, newmag);
aubio_pitchmcomb_combdet (p, newmag);
for (j = 0; j < newmag->length; j++)
newmag->data[j] = fftgrain->norm[j];
/* detect only if local energy > 10. */
- if (fvec_local_energy (newmag) * newmag->length > 10.) {
+ if (aubio_level_lin (newmag) * newmag->length > 10.) {
/* hfc = fvec_local_hfc(newmag); do not use */
aubio_pitchmcomb_spectral_pp (p, newmag);
aubio_pitchmcomb_combdet (p, newmag);