Package wiat :: Package TM
[hide private]
[frames] | no frames]

Package TM

source code

Transmission Matrix (TM) acoustic input impedance calculation.

This package is used for the calculation of the frequency response of wind music instrument. It is based on the discretization of instrument air columns into cylindrical and conical sections, with and without toneholes.

The following references discuss the method:

  1. Plitnik, G. R., & Strong, W. J. (1979). Numerical method for calculating input impedances of the oboe. The Journal of the Acoustical Society of America, 65(3), 816-825.
  2. Caussé, R., Kergomard, J., & Lurton, X. (1984). Input impedance of brass musical instruments - Comparaison between experimental and numerical models. J. Acoust. Soc. Am., 75, 241-254.

The Instrument class and CalculateImpedance functions, defined in the Inst module, contains the core of the methode. The Waveguides, ToneHole, and Radiation modules implement the transmission matrices used in the calculation. Boundary layer losses are taken into account.


Version: 0.0.0.1

Author: Antoine Lefebvre

License: GPLv3

Submodules [hide private]
  • wiat.TM.Functions: Functions.py - Definition of various useful functions
  • wiat.TM.Inst: Inst.py - This file contains the class defining an Instrument and the functions CalculateImpedance and CalculateMaxima.
  • wiat.TM.Radiation: Radiation.py - Classes defining the radiation impedance models
  • wiat.TM.Waveguides: Waveguides.py - Contains classes defining the transmission matrices for simple geometries and functions to generate them.

Classes [hide private]
  CurvedCone
Class representing a curved cone
  ToneHole
This class implements the transmission matrix of tone holes References:
  Cylinder
Class representing a cylinder
  Jump
Class representing a diameter jump
  Cone
Truncated cone transmission matrix calculation class
  SaxophoneBell
Radiation model of a saxophone bell.
  FlangedOpenEnd
  UnflangedOpenEnd
Unflanged open end radiation impedance models
  IdealOpenEnd
  ClosedEnd
  Instrument
Class used to descibed the geometry of a musical instrument.
Functions [hide private]
 
EquationApproximatedWithCones(equation, L, N=10)
Discretization in conical segments of an equation giving the radius of the waveguide as a function of its argument.
source code
 
ConeApproximatedWithCylinders(d0, de, L, N=200) source code
 
CreateCylindersAndConesFromList(list)
Build a list of Cylinder or Cone from a list of tuples containing position and diameters.
source code
 
CalculateMaxima(Z, inst, freqs, T, number_of_maxima=None)
Calculate the exact location of the impedance maxima of an Instrument.
source code
 
CalculateImpedance(instrument, freqs, T=25.0)
Calculate the input impedance of the instrument.
source code
 
calculate_impulse_response(I, T, N, fs)
Calculate the impulse response of an instrument from its impedance.
source code
 
CompareMaxima(ml1, ml2)
Compare two list of maxima data.
source code
Variables [hide private]
  __credits__ = 'FQRNT'
Function Details [hide private]

EquationApproximatedWithCones(equation, L, N=10)

source code 

Discretization in conical segments of an equation giving the radius of the waveguide as a function of its argument.

Parameters:
  • equation - an equation of one argument. It will be evaluated from 0 to L.
  • L - the length of the waveguide.

CreateCylindersAndConesFromList(list)

source code 

Build a list of Cylinder or Cone from a list of tuples containing position and diameters.

Example:

   >>> import wiat
   >>> FluteBody = wiat.TM.CreateCylindersAndConesFromList(
   ... [(0.,0.0188),(0.132,0.0188),(0.340,0.0152),
   ...  (0.452,0.0135),(0.583,0.0112)])
   >>> for s in FluteBody: print s
   Cylinder(d=0.0188,L=0.1320)
   Cone(d0=0.0188,de=0.0152,L=0.2080)
   Cone(d0=0.0152,de=0.0135,L=0.1120)
   Cone(d0=0.0135,de=0.0112,L=0.1310)
Parameters:
  • list - a list of tuples (position,diameter) where the position is the distance along the centerline of the instrument from the mouthpiece.

CalculateMaxima(Z, inst, freqs, T, number_of_maxima=None)

source code 

Calculate the exact location of the impedance maxima of an Instrument.

It uses an impedance vector Z, previously calculated with the CalculateImpedance function, to determine the approximate location of the maxima and then, uses an optimization algorithm to find their exact location.

Parameters:
  • Z - impedance vector
  • inst - Instrument instance
  • freqs - frequency vector
  • T - temperature
  • number_of_maxima - optional argument to limit the number of maxima that are returned
Returns:
a list of tuples containing frequency and magnitude of each impedance maxima.

CalculateImpedance(instrument, freqs, T=25.0)

source code 

Calculate the input impedance of the instrument.

This function performs the transfer matrix multiplication.

The frequency vector f must be sufficiently fine for the impedance to be well represented, otherwise, the CalculateMaxima functions won't be able to find the maxima. A good vector is:

>>> freqs = numpy.arange(50,5000,5,dtype=float)
Parameters:
  • instrument - an Instrument instance
  • freqs - frequency vector
  • T - the temperature

calculate_impulse_response(I, T, N, fs)

source code 

Calculate the impulse response of an instrument from its impedance.

I: Instrument instance T: temperature N: size of the fft fs: sampling frequency