Javascript and AudioFiles

I am still puzzled by an efficient method of splitting and merging my
audio files faster than real-time. I never thought of using
Javascript to do so, but it might be a good idea… the only problem
is that I can’t make any sense of the info I get.

Is there a way to read the file header so I can get the sampling
rate, the number of channel, according to a certain file type? Does
it make sense to do it like this, if I don’t want to import the file
in a buffer~?

I started working on JavaScipt code that parses aiff files (I think I
even post it, but I may be wrong – I can send it to you if you want)
but I stopped because file accesses were just to slow. I think Java is
the way to go (or C), unfortunately, I had no time yet to study enough
Java to start working on this. I’m sure there must be Java libraries
available to parse sound files.

On around Feb 6, 2006, at 23:52, Patrick Delges said something like:
> I started working on JavaScipt code that parses aiff files (I think I
> even post it, but I may be wrong – I can send it to you if you want)
> but I stopped because file accesses were just to slow. I think Java is
> the way to go (or C)

About ten years ago a guy at Harvard named Ben Denckla put together a
"AIFF DSP Framework" that did all the grunt work of handling AIFF files
and gave you a simple micro-API for writing code that played with the
audio data without worrying about headers and stuff.

It ran on SunOS, HP-UX, Ultrix, NeXTStep, OSF, and Mac OS… I suppose
that was System 7.1 or something.

I built some code with it as recently as six years ago using
Metrowerks. It was not hard. It *was* in C (we’re talking 1994).

this has been a subject of debate on the list/forum many times. more
on that below. You should check back in the forum. I believe
andrew benson posted an example of using jitter matrices to replicate
cut copy and paste of AUDIO buffers.

The debate————————-

The Argument of the people who think this functionality should be
explicitly supported on the list is that "If your coming to max to
escape commercial software, Max should at least support the
functionality of the most basic non-real-time audio programs like
sequencing, cut,copy,merge and paste"
The argument of the people who think the functionality should not be
included are those who believe that rather than focus on max’s
ability to replicate existing software, it should focus on being a
live instrument unto itself. and if your listening and processing in
real time, these functions are not the best tools for the job.

Nearly anything is possible in max. When the folks at C74 post
examples, you see just how limited by your own knowledge base you
are. The example mentioned above really proves this.

> I started working on JavaScipt code that parses aiff files (I think
> I even post it, but I may be wrong – I can send it to you if you want)

Patrick, I have not found it in the archives. Can you please post it
on the list?

> If you’re considering C , check out libsndfile.

and

>> I’m sure there must be Java libraries available to parse sound files.
>
> I played with this a year or so ago. The Java Media Framework (JMF)
> is what you’re after, but you’re at the mercy of whatever codecs
> are available on your system.

I will look into this later today, and post to the list anything I
can get out of it. I will probably start with java, so we can use it
on both platform.

Pierre Alexandre Tremblay wrote:
> 1. When I look at the AudioFileBuffer Class Reference, I cannot see any
> open modes (write, for instance…) Does it mean that this class opens
> a file pointer in read mode only?

AFAIK it just fills an in-memory buffer with the audio data, and
provides some read-only meta-data. If you want to write audio data or
have random access from disk then one of JavaSound (pretty basic) or the
Java Media Framework will be the thing, I think.