1

I'm using the Ansca Corona version of Lua and was wondering what's the best way to get at the raw uncompressed sample data in a 5 second long 3GP audio file ?

Perhaps convert the 3GP to RAW (or WAV) ?

Doug Currie
  • 40,708
  • 1
  • 95
  • 119
Father Ted
  • 41
  • 1
  • 6

1 Answers1

1

You haven't stated why you need the raw audio data, or what kind of files you expect to process, so I will talk generally. Unfortunately AFAIK there is no pure Lua code to do what you want to achieve. You can only resort to using external libraries. Implementing the whole AMR audio decoder, which is usually embedded in the 3GP container, in pure Lua would be a hard task. You have roughly the following options:

  • If Corona has support for LuaJIT with the FFI, you can try compiling FFmpeg or it's fork Libav and use it directly from Lua source as demonstrated in my example.
  • If you can load external libraries, try creating some simple binding code which uses the libraries above (or maybe some other) to do the conversion and return the data in a Lua-readable style, like a table.

If you cannot use external libraries, I see only this option:

  • Use a web-service to which the user / application sends the 3GP and it returns the raw data. This would only work for small sounds / fast connection.
Michal Kottman
  • 16,375
  • 3
  • 47
  • 62