thelinx / lao Goto Github PK
View Code? Open in Web Editor NEWA library for audio output through Lua.
Home Page: http://thelinx.github.com/lao/
A library for audio output through Lua.
Home Page: http://thelinx.github.com/lao/
I have lao installed on OS X 10.8.5 and on a Linux Mint 14 Virtualbox VM, both via luarocks. I'm running the example Lua script.
On OS X, ao.openLive()
causes a segmentation fault. On Mint, at least it just errs: Lua prints the default error "something went wrong", returned from l_open_live
.
Not sure if this is the cause, but when trying to compile I get complaints that the ao_option *opt
inside table2option
can return uninitialized. As noted here, that means it points to jibberish:
http://stackoverflow.com/a/7150353
Either way, passing an option table to ao.openLive()
doesn't help -- segfault persists.
i'm using the example ao_live.lua
but show this error, my operating system is GNU/Linux:
$ luajit ao_live.lua
=================================================
=> type: live
=> priority: 50
=> options:
- server
- sink
- dev
- id
- verbose
- quiet
- matrix
- debug
- client_namebuffer_time
=> shortName: pulse
=> preferredByteFormat: native
=> comment: Outputs to the PulseAudio Sound Server
=> name: PulseAudio Output
=================================================
=> type: live
=> priority: 20
=> options:
- dsp
- dev
- id
- buffer_time
- verbose
- quiet
- matrix
- debug
=> shortName: oss
=> preferredByteFormat: native
=> comment: Outputs audio to the Open Sound System driver.
=> name: OSS audio driver output
=================================================
=> type: live
=> priority: 0
=> options:
- debug
- verbose
- matrix
- quiet
=> shortName: null
=> preferredByteFormat: native
=> comment: This driver does nothing.
=> name: Null output
=================================================
=> type: file
=> priority: 0
=> options:
- matrix
- verbose
- quiet
- debug
=> shortName: wav
=> preferredByteFormat: little
=> comment: Sends output to a .wav file
=> name: WAV file output
=================================================
=> type: file
=> priority: 0
=> options:
- byteorder
- matrix
- verbose
- quiet
- debug
=> shortName: raw
=> preferredByteFormat: native
=> comment: Writes raw audio samples to a file
=> name: RAW sample output
=================================================
=> type: file
=> priority: 0
=> options:
- matrix
- verbose
- quiet
- debug
=> shortName: au
=> preferredByteFormat: big
=> comment: Sends output to a .au file
=> name: AU file output
=================================================
=> Device ID: 0
=================================================
luajit: ao_live.lua:32: cannot open the device
stack traceback:
[C]: in function 'openLive'
ao_live.lua:32: in main chunk
[C]: at 0x5564d7c0cf40
I've just installed a new debian, and I'm getting that
lua: error loading module 'ao' from file '/usr/local/lib/lua/5.3/ao.so':
/usr/local/lib/lua/5.3/ao.so: undefined symbol: ao_file_extension
error. This means that lots of people probably get it. Seeing that ao_file_extension only occurs in the l_file_extension routine, which is undocumented in lao and always has been, I'd like to suggest that we comment out that routine . . .
I'm trying to run examples/ao_live.lua
which crashes with the message
lua: error loading module 'ao' from file '/usr/local/lib/lua/5.1/ao.so':
Error relocating /usr/local/lib/lua/5.1/ao.so: ao_file_extension: symbol not found
stack traceback:
[C]: ?
[C]: in function 'require'
examples/ao_live.lua:1: in main chunk
[C]: ?
I'm using Alpine Linux with libao-1.2.0-r1
. Any idea what could be wrong since the version is the most recent one (1.2)?
Greetings again; in lao.c, l_play(lua_State *L) tries to duplicate the samples::
char *buffer = strndup(samples, num_bytes);
but http://linux.die.net/man/3/strndup says:
The strndup() function is similar, but ONLY COPIES AT MOST n bytes.
If s is longer than n, only n bytes are copied, and a terminating null byte ('\0') is added.
and I found ao_example.lua just played random noise and garbage :-(
But if I play the samples directly:
int result = ao_play(dev, samples, num_bytes);
then gcc warns me that I'm discarding a const qualifier, but ao_example.lua plays me a nice sine wave :-)
It's hard to believe that this has ever worked; so if the user base is small, it might be OK to change the API from require("ao") to local ao = require("ao"), see previous issue...
Regards, Peter
l___gc
(which is used to ao_shutdown
) is never called.
Hi. I get:
/usr/local/lib/lua/5.2/ao.so: undefined symbol: luaL_register
which reminds me of a change I had to make in my midialsa.lua
luaL_setfuncs(L, prv, 0); /* 5.2 */
return 0;
luaL_register(L, NULL, prv); /* 5.1 */
return 0;
YMMV ...
Regards, Peter
To allow setting quiet=yes in time to stop the debug messages emitted by ao_initialize(),
I suggest we add a append_global_option(k,v) function, and delay calling ao_initialize() until the next function is called.
If that function is append_global_option then we call that first and ao_initialize second (assuming it works that way round), whereas if it's some other function like open() then we call ao_initialize first and the function second.
There was previously ineffective code (removed in a5a9b7b) trying to automatically call ao_shutdown
if lao was unloaded.
This could be done by e.g. making this userdata an upvalue for all functions
/* Create object with __gc metamethod so that ao gets shut down on exit */
lua_newuserdata(L, 0);
lua_createtable(L, 0, 1);
lua_pushcfunction(L, l_shutdown);
lua_setfield(L, -2, "__gc");
lua_setmetatable(L, -2);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.