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 323<br />

int n;<br />

BoreSegment s;<br />

double length = 0;<br />

for(n = 0; n < sizeVector(bore); n++) {<br />

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

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

}<br />

return length;<br />

}<br />

double woodwindLengthPos(Woodwind w) {<br />

int cellCount;<br />

UnitCell cell;<br />

double length = 0;<br />

length += boreLength(w->head->downstreamBore);<br />

for (cellCount = 0; cellCount < sizeVector(w->cells); cellCount++) {<br />

cell = (UnitCell)elementAt(w->cells, cellCount);<br />

length += boreLength(cell->bore);<br />

}<br />

return length;<br />

}<br />

double woodwindLengthNeg(Woodwind w) {<br />

return boreLength(w->head->upstreamBore);<br />

}<br />

complex impedance(double f, Woodwind w, double entryratio) {<br />

TransferMatrix matrix =<br />

woodwindMatrix(f, w, entryratio, woodwindLengthPos(w));<br />

return calcZin(matrix, woodwindLoadZ(f, w));<br />

}<br />

complex playedImpedance(double f, Woodwind w, int midi) {<br />

double entryradius = WW_EMB_RADIUS;<br />

complex Z = impedance(f, w, entryradius / woodwindEntryRadius(w));<br />

Z = addz(Z, faceZ(f, w->head, midi));<br />

return Z;<br />

}<br />

double woodwindEntryRadius(Woodwind w) {<br />

double a;<br />

BoreSegment s;<br />

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

a = w->head->embouchureHole->radiusout;<br />

else {<br />

s = (BoreSegment)elementAt(w->head->downstreamBore, 0);<br />

a = s->radius1;<br />

}<br />

return a;<br />

}<br />

complex woodwindLoadZ(double f, Woodwind w) {<br />

Vector lastBore;<br />

UnitCell lastCell;<br />

BoreSegment s;

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

Saved successfully!

Ooh no, something went wrong!