File: AFopenWrite.html

package info (click to toggle)
libtsp 2r8-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 4,908 kB
  • ctags: 1,409
  • sloc: ansic: 12,525; sh: 1,044; makefile: 164
file content (140 lines) | stat: -rw-r--r-- 4,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<HTML>
<HEAD>
<TITLE>TSP (libtsp/AF) - AFopenWrite</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFACD">
<H2>AFopenWrite</H2>
<HR>
<H4>Routine</H4>
<DL>
<DT>
AFILE *AFopenWrite (const char Fname[], int Fformat, long int Nchan,
double Sfreq, FILE *fpout)
</DL>
<H4>Purpose</H4>
<DL>
<DT>
Open an audio file for writing
</DL>
<H4>Description</H4>
This routine opens an audio file for writing.  This routine sets up the audio
file parameters to write data of the given format to the audio file.  After
writing data to the file, the routine AFclose should be called to update the
file header information and close the file.
<P>
This routine can write AFsp (Sun) audio files, RIFF WAVE files and
headerless audio files.
<P>
<DL>
<DT>
AFsp audio file:
<DD>
The AFsp audio file format uses a file header which is compatible with a
Sun audio file header.  By default, information consisting of the date, the
user and the program creating the file is written to the header.  The
routine AFsetHInfo can be called before calling this routine to specify
additional information to be written to the header.  Any such additional
header information is reset to null by this routine.  8-bit mu-law, 8-bit
A-law, 8-bit integer, 16-bit integer, 32-bit IEEE floating-point, 64-bit
IEEE floating-point data formats are supported.
<DT>
RIFF WAVE file:
<DD>
8-bit mu-law, 8-bit A-law, 8-bit integer, and 16-bit integer data formats
are supported.
<DT>
AIFF-C file:
<DD>
8-bit mu-law, 8-bit A-law, 8-bit integer, and 16-bit integer data formats
are supported.
<DT>
Headerless file:
<DD>
8-bit mu-law, 8-bit A-law, offset-binary 8-bit integer, 8-bit integer,
16-bit integer, 32-bit floating-point, 64-bit floating-point, and text data
formats are supported.  A text format file has the data in character form,
one value to a line.
</DL>
<P>
For the fixed point file data representations, input values in the following
ranges will be converted without clipping.
<PRE>
   data format       allowed values
  8-bit mu-law   - [ -32636, +32636 ]
  8-bit A-law    - [ -32768, +32768 ]
  8-bit integer  - [ -16384, -16383 ]
  16-bit integer - [ -32768, +32767 ]
</PRE>
For AFsp files containing floating-point data, values are scaled by
1/32768 before being written to the file.  For data values between
[ -32768, +32768 ], the file data will lie in the range [ -1, +1].  For
headerless files of any data format, the values are written scaled by unity.
<H4>Parameters</H4>
<DL>
<DT>
&lt;-  AFILE *AFopenWrite
<DD>
Audio file pointer for the audio file
<DT>
 -&gt; const char Fname[]
<DD>
Character string specifying the file name
<DT>
 -&gt; int Fformat
<DD>
Audio file format code, evaluated as the sum of a data format code and a
file type,
<PRE>
  Fformat = Dformat + Ftype
</PRE>
For Ftype equal to zero, the file will have the standard AFsp audio file
header.  The Ftype flag allows for other file types as described below.
Note that not all data formats are allowed for all file types.
Dformat: data format
<PRE>
  FD_MULAW8  = 1,  mu-law 8-bit data
  FD_ALAW8   = 2,  A-law 8-bit data
  FD_UINT8   = 3,  offset-binary 8-bit integer data
  FD_INT8    = 4,  two's-complement 8-bit integer data
  FD_INT16   = 5,  two's-complement 16-bit integer data
  FD_FLOAT32 = 6,  32-bit floating-point data
  FD_FLOAT64 = 7,  64-bit floating-point data
  FD_TEXT    = 8,  text data
</PRE>
Ftype: file type
<PRE>
  FW_AFsp      = AFsp (Sun) audio file
  FW_WAVE      = 256, RIFF WAVE file
  FW_AIFF_C    = 512, AIFF-C audio file
  FW_NH_EB     = 768, Headerless file (big-endian byte order)
  FW_NH_EL     = 1024, Headerless file (little-endian byte order)
  FW_NH_NATIVE = 1280, Headerless file (native byte order)
  FW_NH_SWAP   = 1536, Headerless file (swapped byte order)
</PRE>
<DT>
 -&gt; long int Nchan
<DD>
Number of channels
<DT>
 -&gt; double Sfreq
<DD>
Sampling frequency
<DT>
 -&gt; FILE *fpout
<DD>
File pointer for printing audio file information.  If fpout is not NULL,
information about the audio file is printed on the stream selected by
fpout.
</DL>
<H4>Author / revision</H4>
P. Kabal  Copyright (C) 1996
/ Revision 1.39  1996/11/26
<H4>See Also</H4>
<A HREF="AFclose.html">AFclose</A>,
<A HREF="AFwriteData.html">AFwriteData</A>,
<A HREF="AFsetHinfo.html">AFsetHinfo</A>
<P>
<HR>
Main Index <A HREF="../libtsp.html">libtsp</A>
</BODY>
</HTML>