Dynamics

Add some dynamics to your compositions with subclasses of radiotool.composer.Dynamic.

class radiotool.composer.Dynamic(track, comp_location, duration)

(Abstract) volume control for tracks

class radiotool.composer.Volume(track, comp_location, duration, volume)

Adjust the volume of a track in a composition

__init__(track, comp_location, duration, volume)

Create a dynamic to adjust the volume of a track in a composition.

Any segments in the composition that include the track between comp_location and comp_location + duration will be adjust to the given volume. Here, volume is a constant multiplier (0.0 for zero volume, 1.0 for normal volume). You can use a range of volumes, but obviously if volume is much greater than 1.0, there will likely be clipping in the final composition.

Parameters:
  • track (radiotool.composer.Track) – Track whose volume to adjust
  • comp_location (float) – Location to begin volume adjustment in composition (in seconds)
  • duration (float) – Duration of volume adjustment (in seconds)
  • volume (float) – Volume throughout the duration of the adjustment (1.0: normal, to 0.0: muted)
to_array(channels=2)

Generate the array of multipliers for the dynamic

class radiotool.composer.Fade(track, comp_location, duration, in_volume, out_volume, fade_type='linear')

Create a fade dynamic in a composition

__init__(track, comp_location, duration, in_volume, out_volume, fade_type='linear')

A fade is a radiotool.composer.Dynamic that represents a fade in a track (either in or out).

Currently supported fade types are linear and exponential.

The exponential fades are probably a bit quirky, but they work for me for some use cases.

Parameters:
  • track (radiotool.composer.Track) – Track to fade
  • comp_location (float) – Location in composition to start fade (in seconds)
  • duration (float) – Duration of fade (in seconds)
  • in_volume (float) – Initial volume multiplier
  • out_volume (float) – Ending volume multiplier
  • fade_type (string) – Type of fade (linear or exponential)
to_array(channels=2)

Generate the array of volume multipliers for the dynamic

class radiotool.composer.RawVolume(segment, volume_frames)

Dynamic with manually-specified volume multiplier array

__init__(segment, volume_frames)

Create a dynamic that manually specifies the volume multiplier array.

Parameters:
  • segment (radiotool.composer.Segment) – Segment for which to create dynamic
  • volume_frames (numpy array) – Raw volume multiplier frames
to_array(channels=2)

Return the array of multipliers for the dynamic

Previous topic

Segments

Next topic

Music retargeting

This Page

Fork me on GitHub