Precision in CSV output

When you say opaque what do you mean? Maybe I can dig further here

From what I can make out, you get the pointer back from the function, but because a Lua type hasnā€™t been declared for it, it is what Lua calls a ā€˜userdataā€™ value: just a block of undiffereniated memory.

So, whilst I can do this

local wavpath = "AudioFiles/Nicol-LoopE-M.wav"
local pcm = reaper.PCM_Source_CreateFromFile(wavpath)

If then attempt to call anything on pcm, it says:

attempt to index a userdata value (local 'pcm')

Some light googling suggested that making pcm_source available in Lua would require someone making a C++ binding for it.

Okay yep. Pretty much everything at the lowest level of the API is a userdata value. The same goes for media items and takes. I wonder if its accessible via eel though - there are a few undocumented things you can do in EEL vs Lua but its voodoo to me.

To throw another spanner in the works and while this is being discussed - why not JSON output? It could be more expressive in many ways like

{
"indices" : [0, 1, 2, 3, 4],
"threshold" : 0.5,
...
}

Then the results could also contain metadata about the process that was run. It also makes it a bit easier to open up the info in environments that can serialise JSON to their native types

Maybe one day. CSV is simpler both to generate and to parse (e.g. it can be loaded into python or a spreadsheet really very easily, and itā€™s not hard to roll a CSV parser oneself).

For the moment metadata isnā€™t an issue because we donā€™t have a way of serializing the state of an objectā€™s parameters internally. However, the upcoming objects for datasets and so forth do use JSON to serialize their internal state, and Iā€™m enthusiastic about extending this so that environments with associative arrays (Max, SC) can take advantage of this for objects with complex state.

1 Like

@weefuzzy has been an ardent supporter of JSON indeed, to the point I almost started to like it :slight_smile:

I think JSON sucks despite being pretty readable and easy to work with (no comments, enforced key types, brittle). I kinda wish there was something that looked like YAML but was made for storing data.