Automatically turn iPhone sound off after a certain duration

There is the Screen Time feature in iOS. Settings -> Screen Time. You could configure a Downtime period and that should shut things off when it engages.

iPhone, iPad or iPod Touch Screen Time https://support.apple.com/en-us/HT208982

Apple Support Youtube iPhone Screen Time Downtime video: https://youtu.be/rMfUgqDkZRM

Apple Support Guide - Schedule downtime in Screen Time on Mac https://support.apple.com/guide/mac-help/schedule-downtime-in-screen-time-mchl69510069/mac


Set a timer in the Clock app, and set “When Timer Ends” to “Stop Playing”.

Unfortunately I don’t see this available as an alarm.