@@ -334,31 +334,6 @@ def __getitem__(self, millisecond):
334
334
335
335
return self ._spawn (data )
336
336
337
- def get_sample_slice (self , start_sample = None , end_sample = None ):
338
- """
339
- Get a section of the audio segment by sample index.
340
-
341
- NOTE: Negative indices do *not* address samples backword
342
- from the end of the audio segment like a python list.
343
- This is intentional.
344
- """
345
- max_val = int (self .frame_count ())
346
-
347
- def bounded (val , default ):
348
- if val is None :
349
- return default
350
- if val < 0 :
351
- return 0
352
- if val > max_val :
353
- return max_val
354
- return val
355
-
356
- start_i = bounded (start_sample , 0 ) * self .frame_width
357
- end_i = bounded (end_sample , max_val ) * self .frame_width
358
-
359
- data = self ._data [start_i :end_i ]
360
- return self ._spawn (data )
361
-
362
337
def __add__ (self , arg ):
363
338
if isinstance (arg , AudioSegment ):
364
339
return self .append (arg , crossfade = 0 )
@@ -1112,23 +1087,6 @@ def max_dBFS(self):
1112
1087
def duration_seconds (self ):
1113
1088
return self .frame_rate and self .frame_count () / self .frame_rate or 0.0
1114
1089
1115
- def get_dc_offset (self , channel = 1 ):
1116
- """
1117
- Returns a value between -1.0 and 1.0 representing the DC offset of a
1118
- channel (1 for left, 2 for right).
1119
- """
1120
- if not 1 <= channel <= 2 :
1121
- raise ValueError ("channel value must be 1 (left) or 2 (right)" )
1122
-
1123
- if self .channels == 1 :
1124
- data = self ._data
1125
- elif channel == 1 :
1126
- data = audioop .tomono (self ._data , self .sample_width , 1 , 0 )
1127
- else :
1128
- data = audioop .tomono (self ._data , self .sample_width , 0 , 1 )
1129
-
1130
- return float (audioop .avg (data , self .sample_width )) / self .max_possible_amplitude
1131
-
1132
1090
def remove_dc_offset (self , channel = None , offset = None ):
1133
1091
"""
1134
1092
Removes DC offset of given channel. Calculates offset if it's not given.
0 commit comments