[music-dsp] Math programs
janmarguc at gmail.com
Mon Feb 28 17:20:11 EST 2005
always a pleasure to read your posts to this list.
Matlab is definitively a cool program containing enormous amounts of expert
knowledge from diverse scientific fields. I think you'll find it
particularly useful as a helper when solving DSP problems. Plotting features
are built-in and quite comfortable to use. You can also easily export
figures to a wide range of formats.
Be aware though, that Matlab is a short-form of "Matrix lab" and that's what
it's all about. All your data is represented as matrices (vectors as a
subset of these). That means that you don't represent your maths as symbolic
expressions, but work with a discretized version of it, i.e. it's good for
any calculation that can be put into a numeric form. Symbolic math is also
possible in Matlab using specialized functions, but it's clearly not the
focus of the language.
My experience with Octave is rather limited, but I'd say that if you are
willing to pay the money for Matlab (and it's a LOT of money) then that
would be the preferable choice right now. Please don't get me wrong, I think
the Octave project is a brilliant thing (as is any Open Source project), I
just feel that it needs a little more time to develop, especially on the
Windows side. The problems that I ran into recently when using Octave was
lack of support for audio formats (.wav in particular). Octave seems to read
only 16-bit wave files, whereas Matlab supports 24-bit and even 32-floating
point wave files (and I really needed this to see what was going on in the
lower end of the dynamic range).
A thing that I dislike about Octave is that it uses GNU plot for the
graphics. Under Windows this appears to be very slow in comparison to Matlab
and what's worse is that you cannot do subplots (that is, multiple graphs in
one figure). I guess the integration with GNU plot works better under UNIX
systems through pipes or whatnot. There are remedies to this though, such as
the "EPS Toolkit" package by Stefan Mueller which consists of a set of
Matlab/Octave files that allow you to write EPS files that be viewed in
ghostscript. In someway it actually complements Matlab's own plotting
functions and is surely an alternative to the slow GNU plot.
Also, perhaps anybody knows whether there exists a comfortable IDE for using
Octave for Windows?
Scilab is yet another Matlab clone. Am not so familiar with it, but it seems
to me that the development of Octave is going faster, since it is taking
place in the Open Source community. I was astouned to find a huge number of
functions that were 1:1 compatible with Matlab's, and if you decide to give
Octave a try, be sure to download the octave-forge package too (or an
installation that contains it), because it is in this library of functions
(more than just the programming language) that the real good DSP stuff lies!
So to close with your own words: "Reckon learning a math program is roughly
equivalent to learning a new programming language AND learning a new IDE?"
For numerical problems: yes. For solution of analytical problems, check out
Maxima or similar tools. If you do choose numerical packages such as Matlab,
Octave or Scilab, you'll write code that looks pretty much like basic. In
order to gain performance (because it is an interpreted language and as such
not that fast) you will try to formulate your calculations as matrix
operations. The way I view it, simple matrix operations come close to the
optimizations that you do every day in C functional C coding, where you also
split your algorithms up into sequential parts in order to get short loops
and good cache performance. The ability to integrate your existing C
libraries through the MEX interface may also be interesting for you.
Oh yes, and before I forget it: you get to accept the convention that
indexing into vectors/matrices starts with 1 and not with 0 as we know it
from C. As far as I know, this indexing convention stems from way back, when
Matlab was written in Fortran. Gives you a lot of fun when converting a
large body of Matlab code into C... ;-)
----- Original Message -----
From: "James Chandler Jr" <jchandjr at bellsouth.net>
To: "music-dsp" <music-dsp at ceait.calarts.edu>
Sent: Monday, February 28, 2005 10:10 PM
Subject: [music-dsp] Math programs
> ----- Original Message -----
> From: "Nigel Redmon" <earlevel at earlevel.com>
> >I think it's a good idea to fiddle with filters in a math program and
> >output. I plot just about everything before I code.
> Thanks for the graphic example Nigel. Yer png graph showed up fine in
> I should learn a math program. From brief inspection, Octave looks
> labor-intensive. SciLab looks more promising.
> To minimize the learning/setup curve-- If money were no object, is matlab
> way to go?
> Reckon learning a math program is roughly equivalent to learning a new
> programming language AND learning a new IDE? Would free programs like
> entail more work, having to search out tools or roll yer own?
> How much time does it take a dummy to become moderately proficient in
> I have a long-ago-written audio helper program that reads a command text
> and processes the list of audio files.
> The command text file specifies input/output files (and other conditions).
> repeatedly tweak an algorithm, hit run, and quickly see/hear the results
> CoolEdit. Since the utility program encapsulates the audio in/out, the
> processing function is the only thing I have to write.
> The utility program has common audio classes. If I want an RBJ filter in
> block processing function, something like--
> RBJNotchFilt.FilterMonoBuf(InFloatPtr, InFloatPtr, InputNumBytes);
> //filter the buffer in-place
> Having added a class for Dave's polyphase halfband, it is easy to one-line
> in the same fashion--
> HalfBandFilt.ProcessMonoBuf(InFloatPtr, ResampleDirection, InputNumBytes);
> There is a tradeoff between slower development using known tools, against
> possibly faster development after spending some unknown time learning a
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
More information about the music-dsp