Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ aconvertafi(3X) — HP-UX 9.03

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ALoadAFile(3X)

ASaveSBucket(3X)

AConvertAFile(3X)  —  Series 700 Only

NAME

AConvertAFile − convert audio file data format

SYNOPSIS

#include <audio/Alib.h>

void AConvertAFile(

Audio *audio,
char *src_pathname,
AFileFormat src_file_format,
char *dest_pathname,
AFileFormat dest_file_format,
AudioAttrMask dest_attr_mask,
AudioAttributes *dest_attributes,
long *status_return

);

DESCRIPTION

AConvertAFile() converts the data in src_pathname according to the format specified in dest_file_format and the attributes in dest_attributes. The results are written to dest_pathname.

Arguments

audio Audio structure associated with this connection. 

src_pathname Pathname of the source file. 

src_file_format File format of the source file.  If this parameter is set to AFFUnknown, the conversion utility attempts to determine the file format from the filename extension, if one exists, or from the file contents. 

If there is no determinable file format, an error is returned; there is no default. 

Valid file type extensions are:

.u Mulaw

.al Alaw

.au Sun (NeXT)

.wav Riff

.snd NeXT

.l16 Linear16

.l8 Linear8

.lo8 Linear8Offset

If you have a "Mac" file, try treating it as a raw data file in Linear8Offset with a sampling rate of 22k or another sampling rate. 

dest_pathname Pathname of the destination file. 

dest_file_format File format of the destination file. 

dest_attr_mask Audio attributes to be used in dest_attributes. The mask is a bitwise inclusive OR of the values defined in AudioAttrMask.  If this mask is set to 0, values are used from the source file wherever they are appropriate for files of type dest_file_format.

dest_attributes Attributes that are affected by the mask.  If set to NULL, the attribute mask is cleared, and values are used from the source file wherever they are appropriate for files of type dest_file_format. For attributes to be valid, type must be set, separate from the mask. 

status_return Receives the returned status of the operation, unless it is set to NULL. 

ERRORS

If status_return is not set to NULL, one of the following is returned in status_return:

 0 AENoError

 2 AEBadAudio

 6 AEBadFileFormat

 7 AEBadDataFormat

 8 AEFileNotFound

11 AEBadFileHdr

12 AEUnrecognizableFormat

13 AEBadAttribute

16 AECantDetermineFormat

EXAMPLES

The following example converts the data in /mydir/audfile.wav to a 30-second Sun (NeXT) format "mono" Mulaw file, sampled at 8000 samples per second, and writes the result in /mydir/audfile.au. 

Audio *audio;                   /* audio connection */
AFileFormat src_fmt;            /* source file format */
AFileFormat dest_fmt;           /* destination file format */
AudioAttrMask a_mask;           /* audio attributes mask */
AudioAttributes dest_attr;      /* destination attributes */
long status;                    /* error status */
.
.
.
/* convert audio file */
static char s_name[] = {"/mydir/aufile.wav"};
src_fmt = AFFUnknown;           /* let AAPI determine file type */
static char d_name[] = {"/mydir/aufile.au"};
dest_fmt = AFFSun;              /* Sun (NeXT) format */
a_mask = 0;
dest_attr.type = ATSampled;     /* must set this */
dest_attr.attr.sampled_attr.data_format = ADFMulaw;
a_mask = a_mask | ASDataFormatMask;
dest_attr.attr.sampled_attr.sampling_rate = 8000;
a_mask = a_mask | ASSamplingRateMask;
dest_attr.attr.sampled_attr.channels = 1;
a_mask = a_mask | ASChannelsMask;
dest_attr.attr.sampled_attr.duration.type = ATTMilliseconds;
dest_attr.attr.sampled_attr.duration.milliseconds = 30000;
a_mask = a_mask | ASDurationMask;
AConvertAFile(audio, s_name, src_fmt, d_name, dest_fmt,
    a_mask, &dest_attr,&status);

DEPENDENCIES

This function belongs to the Audio Library of functions that manage connections to an audio server.  The audio server must run on a system that has audio hardware.  To find out whether or not your system has audio hardware, refer to the hardware manual that accompanies your system. 

AUTHOR

AConvertAFile() was developed by HP. 

SEE ALSO

ALoadAFile(3X), ASaveSBucket(3X). 

Using the Audio Application Program Interface.

Hewlett-Packard Company  —  HP-UX Release 9.03: April 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026