Zephyr Scientific Library (zscilib)
|
Sound functions. More...
Files | |
file | sound.h |
API header file for sound in zscilib. | |
Functions | |
int | zsl_phy_sound_press_amp (zsl_real_t b, zsl_real_t k, zsl_real_t a, zsl_real_t *p) |
Calculates the mamimum acoustic pressure of a sound wave in pascals. More... | |
int | zsl_phy_sound_level (zsl_real_t i, zsl_real_t i0, zsl_real_t *b) |
Calculates the sound intensity level in decibels based on the input intensity and a reference intensity. More... | |
int | zsl_phy_sound_intensity (zsl_real_t b, zsl_real_t d, zsl_real_t p, zsl_real_t *i) |
Calculates the sound intensity in watts per meter squared based on the Bulk Modulus (b) and density (d) of the medium and the maximum pressure (p). More... | |
int | zsl_phy_sound_shock_wave_angle (zsl_real_t v, zsl_real_t vs, zsl_real_t *theta) |
Calculates the angle of the mach wave created by a moving sound source of velocity 'vs'. More... | |
int | zsl_phy_sound_dop_effect (zsl_real_t v, zsl_real_t vs, zsl_real_t vl, zsl_real_t fs, zsl_real_t *fl) |
Calculates the frequency measured by a moving receptor while a sound emiting source moves towards it. More... | |
int | zsl_phy_sound_beat (zsl_real_t fa, zsl_real_t fb, zsl_real_t *f) |
Calculates the frequency of the beats created by the interference of two waves with different frequency. More... | |
Sound functions.
int zsl_phy_sound_beat | ( | zsl_real_t | fa, |
zsl_real_t | fb, | ||
zsl_real_t * | f | ||
) |
Calculates the frequency of the beats created by the interference of two waves with different frequency.
fa | Frequency of the first wave in hertzs. |
fb | Frequency of the second wave in hertzs. |
f | Pointer to the frequency of the beats in hertzs. Will be set to NAN if any of the input frequencies is negative. |
int zsl_phy_sound_dop_effect | ( | zsl_real_t | v, |
zsl_real_t | vs, | ||
zsl_real_t | vl, | ||
zsl_real_t | fs, | ||
zsl_real_t * | fl | ||
) |
Calculates the frequency measured by a moving receptor while a sound emiting source moves towards it.
v | Velocity of sound in the medium in meters per second. |
vs | Velocity of the sound source in meters per second. |
vl | Velocity of the sound receptor in meters per second. |
fs | Frequency of the sound in the source in hertzs. |
fl | Pointer to the output frequency in hertzs. Will be set to NAN if either the input or the output frequency is negative, or if v + vs is zero. |
int zsl_phy_sound_intensity | ( | zsl_real_t | b, |
zsl_real_t | d, | ||
zsl_real_t | p, | ||
zsl_real_t * | i | ||
) |
Calculates the sound intensity in watts per meter squared based on the Bulk Modulus (b) and density (d) of the medium and the maximum pressure (p).
b | Bulk Modulus in pascals. |
d | Density in kilograms per meter cubed. |
p | Amplitude of the acoustic pressure in pascals. |
i | Pointer to the output sound intensity in watts per meter squared. Will be set to NAN if the Bulk Modulus, the density or the pressure are negative, or if the density is zero. |
int zsl_phy_sound_level | ( | zsl_real_t | i, |
zsl_real_t | i0, | ||
zsl_real_t * | b | ||
) |
Calculates the sound intensity level in decibels based on the input intensity and a reference intensity.
i | Input sound intensity in watts per meter squared. |
i0 | Reference sound intensity in watts per meter squared. |
b | Pointer to the sound intensity level in decibels. Will be set to NAN if either the input intensity or the reference intensity are negative. |
int zsl_phy_sound_press_amp | ( | zsl_real_t | b, |
zsl_real_t | k, | ||
zsl_real_t | a, | ||
zsl_real_t * | p | ||
) |
Calculates the mamimum acoustic pressure of a sound wave in pascals.
b | Bulk Modulus in pascals. |
k | Wave number of the sound wave in radians per second. |
a | Amplitude of the sound wave in meters. |
p | Pointer to the output mamimum acoustic pressure in pascals. Will be set to NAN if the Bulk Modulus, the wave number or the wave amplitude are negative. |
int zsl_phy_sound_shock_wave_angle | ( | zsl_real_t | v, |
zsl_real_t | vs, | ||
zsl_real_t * | theta | ||
) |
Calculates the angle of the mach wave created by a moving sound source of velocity 'vs'.
v | Velocity of the sound in the medium in meters per second. |
vs | Velocity of the sound source in meters per second. |
theta | Pointer to the output angle in radians. |