Skip to main content


If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: Looking for an API to edit audio files (Read 571 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Looking for an API to edit audio files

HI, New member here!

I was led to this site by an answer to someone's question on StackOverflow. I need to find an API (C, C++, preferably but Java will do) which will allow me to write code to read in a .WAV file and analyze it. Specifically to isolate sections with audio above an arbitrary volume level so I can section and save them off as individual files. The ability to identify the time delta where each occurs is also desired.

I have Audacity and can do this manually with their interface and waveform graphics but it would be nice to automate it so that I deal with many files in a batch mode by setting threshold values for volume in particular.

So far googling has yielded little - mostly utilities like Audacity.

Any help is appreciated and thanks!
Smbika (Sean)

Re: Looking for an API to edit audio files

Reply #1
Reading a (PCM) wave file and calculating the RMS signal level are each only a few lines of code in c/c++, so if that is all you want to do it might be easiest to do without using an external library.

Otherwise I would probably use something like Matlab, octave or python since they have built in code for doing this kind of thing. 

Re: Looking for an API to edit audio files

Reply #2
saratoga, thanks for the reply. I am so far unaware of the format of a PCM wave file so I guess I'll google that and possibly get a hint as to how to determine those values. I had wondered about that. But Matlab sounds like an interesting alternative and might be more suitable. I'll have to check to see if we have any licenses...they are quite tight on those.

Re: Looking for an API to edit audio files

Reply #3
You didn't say what platform you're using, and I've never done any audio programming but I assume there are Windows functions for opening WAV (and other audio) files.  

But the regular WAV format is fairly simple.   It's just a header followed by a series of sample values.    The only slightly-tricky thing is sorting-out & re-arranging the bytes to get the sample values.   If you're always working with the same format (say 16-bit stereo) that could be fairly easy but it would be "more professional" to parse the header and write code to handle all of the standard formats.

And if you're working with a variety of bit depths...   It's pretty common to convert-to floating-point before any processing or DSP.   In floating point 0dBFS is 1.0 so everything is "standardized" so  you don't have to worry about bit-depth, and you can mix & match different bit depths, etc.

I assume you know this, but with integers 0dBFS is the maximum signed value.   Except for 8-bits WAVs which use unsigned values and normally have o subtract-out the bias before any processing.  (I don't remember if "silence" is 127 or 128.)

Re: Looking for an API to edit audio files

Reply #4
For opening, reading and writing all manner of audio files, including wave files, is a pretty good place to start. It won't help with the rest of what you're after but at least you'll have clean input.

Re: Looking for an API to edit audio files

Reply #5
Hi,  it seems that oracle has provided powerful API to handle the audio file, the concrete Java Class for this purpose is: AudioSystem etc.

Furthermore, the Java official tutorials is available here as well:

Hope this helps!

SimplePortal 1.0.0 RC1 © 2008-2021