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.

326 APPENDIX B. PROGRAM LISTINGS<br />

length = x;<br />

radius2 = (s->radius2 * length + s->radius1<br />

* (s->length - length)) / (s->length);<br />

}<br />

m = (radius1 == radius2) ?<br />

tubeMatrix(f, s->c, s->rho, length, radius1, 1) :<br />

coneMatrix(f, s->c, s->rho, length, radius1, radius2, 1);<br />

return m;<br />

}<br />

TransferMatrix boreMatrix(double f, Vector bore, double x) {<br />

TransferMatrix m = identitym();<br />

int n = 0;<br />

BoreSegment s;<br />

while ((x > 0) && (n < sizeVector(bore))) {<br />

s = (BoreSegment)elementAt(bore, n);<br />

rmultm(m, boreSegmentMatrix(f, s, x));<br />

x -= s->length;<br />

n++;<br />

}<br />

return m;<br />

}<br />

TransferMatrix headMatrix(double f, Head h, double entryratio,<br />

double x) {<br />

TransferMatrix m, branchMatrix;<br />

complex branchZ, ZL;<br />

BoreSegment lastSegment;<br />

Map map = h->matrixMap;<br />

if((x >= boreLength(h->downstreamBore)) && containsKey(map, f))<br />

m = (TransferMatrix)get(map,f);<br />

else {<br />

m = identitym();<br />

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

branchMatrix =<br />

boreMatrix(f, h->upstreamBore, boreLength(h->upstreamBore));<br />

lastSegment = (BoreSegment)elementAt(h->upstreamBore,<br />

sizeVector(h->upstreamBore) - 1);<br />

ZL = radiationZ(f, lastSegment->c, lastSegment->rho,<br />

lastSegment->radius2, h->upstreamFlange);<br />

branchZ = calcZin(branchMatrix, ZL);<br />

rmultm(m,<br />

embouchureMatrix(f, h->embouchureHole, entryratio, branchZ));<br />

}<br />

if (x > 0)<br />

rmultm(m, boreMatrix(f, h->downstreamBore, x));<br />

if (x >= boreLength(h->downstreamBore)) {<br />

clear(map);<br />

put(map, f, m);<br />

}<br />

}<br />

return m;<br />

}<br />

complex faceZ(double f, Head head, int midi) {<br />

double c = head->embouchureHole->c;

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

Saved successfully!

Ooh no, something went wrong!