Loop audio file to a given length
Solution 1:
ffmpeg can do that for you, but you might need two steps
Optional Step 1: Find length of original file
ffmpeg -i '/path/to/original.mp3' 2>&1 | grep 'Duration :'
Now you can calculate the number of repetitions necessary. As an alternative, you can just use a "safe" number of repetitions, as too many won't hurt.
Step 2: Loop the file and cut it to needed length
create "concat.txt" with this content
file '/path/to/original.mp3'
file '/path/to/original.mp3'
...
file '/path/to/original.mp3'
file '/path/to/original.mp3'
file '/path/to/original.mp3'
It must have at least as many lines as repetitions are necessary, but, again, more won't hurt, so you can use a safe (too high) line count
And run ffmpeg (assuming you want 123.456 seconds):
ffmpeg -t 123.456 -f concat -i concat.txt -c copy -t 123.456 output.mp3
Solution 2:
This can be achieved by using (appending) the below command:
-stream_loop -1 -i D:\music\mp4.mp3
This means that the D:\music\mp4.mp3 file should be looped infinitely, until the video ends.
https://ffmpeg.org/ffmpeg.html