Music retargeting is the idea of taking a song and remixing it from its own existing beats/structure to fit the music to certain constraints.
Example applications:
Create a composition of a song that changes its length to a given duration.
Parameters: |
|
---|---|
Returns: | Composition of retargeted song |
Return type: |
Create a composition of a song of a given duration that reaches music change points at specified times. This is still under construction. It might not work as well with more than 2 cp_times at the moment.
Here’s an example of retargeting music to be 40 seconds long and hit a change point at the 10 and 30 second marks:
song = Song("instrumental_music.wav")
composition, change_points = retarget.retarget_with_change_points(song, [10, 30], 40)
composition.export(filename="retargeted_instrumental_music.")
Parameters: |
|
---|---|
Returns: | Composition of retargeted song and list of locations of change points in the retargeted composition |
Return type: | (radiotool.composer.Composition, list) |
Retarget a song to a duration given input and output labels on the music.
Suppose you like one section of a song, say, the guitar solo, and you want to create a three minute long version of the solo. Suppose the guitar solo occurs from the 150 second mark to the 200 second mark in the original song.
You can set the label the guitar solo with ‘solo’ and the rest of the song with ‘other’ by crafting the music_labels input function. And you can set the out_labels function to give you nothing but solo:
def labels(t):
if 150 < t < 200:
return 'solo'
return 'other'
def target(t): return 'solo'
song = Song("sweet-rock-song.wav")
composition, info = retarget(song, 180,
music_labels=labels, out_labels=target)
composition.export(filename="super-long-solo")
You can achieve much more complicated retargetings by adjusting the music_labels, out_labels and out_penalty functions, but this should give you a basic sense of how to use the retarget function.
Parameters: |
|
---|---|
Returns: | Composition of retargeted song, and dictionary of information about the retargeting |
Return type: | (radiotool.composer.Composition, dict) |