# mic2wav

## Description

`mic2wav` is a tool that takes text format recording data obtained by running the microphone sample demos mic-2 and mic-4, then converts them into .wav audio files in PCM format.

## Using the Tool

### Start Command

`% mic2wav TEXTFILE [OUTPUT_DIRECTORY]`

This tool interprets the text data that is written in the file specified in TEXTFILE. It outputs the individual data samples as .wav files to the directory specified in OUTPUT_DIRECTORY. OUTPUT_DIRECTORY can be omitted. When omitting it, it will be generated at the same location as the file specified in TEXTFILE.

The file names are numbers generated in ascending order 00000000.wav, 00000001.wav, ... When there is an existing file with the same name, it is written over.

### Audio Text Data Formats

`mic2wav` interprets the text data based on the following formats.

All formats are interpreted on a per-line basis, with decisions based on the text strings at the head of the row.

Format | Description | Details
--- | --- | ---
$rate=RATE | Specification of Frequency | Sampling frequencies in Hz units are specified in the RATE section as integers.
$bits=BITS | Specification of Bit Count | The quantization bit rate is specified in integers in the BITS section. The following values can be accommodated as .wav file PCM formats. 8 bit 16 bit The microphone demos, mic-2 and mic-4, support the recording of all of these values.
$end | Specification of Data Termination | The series of settings and sampling data so far will be output individual .wav files. The output files will be generated automatically according to the rules described above. After being output, the sampling data is all discarded and the system returns to the pre-input analytical state.
|DATA,DATA, ... | Specification of Sampling | Based on the settings, the DATA section is read in as sampling data in unsigned, 16-bit whole numbers. If the quantization bit rate is 8 bits, then the data will be 00 ~ FF, if 16 bits, then 0000 ~FFFF. If the number of digits do not match exactly, they will be simply ignored. The microphone sample demos mic-2 and mic-4 will output 16 samples per line. XXXIf this format appears more than once, the subsequent `$rate` and `$bits` setting changes will be ignored unless data end has been specified using `$end`.
# ... | Comments | This is interpreted as an explicit comment row and it reads it and discards it without doing anything.
Other | Illegal Formats | Unrecognizable, illegal formats are read and discarded without doing anything.

Based on the above formats, the text data output by the microphone sample demos mic-2 and mic-4 is batch-generated as audio files. For the text, text strings need to be copied from the debug log output window and prepared as arbitrary text files.

## Location

`$TwlSDK/tools/bin/mic2wav.exe`

## See Also

`Microphone Sample Demos (mic-2 / mic-4)`

## Revision History

2008/09/11 Removed a description of the fact that use under the TWL environment is not recommended.
2008/07/18 Corrected the descriptoin of the sampling rate.
2004/08/17 Standardized the notation used for IS-NITRO-EMULATOR.
2004/06/18 Initial version.

CONFIDENTIAL