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

if (sizeVector(w->cells) == 0)<br />

lastBore = w->head->downstreamBore;<br />

else {<br />

lastCell = (UnitCell)elementAt(w->cells,<br />

sizeVector(w->cells) - 1);<br />

lastBore = lastCell->bore;<br />

}<br />

s = (BoreSegment)elementAt(lastBore, sizeVector(lastBore) - 1);<br />

return radiationZ(f, s->c, s->rho, s->radius2, w->flange);<br />

}<br />

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

TransferMatrix m;<br />

UnitCell cell;<br />

int cellCount;<br />

m = boreMatrix(f, w->head->downstreamBore,<br />

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

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

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

rmultm(m, unitCellMatrix(f, cell, boreLength(cell->bore)));<br />

}<br />

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

}<br />

TransferMatrix traverseHoleMatrix(double f, Hole hole) {<br />

TransferMatrix m = identitym();<br />

complex Z_hole, Z_i, Z_a;<br />

/* calculate the input impedance to the hole */<br />

Z_hole = holeInputImpedance(f, hole);<br />

/* calculate the inner radiation impedance */<br />

Z_i = holeInnerRadiationImpedance(f, hole);<br />

/* calculate the series impedance */<br />

Z_a = holeSeriesImpedance(f, hole);<br />

/* assign the impedances to the correct matrix element */<br />

m->C = divz(one, addz(Z_i, Z_hole));<br />

m->B = Z_a;<br />

}<br />

return m;<br />

complex holeInputImpedance(double f, Hole hole) {<br />

TransferMatrix holeMatrix;<br />

double t;<br />

double a = hole->boreRadius;<br />

double b = hole->radius;<br />

complex Z_L;<br />

/* calculate the length t (inluding the matching length<br />

correction) */<br />

t = hole->length + matchingLengthCorrection(a, b);<br />

/* calculate the matrix (with losses) for the tube section

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

Saved successfully!

Ooh no, something went wrong!