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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX B. PROGRAM LISTINGS 317<br />

double length, double boreRadius) {<br />

EmbouchureHole h = (EmbouchureHole)malloc(size<strong>of</strong>(*h));<br />

h->radiusin = radiusin;<br />

h->radiusout = radiusout;<br />

h->length = length;<br />

h->boreRadius = boreRadius;<br />

h->c = 0.0;<br />

h->rho = 0.0;<br />

return h;<br />

}<br />

Head createHead(EmbouchureHole embouchureHole, Vector upstreamBore,<br />

double upstreamFlange, Vector downstreamBore) {<br />

Head h = (Head)malloc(size<strong>of</strong>(*h));<br />

h->embouchureHole = embouchureHole;<br />

h->upstreamBore = upstreamBore;<br />

h->upstreamFlange = upstreamFlange;<br />

h->downstreamBore = downstreamBore;<br />

h->matrixMap = createMap();<br />

return h;<br />

}<br />

UnitCell createUnitCell(Hole hole, Vector bore) {<br />

UnitCell c = (UnitCell)malloc(size<strong>of</strong>(*c));<br />

c->hole = hole;<br />

c->bore = bore;<br />

c->openMatrixMap = createMap();<br />

c->closedMatrixMap = createMap();<br />

return c;<br />

}<br />

Woodwind createWoodwind(Head head, Vector cells, double flange) {<br />

Woodwind w = (Woodwind)malloc(size<strong>of</strong>(*w));<br />

w->head = head;<br />

w->cells = cells;<br />

w->flange = flange;<br />

return w;<br />

}<br />

void setAirProperties(Woodwind w, double t_0, double t_amb,<br />

double t_grad, double humid, double x_CO2) {<br />

Head h = w->head;<br />

double temp, x;<br />

int segmentCount, cellCount;<br />

BoreSegment s;<br />

UnitCell cell;<br />

temp = t_0;<br />

if (w->head->embouchureHole != NULL) {<br />

/* set c <strong>and</strong> rho for the embouchure hole */<br />

h->embouchureHole->c = speedSound(temp, P_ATM, humid, x_CO2);<br />

h->embouchureHole->rho =<br />

densityAirGiacomo(temp, P_ATM, humid, x_CO2);<br />

x = 0;<br />

/* for each bore segment in upstream */<br />

for (segmentCount = 0; segmentCount < sizeVector(h->upstreamBore);<br />

segmentCount++) {

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

Saved successfully!

Ooh no, something went wrong!