Is there any way to dynamically adjust the size of a curve with a modifier?

posted to: Modeling a Chain

https://imgur.com/a/XbsC6Nc

Hi, im trying to automatically adjust the lenght of a curve while its following an empty (wich follows the bended curve). The idea is that when i move the empty on top along the bended curve, the curve below automatically resizes; resulting is less and more cubes being copied along that curve. So it creates this sound (visualisation)-thing. Just being curious of what blender can('t) do :).

Have you got any idea how to do this?