Background Sounds timer shortcut
Not really a question, but the forum post I wanted to reply to was too old. I couldn't find this solution on the forum but I managed to figure it out myself so I thought I might as well share it in case anyone else is interested.
To stop the iOS background sounds from playing after a certain amount of time simply create a shortcut! This only works if you want it to stop after the same amount of time every time you use it. If, like me, you use it when going to bed, it's perfectly fine.
In the shortcuts app, click the + and select the first action to be "set background sounds" (found by just searching for it in the search box) and choose "turn background sounds on".
Now select the next action to be "wait" and select however long you want the timer to be. Sadly you can only choose the time in seconds and it can only be changed by holding down on the +, so there is some patience involved if you want to set it to, say, an hour like I have.
Set the next action to be "set background sounds" again but this time select it to "turn background sounds off".
Now all you have to do is run the shortcut and it will start playing background sounds and, after the chosen amount of time, stop playing it.
iPhone 8