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.

242 APPENDIX B. PROGRAM LISTINGS<br />

/*<br />

Impedance.c<br />

By Paul Dickens, 2005<br />

Listing B.10: Impedance.c<br />

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

*/<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include "Woodwind.h"<br />

#include "ParseXML.h"<br />

int parseComm<strong>and</strong>Line(int argc, char** argv, char** holestring,<br />

double* temp, double* humid, double* flo, double* fhi,<br />

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

/* Default parameter values */<br />

#define TEMP 25.0<br />

#define HUMID 0.5<br />

#define X_CO2 0.0004<br />

#define FLO 200.0<br />

#define FHI 4000.0<br />

#define FRES 2.0<br />

#define ENTRYRATIO 1.0<br />

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

char* holestring;<br />

double temp, humid;<br />

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

char* xml_filename;<br />

Woodwind instrument;<br />

complex Z;<br />

/* check correct usage */<br />

if(!parseComm<strong>and</strong>Line(argc, argv, &holestring, &temp, &humid,<br />

&flo, &fhi, &fres, &entryratio, &xml_filename)) {<br />

fprintf(stderr, "Usage: Impedance [OPTIONS] \n\n");<br />

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

fprintf(stderr, "\t-s \n");<br />

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

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

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

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

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

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

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

fprintf(stderr,<br />

"\t- Optional if no holes are defined in XML file.\n");<br />

fprintf(stderr, "\t- Must be a sequence <strong>of</strong> 'O' (open hole) ");<br />

fprintf(stderr, "<strong>and</strong> 'X' (closed hole) characters.\n");<br />

fprintf(stderr,

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

Saved successfully!

Ooh no, something went wrong!