Murga-Projects Forums
Lua stand-alone audio library - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Lua stand-alone audio library (/showthread.php?tid=360)


Lua stand-alone audio library - znarf - 01-10-2009 11:34 PM

Hi,

while waiting for the much-anticipated murgaLua 0.7 release, I've done my best to close a gap in the Lua library module landscape. If you are interested in a free cross-platform stand-alone Lua audio library compatible to with murgaLua, have a look at proteaAudio.

Cheers,
Gerald


RE: Lua stand-alone audio library - iGame3D - 01-16-2009 02:17 PM

I didn't want your hard work going unappreciated.
Good job.

Wish I new the first thing about doing something with an audio library.


RE: Lua stand-alone audio library - JohnMurga - 01-16-2009 11:40 PM

That is VERY cool :-)

Apologies for my delay in releasing 0.7 :-(


RE: Lua stand-alone audio library - jyf1987 - 01-17-2009 12:02 AM

i dont know cpp programming,recently i am learning pure C programming,hope i can do a favor


RE: Lua stand-alone audio library - znarf - 01-21-2009 10:21 PM

Hi,

thank you for your encouraging words and a special thanks to jyf1987 for his testing and suggestions for improvements. I've uploaded a new proteaAudio version today which includes an example for dynamically generating sound samples in Lua. It's nice to work with a language that allows such things in a few lines of code...


RE: Lua stand-alone audio library - jpjacobs - 01-21-2009 11:26 PM

Hi!

I really like the idea of having a lua soundlib, even if I don't know yet what to do with itSmile
Just a little hint: it would be nice if you pack the zipfiles to unzip in their own directory.
so to cd .. before zipping. That way it's easier to unpack them without clobbering the current directory.
For the rest: keep up the good work!
JP


RE: Lua stand-alone audio library - jpjacobs - 01-22-2009 03:45 AM

Hmm, I can't get it to work with murgaLua 0.6.9.
It throws me this error:

> require'proAudioRt'
error loading module 'proAudioRt' from file './proAudioRt.so':
./proAudioRt.so: undefined symbol: luaL_register
stack traceback:
[C]: ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: ?

While it works nicely in plain lua5.1.
Hope this gets a workaround for the new 0.7 release Smile

JP


RE: Lua stand-alone audio library - jyf1987 - 01-22-2009 01:41 PM

it's quite useful to me,:]
but i still dont know how you generate the wav data in your example 2
recently i am using lua-gd and found it magicly
but after see your example 2,i found it more magicly!


RE: Lua stand-alone audio library - znarf - 01-22-2009 09:15 PM

jpjacobs Wrote:
It throws me this error:

> require'proAudioRt'
error loading module 'proAudioRt' from file './proAudioRt.so':
./proAudioRt.so: undefined symbol: luaL_register


Phew, I must admit I've tested murgaLua compatibility only under Windows, whereas I tested proteaAudio under Linux only with plain Lua.
Basically I see two possible explanations:
- the method luaL_register is not present in Linux murgaLua
- the shared object (generated in Ubuntu 7.10 32bit) module is not binary compatible with your distribution. I do not have much experience with generating compatible Linux binaries, I just know that this could be an issue, especially if the code is C++ internally.

I'll check and let you know! If everything fails, there is at least the source distribution...

@jyf1987: in order to understand what's going on when generating the sine sample, it's best to look at the generated wave data table visually. It's a great feature of murgaLua that it always allows you accessing FLTK's drawing functions easily...


RE: Lua stand-alone audio library - jyf1987 - 01-23-2009 01:57 AM

i think i need to learn some knowledges about sound,:]

BTW,



RE: Lua stand-alone audio library - znarf - 01-23-2009 06:31 AM

ok, I had a look at the issue reported by jpjacobs, and, to my dislike, also on my machine I cannot get proteaAudio working under murgaLua Linux.

I'm wondering what could be the cause of it, my first guess was that there is something missing in murgaLua like bindings to libdl or so. Indeed, a test of murgaLua with ldd returned "Not a dynamic executable." However, then I realized that murgaLua is packed with upx, after decompression it obviously shows its binding to libdl.

So I do not have the slightest clue why there is this error. Since proteaAudio works with the unchanged standard Lua, this gives me the impression that there's something special with murgaLua. Has anyone ever been successful in creating a dynamic lua C module working with murgaLua under Linux? If yes, I'd be really keen on peeping in the Makefile. Please, if someone knows something about this, let me know, I'll happily adapt my build script.


RE: Lua stand-alone audio library - mikshaw - 01-24-2009 03:58 PM

Quote:
Has anyone ever been successful in creating a dynamic lua C module working with murgaLua under Linux?

I'm no expert, but I've never successfully built a Linux C library for murgaLua, but I haven't had any success with Lua either.


RE: Lua stand-alone audio library - Juergen - 01-26-2009 10:52 AM

znarf Wrote:
ok, I had a look at the issue reported by jpjacobs, and, to my dislike, also on my machine I cannot get proteaAudio working under murgaLua Linux.

I'm wondering what could be the cause of it, my first guess was that there is something missing in murgaLua like bindings to libdl or so. Indeed, a test of murgaLua with ldd returned "Not a dynamic executable." However, then I realized that murgaLua is packed with upx, after decompression it obviously shows its binding to libdl.

So I do not have the slightest clue why there is this error. Since proteaAudio works with the unchanged standard Lua, this gives me the impression that there's something special with murgaLua. Has anyone ever been successful in creating a dynamic lua C module working with murgaLua under Linux? If yes, I'd be really keen on peeping in the Makefile. Please, if someone knows something about this, let me know, I'll happily adapt my build script.


What type of error do you get? (Is it a segmentation fault or a linker problem)

I did try it and it works without a problem. It looks like you are using an older compiler, because I had to make a few changes to compile it, but then it worked without any problems.

To comile it with a newer compiler. you have to add "#include <cstdlib>" to playAudioRt.cpp and proAudioRt.cpp. proAudioRt.cpp also needs "<cstring>" and "<climits>", while "<cstdio>" is not needed. If this changes are made it should also compile with a current gcc.

Of course you also have to explictely link it to liblua.so either statically (which doesn't make sense) or dynamically. Therefore you need a compatible liblua.so.5.1 installed in a place where the dynamic linker can find it. While murgaLua is statically linked against liblua, it unfortunatelly doesn't extort those symbols and it also has no dependency for liblua set. Therefore your library needs the liblua dependency, so that the linker can load it and resolve those symbols. If you wan't to use a precompiled library that isn't exlicitely linked against liblua, then you can still preload it like: "LD_PRELOAD=/usr/lib/liblua.so murgaLua my_app.lua"

Juergen


RE: Lua stand-alone audio library - JohnMurga - 02-05-2009 01:10 AM

znarf Wrote:
ok, I had a look at the issue reported by jpjacobs, and, to my dislike, also on my machine I cannot get proteaAudio working under murgaLua Linux.


I am currently trying your lib with all the official murgaLua ports.

I didn't have any probs with Intel Linux, however, the new OpenMoko murgaLua does have some problems that I had to patch RtAudio itself in order to fix.

I have a lot of testing left to do, but it is something that I'd like to bundle with the final runtimes (if you don't mind).

As to when that will be, I don't know as I am very busy with work and I keep on making little tweaks to murgaLua.

Cheers
John de Murga


RE: Lua stand-alone audio library - znarf - 02-05-2009 07:54 AM

Hi,
thanks again for your feedback. I've updated proteaAudio according to Juergen's suggestions (additional includes) and moved the files in the zip archives to single subfolders (thanks to Jan-Pieter for this idea).

Quote:
the new OpenMoko murgaLua does have some problems that I had to patch RtAudio itself in order to fix.

I've updated rtAudio to the brand-new 4.0.5 release, which seems to fix a few issues.

Quote:
I have a lot of testing left to do, but it is something that I'd like to bundle with the final runtimes (if you don't mind).

Of course you are very welcome to bundle proteaAudio, as one of my motivations when writing it was to give something back to murgaLua.
If possible, I'd also like to apply your patches to the proteaAudio stand-alone release, in order to keep future improvements compatible.

Regards,
Gerald


RE: Lua stand-alone audio library - Juergen - 02-05-2009 08:57 AM

znarf Wrote:
Hi,
thanks again for your feedback. I've updated proteaAudio according to Juergen's suggestions (additional includes) and moved the files in the zip archives to single subfolders (thanks to Jan-Pieter for this idea).

"rtaudio/RtAudio.cpp" is still missing the "#include <climits>". Otherwise I get an error, because INT_MAX is undeclared.

Also you did link explicitly against /usr/lib/liblua5.1.so which is an error. First the name should be liblua.so.5.1 and second if you link explicitly, the user has to provide the library "liblua5.1.so" (which is ill named), even if the symbols can be provided otherwise. If you use "-llua" then the compiler uses lazy linking and if the symbols can be resolved otherwise (from LD_PRELOAD or they are already imported from the interpreter or another library) the linker doesn't insist to load it.

Juergen


RE: Lua stand-alone audio library - znarf - 02-06-2009 08:13 AM

Juergen Wrote:
"rtaudio/RtAudio.cpp" is still missing the "#include <climits>". Otherwise I get an error, because INT_MAX is undeclared.
Also you did link explicitly against /usr/lib/liblua5.1.so which is an error.

I'd like to apologize, both things are fixed now in the source package.

Thanks for reporting,
Gerald