@@ -75,18 +75,36 @@ def __init__(
75
75
sample_rate if sample_rate is not None else self .metadata .sample_rate
76
76
)
77
77
78
+ def get_all_samples (self ) -> AudioSamples :
79
+ """Returns all the audio samples from the source.
80
+
81
+ To decode samples in a specific range, use
82
+ :meth:`~torchcodec.decoders.AudioDecoder.get_samples_played_in_range`.
83
+
84
+ Returns:
85
+ AudioSamples: The samples within the file.
86
+ """
87
+ return self .get_samples_played_in_range ()
88
+
78
89
def get_samples_played_in_range (
79
90
self , start_seconds : float = 0.0 , stop_seconds : Optional [float ] = None
80
91
) -> AudioSamples :
81
92
"""Returns audio samples in the given range.
82
93
83
94
Samples are in the half open range [start_seconds, stop_seconds).
84
95
96
+ To decode all the samples from beginning to end, you can call this
97
+ method while leaving ``start_seconds`` and ``stop_seconds`` to their
98
+ default values, or use
99
+ :meth:`~torchcodec.decoders.AudioDecoder.get_all_samples` as a more
100
+ convenient alias.
101
+
85
102
Args:
86
103
start_seconds (float): Time, in seconds, of the start of the
87
104
range. Default: 0.
88
- stop_seconds (float): Time, in seconds, of the end of the
89
- range. As a half open range, the end is excluded.
105
+ stop_seconds (float or None): Time, in seconds, of the end of the
106
+ range. As a half open range, the end is excluded. Default: None,
107
+ which decodes samples until the end.
90
108
91
109
Returns:
92
110
AudioSamples: The samples within the specified range.
0 commit comments