11.07.2014 Views

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX B. PROGRAM LISTINGS 191<br />

/*<br />

Calculates the density <strong>of</strong> air using the ideal gas law.<br />

For a more accurate treatment, see Giacomo (1982), Metrologia 18,<br />

33--40.<br />

Parameters:<br />

t: the temperature in Celsius.<br />

p: the pressure in Pa.<br />

h: the relative humidity (between 0 <strong>and</strong> 1).<br />

x_c: the mole fraction <strong>of</strong> carbon dioxide.<br />

Returns:<br />

The density <strong>of</strong> air in kg/m3.<br />

*/<br />

double densityAirGiacomo(double t, double p, double h, double x_c);<br />

/*<br />

Calculates the density <strong>of</strong> air.<br />

Based on Giacomo (1982), Metrologia 18, 33--40.<br />

Parameters:<br />

t: the temperature in Celsius.<br />

p: the pressure in Pa.<br />

h: the relative humidity (between 0 <strong>and</strong> 1).<br />

x_c: the mole fraction <strong>of</strong> carbon dioxide.<br />

Returns:<br />

The density <strong>of</strong> air in kg/m3.<br />

*/<br />

double compressibilityAir(double t, double p, double x_w);<br />

/*<br />

Calculates the compressibility <strong>of</strong> air.<br />

Parameters:<br />

t: the temperature in Celsius.<br />

p: the pressure in Pa.<br />

h: the relative humidity (between 0 <strong>and</strong> 1).<br />

x_w: the mole fraction <strong>of</strong> water vapour.<br />

Returns:<br />

The compressibility <strong>of</strong> air.<br />

*/<br />

complex waveNum(double f, double c, double a, double alphacorrection);<br />

/*<br />

Calculates k, the complex wave number for a given segment which<br />

includes wall losses. Refer to Fletcher <strong>and</strong> Rossing (1998).<br />

Parameters:<br />

f: the frequency.<br />

c: the speed <strong>of</strong> sound<br />

a: the radius <strong>of</strong> the tube in metres.<br />

alphacorrection: the multiplicative attenuation coefficient<br />

factor.<br />

Returns:<br />

The complex wave number k, including wall losses.<br />

*/<br />

double phaseVel(double f, double c, double a);<br />

/*<br />

Calculates the phase velocity <strong>of</strong> a given pipe, part <strong>of</strong> the wave<br />

number.<br />

Refer to Fletcher <strong>and</strong> Rossing (1998).<br />

Parameters:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!