tags:

views:

72

answers:

1

Hello,

I am trying to do some wav processing using Lua, but have fallen a the first hurdle! I cannot find a function or library that will allow me to load a wav file and access the raw data. There is one library, but it onl allows playing of wavs, not access to the raw data.

Are there any out there?

Cheers, Pete.

+1  A: 

Hi,

I don't think Lua is the right tool for raw audio data processing, mainly because Lua uses only a single numeric data type - doubles. Also, Lua cannot directly access the elements of a data stream, although you can use something like the struct library ( http://www.inf.puc-rio.br/~roberto/struct/ )

A better way to process the data would be to write the filters in C, with binding for Lua, and then use Lua for higher level processing, like (imaginary toolkit):

require 'wave'
-- load the wave
wav = wave.load('file.wav', 's16')
-- apply some filters
thresh = wave.threshold(wav, 0.5)
faded = wave.fadeout(thresh, 5)

MiKy
See http://www.mat.ucsb.edu/~wakefield/lua~/lua~.htm
lhf
Thanks for the reply. I wasn't planning an application per se, just a couple of scripts to carry out fairly rudimentary ops on files so performance was not a huge issue. However, the data type thing may cause a problem.
Pete Webbo