Segments
A Segment is a slice of a radiotool.composer.Track.
-
class radiotool.composer.Segment(track, comp_location, start, duration)
A slice of a radiotool.composer.Track
-
__init__(track, comp_location, start, duration)
Create a segment from a track.
The segment represents part of a track (from start, for
duration seconds) and will be played at location
comp_location when added to a composition.
Parameters: |
- track (radiotool.composer.Track) – Track to create segment from
- comp_location (float) – Location in composition to play this segment (in seconds)
- start (float) – Start of segment (in seconds)
- duration (float) – Duration of segment (in seconds)
|
-
get_frames(channels=2)
Get numpy array of frames corresponding to the segment.
Parameters: | channels (integer) – Number of channels in output array |
Returns: | Array of frames in the segment |
Return type: | numpy array |
-
class radiotool.composer.TimeStretchSegment(track, comp_location, start, orig_duration, new_duration)
Like a radiotool.composer.Segment, but stretches
time to fit a specified duration.
-
__init__(track, comp_location, start, orig_duration, new_duration)
Create a time-stetched segment.
It acts like a radiotool.composer.Segment but you
can specify the target duration. The segment will then
resample its frames to meet this duration.
Parameters: |
- track (radiotool.composer.Track) – Track to slice
- comp_location (float) – Location in composition to play this segment (in seconds)
- start (float) – Start of segment (in seconds)
- orig_duration (float) – Original duration of segment (in seconds)
- new_duration (float) – Target (stretched) duration of segment (in seconds)
|