7018
|
1 @c Copyright (C) 1996, 1997, 1999, 2000, 2002, 2005, 2007 Kurt Hornik |
|
2 @c |
|
3 @c This file is part of Octave. |
|
4 @c |
|
5 @c Octave is free software; you can redistribute it and/or modify it |
|
6 @c under the terms of the GNU General Public License as published by the |
|
7 @c Free Software Foundation; either version 3 of the License, or (at |
|
8 @c your option) any later version. |
|
9 @c |
|
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 @c for more details. |
|
14 @c |
|
15 @c You should have received a copy of the GNU General Public License |
|
16 @c along with Octave; see the file COPYING. If not, see |
|
17 @c <http://www.gnu.org/licenses/>. |
|
18 |
5428
|
19 @c Written by Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> on 1996/05/14 |
3294
|
20 |
4167
|
21 @node Audio Processing |
3294
|
22 @chapter Audio Processing |
|
23 |
|
24 Octave provides a few functions for dealing with audio data. An audio |
|
25 `sample' is a single output value from an A/D converter, i.e., a small |
|
26 integer number (usually 8 or 16 bits), and audio data is just a series |
|
27 of such samples. It can be characterized by three parameters: the |
|
28 sampling rate (measured in samples per second or Hz, e.g. 8000 or |
|
29 44100), the number of bits per sample (e.g. 8 or 16), and the number of |
|
30 channels (1 for mono, 2 for stereo, etc.). |
|
31 |
|
32 There are many different formats for representing such data. Currently, |
|
33 only the two most popular, @emph{linear encoding} and @emph{mu-law |
|
34 encoding}, are supported by Octave. There is an excellent FAQ on audio |
|
35 formats by Guido van Rossum <guido@@cwi.nl> which can be found at any |
|
36 FAQ ftp site, in particular in the directory |
|
37 @file{/pub/usenet/news.answers/audio-fmts} of the archive site |
|
38 @code{rtfm.mit.edu}. |
|
39 |
|
40 Octave simply treats audio data as vectors of samples (non-mono data are |
|
41 not supported yet). It is assumed that audio files using linear |
|
42 encoding have one of the extensions @file{lin} or @file{raw}, and that |
|
43 files holding data in mu-law encoding end in @file{au}, @file{mu}, or |
|
44 @file{snd}. |
|
45 |
3332
|
46 @DOCSTRING(lin2mu) |
3294
|
47 |
3332
|
48 @DOCSTRING(mu2lin) |
3294
|
49 |
3332
|
50 @DOCSTRING(loadaudio) |
3294
|
51 |
3332
|
52 @DOCSTRING(saveaudio) |
3294
|
53 |
|
54 The following functions for audio I/O require special A/D hardware and |
|
55 operating system support. It is assumed that audio data in linear |
|
56 encoding can be played and recorded by reading from and writing to |
|
57 @file{/dev/dsp}, and that similarly @file{/dev/audio} is used for mu-law |
|
58 encoding. These file names are system-dependent. Improvements so that |
|
59 these functions will work without modification on a wide variety of |
|
60 hardware are welcome. |
|
61 |
3332
|
62 @DOCSTRING(playaudio) |
3294
|
63 |
3332
|
64 @DOCSTRING(record) |
3294
|
65 |
3332
|
66 @DOCSTRING(setaudio) |
|
67 |
6549
|
68 @DOCSTRING(wavread) |
|
69 |
|
70 @DOCSTRING(wavwrite) |