Contrib probeToAudio

From OpenFOAMWiki

Valid versions: OF version 13.png OF version 14.png OF version 141.png OF version 15.png OF version 16.png

1 Short description

A simple auralization utility that converts probed time series data to monaural 16-bit PCM .wav format audio data.

2 Motivation

If you are doing some linear/nonlinear/aero-acoustic simulations with OF, at times you may feel like to do intuitive and subjective validations of your calculated results, by actually auralizing the calculated pressure fluctuations over time. ProbeToAudio may fit into such demands.

3 Usage

$ probeToAudio <probe file> [-column <column number to be converted in probe file>] \
    [-startTime <startTime>] [-play] [-timeStretchRatio <time stretch ratio>]

The converted data will be written to a file with the name of <probe file>_<column number>.wav (the file name of the probe file with the additional _1.wav suffix, if you converted the column number 1 of the probe file).

Arguments and options are:

  • <probe file>: the probe file to be converted to the audio data. The file name will typically be, but not limited to, probes/0/p if you are in a case directory.
  • -column: specifies the column number to be converted in the probe file. The number starts from 0 which contains the time instant values, so practically the column number should be equal or greater than 1. The default is 1.
  • -startTime: specifies the starting time of the conversion. Especially useful for removing initial large numerical fluctuations. The default is -HUGE_VAL.
  • -play: sends the converted data to /dev/dsp instead of writing to a .wav file so that you can listen to the converted data directly. Note: You must have permission to write to /dev/dsp.
  • -timeStretchRatio: specifies the time stretch ratio. The default is 1.0. Useful if the sampling rate of your probed data is too high or too low to be playable with your audio device (typically the sampling rate should be within the range of 1000 Hz - 48 kHz). Note: Currently probeToAudio does not have any resampling capabilities. The option only changes the sampling rate specification in the .wav format header.

4 Example

The easiest case to try would be the pisoFoam/les/pitzDaily case. After running the case execute

probeToAudio probes/0/p -column 1 -timeStretchRatio 10 -startTime 1e-4

under the case directory, and play the converted audio file probes/0/p_1.wav. Then you'll be able to hear some noisy sound (not quite an interesting sound to listen to though). The probe file contains time series of pressure fluctuations probed at 7 different probe locations in the computational domain so by specifying the corresponding column number with the -column option you can listen to the pressure fluctuation at each probe location. If you have a good audio equipment and good ears you'll be able to tell the difference between the probe locations.

5 Download

Current version: the utility comes with the potentialWaveFoam solver package.

Past version: probeToAudio-20071115.tar.gz

6 History

7islands 08:47, 17 February 2009 (CET) (Takuya OSHIMA):

  • Update for OF 1.5.

7islands 14:36, 18 Nov 2007 (CET):

  • Initial upload.