Reference Manual

HOW TO use NAT32 Audio Commands.

NAT32 has the following audio commands:

ain duration Capture sound for the specified duration (in secs), writing it to STDOUT.
aout Read audio data from STDIN, writing it to the sound device.

Both commands use the current default Windows audio device. Playback and Recording levels must be set via the Windows Mixer to the required values. Raw PCM stereo data sampled at 44100 Hz is supported in this release.

The above commands are primitives and should be combined with appropriate redirection and pipe specifiers to perform useful work. Recall that the NAT32 shell supports redirection to/from files and concurrent command pipelines.

Examples

1. Record 10 secs of audio to file test.snd: ain 10 > test.snd

2. Play a raw PCM file: aout < test.snd

3. Record 10 secs of audio and pipe it to a TCP connection to 127.0.0.1:7000: ain 10 | wtcpo

4. Play raw PCM piped from a TCP connection: wtcpi | aout

The TCP commands used above are:

wtcpo [ip [port]] Establish a TCP connection to ip and port and write data from STDIN to that connection.
The defaults are 127.0.0.1:7000.
wtcpi [port] Listen at port for an incoming TCP connection and then read data and copy to STDOUT.
The default port is 7000.

Streaming Audio Content to an Airport Express

Unfortunately, Apple Corporation has chosen to restrict your access to the audio hardware within your Airport Express and so special software such as JustePort must be used to transfer raw audio to the device.

NAT32 Build 1033 and later supports an audio capture command: ain duration that can capture any audio content currently being sent to your sound card. The ain command will capture audio for the specified duration (in secs) and send it to the Standard Output Device. If you redirect STDOUT to a TCP connection, you can subsequently stream it to an Airport Express as follows:

  • Run this command in a DOS Box:

    wtcpi | justeport - 10.0.1.1
  • In NAT32, run this command:

    ain 100 | wtcpo 127.0.0.1
  • Note that NAT32 running in WINSOCK Mode also has the needed commands and does not require registration.

    Sample C source code for capturing audio and streaming it to stdout or to a file or to an audio server is available here. Use the program ain to capture audio and pipe it to JustePort as follows:

    ain 100 | justeport - 10.0.1.1

    SEE ALSO

    [Edit] [Back]