Pd is an open source visual programming language for multimedia. It is a major branch of the family of patcher programming languages known as Max (Max/FTS, ISPW Max, Max/MSP, etc), originally developed by Miller Puckette.
More info about Pure Data can be found here: https://puredata.info/
LuaPd is a Lua C API Library that allows users to incorporate Pd patches into their projects.
A simple example might look something like this:
Code: Select all
if love.system.getOS() == 'OS X' then package.cpath = './?.dylib;'..package.cpath end require('luapd') function love.load() inChannels ,outChannels ,sampleRate ,queued ,bitdepth ,ticks ,buffers = 1 ,2 ,44100 ,false ,16 ,1 ,33 pd = PdBase() pd:init(inChannels, outChannels, sampleRate, queued) pd:computeAudio(true) patch = pd:openPatch('pd/test.pd') local size = PdBase.blockSize() * ticks sdata = love.sound.newSoundData(size, sampleRate, bitdepth, outChannels) source = love.audio.newQueueableSource(sampleRate, bitdepth, outChannels, buffers) end function love.update() while source:getFreeBufferCount() > 0 do pd:processShort(ticks, sdata:getPointer()) source:queue(sdata) source:play() end end
major-minor: Change the scale of a piece of music to minor, dorian, phrygian, etc.
freqmod: A frequency modulator.
mouse horizontal movement changes the modulation frequency
mouse vertical movement changes the modulation index
mouse wheel changes the carrier frequency
If you find that the audio is stuttering a lot, you can open love/pdmain.lua and increase the number of ticks or buffers. Or you can decrease these amounts if you find that there's too much of a delay. Disabling vsync allows you to further decrease the delay, though it may have the side effect of screen tearing.
All feedback is welcome and appreciated. Let me know if you run into any issues or find any bugs and I'll try to address them as quickly as possible