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

/*<br />

PlayedImpedance.c<br />

By Paul Dickens, 2006<br />

Listing B.22: PlayedImpedance.c<br />

Physical model <strong>of</strong> the acoustic impedance <strong>of</strong> a played flute.<br />

*/<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include "Vector.h"<br />

#include "ParseXML.h"<br />

int parseComm<strong>and</strong>Line(int argc, char** argv, double* flo, double* fhi,<br />

double* fres, char** input_filename, char** xml_filename);<br />

int parseInputFile(Vector midiv, Vector holestringv,<br />

char* input_filename);<br />

/* Default spectrum range <strong>and</strong> resolution */<br />

#define FLO 200.0<br />

#define FHI 4000.0<br />

#define FRES 2.0<br />

int main(int argc, char** argv) {<br />

double f, flo, fhi, fres;<br />

char* input_filename;<br />

char* xml_filename;<br />

Vector midiv = createVector();<br />

Vector holestringv = createVector();<br />

Woodwind instrument;<br />

int i;<br />

int midi;<br />

char* holestring;<br />

double z_dB;<br />

/* check correct usage */<br />

if(!parseComm<strong>and</strong>Line(argc, argv, &flo, &fhi, &fres, &input_filename,<br />

&xml_filename)) {<br />

fprintf(stderr,<br />

"Usage: PlayedImpedance [OPTIONS] \n\n");<br />

fprintf(stderr, " Options:\n");<br />

fprintf(stderr, "\t-l (default 200.0)\n");<br />

fprintf(stderr, "\t-h (default 4000.0)\n");<br />

fprintf(stderr, "\t-r (default 2.0)\n\n");<br />

fprintf(stderr, " :\n");<br />

fprintf(stderr,<br />

"\t- Must be a tab-delimited list <strong>of</strong> midi numbers <strong>and</strong>\n");<br />

fprintf(stderr, "\t holestrings, one set per line.\n\n");<br />

return -1;<br />

}<br />

/* parse input file */<br />

if(!parseInputFile(midiv, holestringv, input_filename)) {

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

Saved successfully!

Ooh no, something went wrong!