{
   "name" : "Enveloppe resizing function.",
   "author" : "Dindoléon",
   "description" : "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thus freeing the UGens way faster.\r\nCan be useful for granular synthesis APIs, where rapid grain emission can quickly overload the server.\r\nThis function's purpose is to be used with a graphical display, where user cannot control the enveloppe length.",
   "ancestor_list" : [],
   "labels" : [
      "function",
      "enveloppe"
   ],
   "id" : "1-5cz",
   "is_private" : null,
   "code" : "(\r\n~resize_enveloppe = { | levels, times |\r\n\tvar reverted_levels, index;\r\n\tindex = 0;\r\n\treverted_levels = levels.reverse;\r\n\twhile( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\r\n};\r\n)"
}
