Hi,
Justin shows us lua script to get pitch at certain time for a take, in Lua.
Code:
-- http://forum.cockos.com/showpost.php?p=1777001&postcount=2
-- REAPER v32
item = reaper.GetSelectedMediaItem(0,0);
take = reaper.GetMediaItemTake(item,0);
nch = reaper.GetMediaSourceNumChannels(reaper.GetMediaItemTake_Source(take));
ns = 1;
buf = reaper.new_array(ns*3*nch);
rv = reaper.GetMediaItemTake_Peaks(take,1000.0, reaper.GetCursorPosition(),nch,ns,115,buf);
if rv & (1<<24) and (rv&0xfffff) > 0 then
spl = buf[nch*ns*2 + 1];
pitch = spl&0x7fff;
tonality = (spl>>15)/16384.0
end
What would be the EEL conversion for this ?
Here how far I went :
Code:
item = GetSelectedMediaItem(0,0);
take = GetMediaItemTake(item,0);
nch = GetMediaSourceNumChannels(GetMediaItemTake_Source(take));
ns = 1;
buf = 0;
rv = GetMediaItemTake_Peaks(take,1000.0, GetCursorPosition(),nch,ns,115,buf);
rv & (1<<24) && (rv&0xfffff) > 0 ? (
spl = buf[nch*ns*2 + 1];
pitch = spl&0x7fff;
tonality = (spl>>15)/16384.0;
);
rv as the same value in both EEL and Lua in my test (aka, conversion works), but spl, pitch and tonality are still 0 (aka, something is wrong in EEL with this lines).
Any ideas ?
Thanks !
EDIT: to use the code snippet, put your edit cursor inside a selected audio take boundary.