Thanks to visit codestin.com
Credit goes to github.com

Skip to content
ghoulsblade edited this page Sep 24, 2012 · 5 revisions

https://github.com/ghoulsblade/love-pd-audio Is a Lua-Module wrapping LibPD and OpenAL for audio-output.
It allows using PureData files for interactive audio in the Löve2D Game engine or in other lua scripted applications,
as long as they do not block Lua-Module loading.

Lua is a light-weight and extensible scripting language that is popular in gamedev. (wow,crysis,civ5,warhammer40k,fable2,...)
Löve2D is a 2D game engine using lua that is sometimes used on GameJams.
GameJam = get together with a bunch of people and trying to make a small game from scratch within 48 hours or so.

Lua "modules" are an extension mechanism offered by lua to load additional functionality at runtime.
In a nutshell it allows lua code to load a .dll (win) / .so (linux) / .dylib (mac) that contains a special interface function making stuff available in lua.

This extension mechanism is a part of the lua scripting language and not specific to the Löve2D engine.
Since Löve2D specific stuff wasn't needed when making "love-pd-audio", Löve2D isn't required to use it.
"love-pd-audio" can be used unmodified by the lua commandline interpreter, or in all programs using lua that do not explicitly block the module-loading feature.
In retrospect it should have been named it lua-pd-audio, but it wasn't apparent from the start that it would become generic.

For using it in lua, download the dll/so/dylib from https://github.com/ghoulsblade/love-pd-audio,
add them and some mypatch.pd to the folder with the lua scripts,
and then do this in their lua script files:
require("lovepdaudio") -- this loads the dll/so/dylib
player = lovepdaudio.CreatePureDataPlayer("mypatch.pd")

at each mainloop step call
lovepdaudio.PureDataPlayer_Update(player)

and to make it interactive, when something interesting happens call
libpd_float("myreceiverobj", 3.1415)
or similar.

to try it out, install lua, make a checkout from github,
change to the bin/ dir, and run
lua test.lua

At the time of writing (2012-09-22) there are no mac binaries yet,
so if you're on mac you'd have to get it to compile first, which will involve fixing the makefile.
Mac binaries are expected to become available in the next few weeks.

Clone this wiki locally