The waveaudio device will create a new file on either the MCI_OPEN or MCI_LOAD commands if a file element is indicated (MCI_OPEN_ELEMENT_ID) and the specified file name does not exist. If no file name is indicated, the waveaudio driver will create an unnamed temporary file. If an unnamed temporary file is created, it can later be named by issuing the MCI_SAVE command, which must include the permanent name of the new file.
To support file creation from the string interface, a special file name called new is reserved for system use. This file name should be used in place of the usual application supplied file name. As in the command message interface, the save command must be issued to give the file a permanent name.
open new type waveaudio alias wave wait record wave notify . . . ** recording ** . . . stop wave wait save wave myspeech.wav wait
When a file is initially created, default settings will be assigned by the media driver and might depend on the capabilities of the audio adapter. The IBM waveform audio driver will use PCM, 22 kHz, 16 bits per sample, and mono as the default for 16-bit adapters. If the adapter does not support 16-bit PCM, then the resolution (bits per sample) will be downgraded to 8 bits.
The following table lists audio adapters supported by OS/2 multimedia. The default settings are those initially assigned by the media driver to a new file when that particular audio adapter is being used.
┌─────────────────────────┬──────────┬──────────┬──────────┬──────────┐ │Audio Adapter │Format │Sampling │Bits per │Channels │ │ │ │Rate │Sample │ │ ├─────────────────────────┼──────────┼──────────┼──────────┼──────────┤ │IBM M-Audio │PCM │22 kHz │16 │1 │ ├─────────────────────────┼──────────┼──────────┼──────────┼──────────┤ │Sound Blaster │PCM │22 kHz │8 │1 │ ├─────────────────────────┼──────────┼──────────┼──────────┼──────────┤ │Sound Blaster Pro │PCM │22 kHz │8 │2 │ ├─────────────────────────┼──────────┼──────────┼──────────┼──────────┤ │Sound Blaster 16 │PCM │22 kHz │16 │1 │ ├─────────────────────────┼──────────┼──────────┼──────────┼──────────┤ │Pro AudioSpectrum 16 │PCM │22 kHz │16 │1 │ └─────────────────────────┴──────────┴──────────┴──────────┴──────────┘
OS/2 multimedia enables recording of digital audio information in the format that fits specific needs, such as space or quality. For example, assume that a new waveaudio file is created with the following command:
open new type waveaudio alias a wait
When the file is created, you might want a file that is compatible with mu-law (the compression scheme used by the telephone system). To change the compression scheme, the format tag must be set for the file. The following string commands prepare the file for recording mu-law by setting the format tag:
set a format tag mulaw wait set a bitspersample 8 wait set a channels 1 wait set a samplespersec 11025 wait
If you wanted to record with a compression scheme commonly used in Europe (a-law), the following command could have been issued:
set a format tag alaw wait
An application should always set the waveform format, sampling rate, resolution, and number of channels to ensure that the waveform is created with the desired parameters as shown in the following string interface example.
set wave format tag PCM wait set wave samplespersec 22050 wait set wave bitspersample 8 wait set wave channels 1 wait
Note: When modifying the settings on a waveaudio device, the format tag should be changed first, because it might force the automatic modification of other settings to make them compatible with the new format. For instance, a waveaudio device that supports 16-bit PCM might only support 8-bit ADPCM. Changing the format from PCM to ADPCM will automatically change the bits per sample setting.