Siri-Like Recording Feature

Is there a way to record audio based on volume level of recording?

I’m building an app that allows users to record their voice and app will stop recording once user stops talking or after 7 seconds has surpassed.

Rather not use a stop recording button.

Thanks,
Steve