Old 08-09-2014, 02:24 PM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default "Named string size limit" giving errors in EEL

This time I'm trying to make a "take volume automation tool" (noise gating, compressing etc.).

Too big "envelope state chunks" are giving errors:


(yes, lots of redundant envelope points are added )




Actually in this case, #new_chunk_points variable size grows too big. This is how I build the "env point lines":

Code:
#new_chunk_points += "PT ";
#new_chunk_points += sprintf(#, "%f ", sample_count / sample_rate);
#new_chunk_points += sprintf(#, "%f ", 1+abs(peak_val));
#new_chunk_points += "0 0 1"
#new_chunk_points += "\n";
Don't know what to do, are there any workarounds? How to enlarge your named string size?

Last edited by spk77; 08-10-2014 at 12:31 AM.
spk77 is offline   Reply With Quote
Old 08-10-2014, 10:06 AM   #2
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

2424 envelope points is the max amount:


Here's a script for testing purposes - it adds random points to a take volume envelope:

Code:
// Add random points to take volume envelope

#new_chunk_header = "<TRACK_ENVELOPE_UNKNOWN
ACT 1
VIS 1 1 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 0 -1 -1
";

#new_chunk_points = "";

#new_chunk_tail = ">
";

function msg_s(m)
(
  ShowConsoleMsg(m);
  //ShowConsoleMsg("\n");
);

function msg_d(m)
(
  sprintf(str, "%d", m);
  ShowConsoleMsg(str);
  ShowConsoleMsg("\n");
);

function get_set_envelope(take, envelope_name) local(env)
(
  // if take's "take volume envelope" doesn't exist:
  (env = GetTakeEnvelopeByName(take, envelope_name) == 0) ? (
    envelope_name == "Volume" ? Main_OnCommand(NamedCommandLookup("_S&M_TAKEENV1"), 0); // show take volume envelope
    envelope_name == "Pan" ? Main_OnCommand(NamedCommandLookup("_S&M_TAKEENV2"), 0); // show take pan envelope
    envelope_name == "Mute" ? Main_OnCommand(NamedCommandLookup("_S&M_TAKEENV3"), 0); // show take mute envelope
    envelope_name == "Pitch" ? Main_OnCommand(NamedCommandLookup("_S&M_TAKEENV10"), 0); // show take pitch envelope
  );
  // now it should exist -> get take's "take envelope pointer":
  (env = GetTakeEnvelopeByName(take, envelope_name)) ? (
    GetSetEnvelopeState(env, #new_chunk);
  );
  //msg_s(#new_chunk);
);

function generate_point_lines(take) local(i)
(
  i = 0;
  loop(2424,  // 2424 envelope points - this seems to be the max amount
    #new_chunk_points += "PT ";
    #new_chunk_points += sprintf(#, "%f ", i * 50 * 1/44100); // insert point at every 50th sample (if samplerate is 44100)
    #new_chunk_points += sprintf(#, "%f ", 1 + rand(2) / 10);
    #new_chunk_points += "0 0 1";
    #new_chunk_points += "\n";
    i += 1;
  );
   //msg_s(#new_chunk_points);
);

function join_lines()
(
  #new_chunk += #new_chunk_header;
  #new_chunk += #new_chunk_points;
  #new_chunk += #new_chunk_tail;
  //msg_s(#new_chunk);
);

function main()
(
  (take = GetActiveTake(GetSelectedMediaItem(0, 0))) ? (
    generate_point_lines();
    join_lines();
    get_set_envelope(take, "Volume");
    
    msg_s("#new_chunk length: ");
    msg_d(strlen(#new_chunk));
  ) : msg_s("Select one item");
);

main();
spk77 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.