recording to a buffer that resizes to the recording

I can’t figure out how to resize a buffer after recording onto it. I want to be able load different live recordings onto a buffer that resizes to the length of the recording. I’ve created a patch that shows the workflow I’m trying to get: