Reputation: 11
I need a little bit help and hope to find that here.
I am using sox for tagging some music with voice tags on my server while user is uploading the file. This is my command which I was using. Everything is working fine.
sox -m {voice_tag_loop} {source_file} {output_file}
Now I want to change something, but don't know how to do that and find no solution.
So the {voice_tag_loop}
will be uploaded by user and can have all length e.g. 30 seconds, 20s, 17s or 1 Minute. Don't know that before.
The {source_file}
is the music file and can have also different length e.g. 3:13 Min, 4:20Min
How can I mix the {voice_tag_loop}
with the {source_file}
that the {output_file}
has the length of {source_file}
but has the {voice_tag_loop}
is mixed and looped/ repeated into also with as long the length of the {source_file}
I hope I could explain that, that you can understand that.
Best regards
Upvotes: 0
Views: 589
Reputation: 11
this did it for me
sox {short_file} -p repeat 100 trim 0 $(sox --i -d {long_file}) | sox - -m {long_file} {new_file}
Upvotes: 1
Reputation: 11
OK I have now the answer for all you wants to mix short audio with long audio and the short one should repeated as long the long audio is.
In my case a small description. The short file will be changed to 44.1kHz and will be looped every 30 seconds. Max 100 times but as long as the long file is. And finally both files will be mixed. This all is one procedure.
sox {short_file} -r 44.1k -p pad 0 30 repeat 100 trim 0 $(sox --i -d {long_file}) | sox - -m {long_file} {output_file}
Regards
Upvotes: 1
Reputation: 47239
Just repeat until the source file is exhausted, e.g.:
sox -m "| sox {voice_tag_loop} -p repeat -" {source_file} trim 0 $(soxi -d {source_file})
NB, don't forget the trim
bit, otherwise the repeat part will generate an infinite file.
Upvotes: 1