CDP Lua Interface

Started by loganmcbroom, June 14, 2016, 09:06:31 AM

Previous topic - Next topic

loganmcbroom

Here is some software I made for working with the cdp. Before it will run you'll need to set your _cdpprogs dirctory and working directory ( absolute file paths ) in Settings.lua. Drag audio in and drag clips around to reorder. Hit the pi button to send the files in the order they're listed to the lua script. Use cdp() to do stuff. '$' will generate a file name for output. Everything returned will be listed on the right. You can drag files back over to the left to process them anew.

I still have a few features to add but it's usable as is. Here's the source and if you're windows bound here's an archive with everything it needs to run. Includes some of my favorite recordings.
https://github.com/loganmcbroom/Altar
https://drive.google.com/file/d/0BxzJlrC6KHmxZnRwMEk2U19GLTA/view?usp=sharing

Hope you enjoy, feel free to shoot me feature ideas.

Edit: Switched archive for updated version without dll dependencies. Should fix missing vcruntime dll errors. Added a lot of functions to the lua interface but I'm going to wait on writing them all down until the interface is done.

Edit: Added more to LTMP system, made a readme. Tried to make it much harder to crash. This is now valid code:
return distort_average( {5,10,15,20}, housekeep_chans( 2, unpack( f ) ) )
It will split the channels of all inputs, and cyclically apply 5,10,15,20 as the parameter to average.
You can also write
getmetatable('').__index = function( str, i ) return housekeep_chans( 1, i, str ) end
This allows f[1][2] to access the second channel of the first file.

loganmcbroom

I'm not normally in the business of self bumping but I've finished a new version of this. There is now a mapping of almost every cdp process on the lua side. Mostly untested but enough works to do some cool things. You can write code like this:

return
   modify_loudness( 3,
   pvoc_synth(
   blur_blur( 100,
   pvoc_anal(
   housekeep_chans( 2,
   housekeep_respec( 1, 48000,
   unpack( f )))))))

Which takes every input given, resamples to 48000, splits all multichannel files into multiple mono files, blurs, and returns all results normalized. You can process in loops! Anything transforming a set number of inputs to a set number of outputs can take any number of files divisible by the input group size, e.g. something taking two inputs and making one output can take ten inputs and gives five outputs. Order of arguments is mode (if applicable), parameters, flags (in quotes e.g. "-r100"), infiles.

Google drive link in the op is updated version.

loganmcbroom

#2
I'm also going to keep track of what is fully tested here. Sorry for the mess I'm pasting it in with tab characters.

distort             //Untested
envel                //Untested                              
extend             //Untested
filter                 //Untested
grain              //Untested
housekeep   //Untested
modify      //Untested
multichannel   //Incomplete, inverted flags
psow      //Untested
reverb      ///Incomplete, inverted flags
sndinfo      //Untested
sfedit      //Untested
submix      //Untested
synth      //Untested
sysutils      ///Incomplete, inverted flags
texture      //Untested

blur         //Untested
combine      //Untested
focus      //Untested
formants      //Untested
hilite              //Untested
morph      //Untested
oneform      //Untested
pitch              ///Incomplete, bad flags
PVOC      //Extract untested
repitch      //Extra untested, type outputs might not work on anything
spec         ///Incomplete, bad flags
strange      ///Incomplete, bad flags
stretch      //Untested

loganmcbroom

Here is a script I enjoyed. You'll need to set the notedata file location. It starts off by recording for 2 seconds, if you'd rather use prerecorded audio switch sysutils_recsf( 2 ) with f[ i ]. You can make numOuts larger to run it multiple times in parallel (it will record linearly for 2*numOuts seconds at the start).

notedata = "PATH HERE/notedata.txt"
numOuts = 1

getmetatable('').__index = function( str, i ) return housekeep_chans( 1, i, str ) end
getmetatable('').__call = function( str, l ) return modify_loudness( 4, "-l" .. ( l or 1 ), str ) end

function makestereo( ... )
local arg = {...}
local stereos = {}
for i = 1, #arg/2 do stereos[i] = multichannel_interlx( arg[2*i-1], arg[2*i] ) end
return unpack( stereos )
end

recordings = {}
outputs = {}
for i = 1,numOuts do recordings[i] = sysutils_recsf( 2 ) end
for i=1,numOuts do
outputs[i] = texture_postornate( 1, notedata, 30, .5, --notedata outdur skiptime
1,1,  36,64,  3,3,  --sndfirst sndlast mingain maxgain mindur maxdur
0, 2, 1, 0, 3, --phgrid grpspace gpsprange amprise contour
0.15,0.4, --multlo, multhi
housekeep_chans( 4, recordings[i] )(.5) )(.8)
end

return modify_loudness( 4, "-l0.8",
makestereo(
pvoc_synth(
blur_selfism( 4,
blur_drunk( 4, 2, 12, "-z",
pvoc_anal( 1,
housekeep_chans( 2,
unpack( outputs ) )))))))

Using this notedata:

60
#8
0.0 1 60 0 0
0.5 1 67 0 0
1.0 1 72 0 0
1.5 1 67 0 0
2.0 1 62 0 0
2.5 1 69 0 0
3.0 1 74 0 0
3.5 1 69 0 0
#5
0.0 1 60 0 0
0.0 1 62 0 0
0.0 1 64 0 0
0.0 1 67 0 0
0.0 1 69 0 0
#8
0 1 60 30 20
1 1 62 30 20
2 1 64 30 20
3 1 67 30 20
4 1 69 30 20
5 1 72 30 20
6 1 69 30 20
7 1 67 30 20