annotate src/libsndfile-1.0.27/doc/octave.html @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents cd6cdf86811e
children
rev   line source
cannam@125 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
cannam@125 2 <HTML>
cannam@125 3
cannam@125 4 <HEAD>
cannam@125 5 <TITLE>
cannam@125 6 libsndfile and GNU Octave
cannam@125 7 </TITLE>
cannam@125 8 <META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
cannam@125 9 <LINK REL="stylesheet" HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
cannam@125 10 <LINK REL="stylesheet" HREF="print.css" TYPE="text/css" MEDIA="print">
cannam@125 11 </HEAD>
cannam@125 12
cannam@125 13 <BODY>
cannam@125 14
cannam@125 15 <BR>
cannam@125 16 <H1><B>libsndfile and GNU Octave</B></H1>
cannam@125 17 <P>
cannam@125 18 <A HREF="http://www.octave.org/">GNU Octave</A> is a high-level interactive
cannam@125 19 language for numerical computations.
cannam@125 20 There are currently two development streams, a stable 2.0.X series and a
cannam@125 21 development 2.1.X series.
cannam@125 22 Octave reads and writes data in binary formats that were originally developed
cannam@125 23 for
cannam@125 24 <A HREF="http://www.mathworks.com/">MATLAB</A>.
cannam@125 25 Version 2.0.X of Octave uses binary data files compatible with MATLAB
cannam@125 26 version 4.2 while Octave 2.1.X uses binary data files compatible
cannam@125 27 with MATLAB version 5.0 as well as being able to read the older MATLAB 4.2
cannam@125 28 format.
cannam@125 29 </P>
cannam@125 30 <P>
cannam@125 31 From version 1.0.1 of libsndfile onwards, libsndfile has the ability of reading
cannam@125 32 and writing a small subset of the binary data files used by both versions
cannam@125 33 of GNU Octave.
cannam@125 34 This gives people using GNU Octave for audio based work an easy method of
cannam@125 35 moving audio data between GNU Octave and other programs which use libsndfile.
cannam@125 36 </P>
cannam@125 37 <P>
cannam@125 38 For instance it is now possible to do the following:
cannam@125 39 </P>
cannam@125 40
cannam@125 41 <UL>
cannam@125 42 <LI> Load a WAV file into a sound file editor such as
cannam@125 43 <A HREF="http://www.metadecks.org/software/sweep/">Sweep</A>.
cannam@125 44 <LI> Save it as a MAT4 file.
cannam@125 45 <LI> Load the data into Octave for manipulation.
cannam@125 46 <LI> Save the modified data.
cannam@125 47 <LI> Reload it in Sweep.
cannam@125 48 </UL>
cannam@125 49 <P>
cannam@125 50 Another example would be using the MAT4 or MAT5 file formats as a format which
cannam@125 51 can be easily loaded into Octave for viewing/analyzing as well as a format
cannam@125 52 which can be played with command line players such as the one included with
cannam@125 53 libsndfile.
cannam@125 54 </P>
cannam@125 55
cannam@125 56 <H2><B>Details</B></H2>
cannam@125 57 <P>
cannam@125 58 Octave, like most programming languages, uses variables to store data, and
cannam@125 59 Octave variables can contain both arrays and matrices.
cannam@125 60 It is also able to store one or more of these variables in a file.
cannam@125 61 When reading Octave files, libsndfile expects a file to contain two
cannam@125 62 variables and their associated data.
cannam@125 63 The first variable should contain a variable holding the file sample rate
cannam@125 64 while the second variable contains the audio data.
cannam@125 65 </P>
cannam@125 66 <P>
cannam@125 67 For example, to generate a sine wave and store it as a binary file which
cannam@125 68 is compatible with libsndfile, do the following:
cannam@125 69 </P>
cannam@125 70 <PRE>
cannam@125 71 octave:1 > samplerate = 44100 ;
cannam@125 72 octave:2 > wavedata = sin ((0:1023)*2*pi/1024) ;
cannam@125 73 octave:3 > save sine.mat samplerate wavedata
cannam@125 74 </PRE>
cannam@125 75
cannam@125 76 <P>
cannam@125 77 The process of reading and writing files compatible with libsndfile can be
cannam@125 78 made easier by use of two Octave script files :
cannam@125 79 </P>
cannam@125 80 <PRE>
cannam@125 81 octave:4 > [data fs] = sndfile_load ("sine.mat") ;
cannam@125 82 octave:5 > sndfile_save ("sine2.mat", data, fs) ;
cannam@125 83 </PRE>
cannam@125 84 <P>
cannam@125 85 In addition, libsndfile contains a command line program which which is able
cannam@125 86 to play the correct types of Octave files.
cannam@125 87 Using this command line player <B>sndfile-play</B> and a third Octave script
cannam@125 88 file allows Octave data to be played from within Octave on any of the platforms
cannam@125 89 which <B>sndfile-play</B> supports (at the moment: Linux, MacOS X, Solaris and
cannam@125 90 Win32).
cannam@125 91 </P>
cannam@125 92 <PRE>
cannam@125 93 octave:6 > sndfile_play (data, fs) ;
cannam@125 94 </PRE>
cannam@125 95 <P>
cannam@125 96 These three Octave scripts are installed automatically in Octave's site
cannam@125 97 script directory when libsndfile is installed (except on Win32) ie when
cannam@125 98 libsndfile is being installed into /usr/local, the Octave scripts will
cannam@125 99 be installed in /usr/local/share/octave/site/m/.
cannam@125 100 </P>
cannam@125 101
cannam@125 102 <P>
cannam@125 103 There are some other Octave scripts for audio to be found
cannam@125 104 <A HREF="http://octave.sourceforge.net/audio/index.html">here</A>.
cannam@125 105 </P>
cannam@125 106
cannam@125 107 <BR>
cannam@125 108 <!-- ========================================================================= -->
cannam@125 109
cannam@125 110 <HR>
cannam@125 111 <P>
cannam@125 112 The libsndfile home page is here :
cannam@125 113 <A HREF="http://www.mega-nerd.com/libsndfile/">
cannam@125 114 http://www.mega-nerd.com/libsndfile/</A>.
cannam@125 115 </P>
cannam@125 116
cannam@125 117 </BODY>
cannam@125 118 </HTML>