-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcs229FileFormat.txt
More file actions
66 lines (57 loc) · 3.63 KB
/
Copy pathcs229FileFormat.txt
File metadata and controls
66 lines (57 loc) · 3.63 KB
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
From the assignment description by Dr. Andrew Miner
(his website: http://www.cs.iastate.edu/~asminer)
CS229 file format
The .cs229 sound format is a plain text file (probably the only sound format
ever to use plain text). Be sure that you can handle text files created both
in UNIX and in DOS. The intention of the format is to be flexible enough to be
easy to use, yet rigid enough to be easy for your programs to read. For the most
part, the file consists of keywords and values, both of which are guaranteed to
be "contiguous" text. Keywords may be upper, lower, or mixed case. A file is
structured as follows:
CS229
<header>
StartData
<samples>
<EOF>
where "CS229" and "StartData" are keywords, and "<EOF>" means "end of file".
Note that the keyword "CS229" appears at the very beginning of the file. The
"<header>" section consists of zero or more lines formatted in one of these
three ways.
1. Blank (should be ignored)
2. Starting with "#" (should be ignored)
3. "keyword (whitespace) (value)" where (whitespace) refers to any number of
tabs and spaces, and (value) refers to an integer. Legal keywords are:
SampleRate, Samples, Channels, BitRes.
The "<samples>" section consists of a line for each sample, where each sample
is of the form "(value)1 (whitespace) (value)2 ... (value)c"
* The sample rate (SampleRate), number of channels (Channels), and bit depth
(BitRes) must be specified. The number of samples (Samples) is optional.
* The values specified for each sample are signed integers and are in the
appropriate range for the bit depth. For example, if the bit depth is 8,
then the legal range for all sample data is from -127 to 127.
* If the number of samples is specified, then there must be exactly that much
sample data in the file.
The file shown in Figure 3 is an example of a legal .cs229 file.
_____________________________________________________________________________
| |
| Cs229 |
| |
| # A really short sound to illustrate this file format |
| |
| Samples 4 |
| # We are doing something bizarre with the channels? |
| channels 3 |
| |
| BitRes 8 |
| |
| # Because we can |
| SaMpLeRaTe 11025 |
| |
| # From here on things are more rigid |
| STARTdata |
| 0 -127 127 |
| 10 45 -103 |
| 20 83 -4 |
| 30 0 99 |
|_____________________________________________________________________________|
Figure 3: An example .cs229 file