Beispiel #1
0
def test_bounded_by_end():
    # Bounds by end and only end, when end > start
    assert (utilities.bounded_by_end([1, 2, 3, 4, 5], 3, 4) == [1, 2, 3, 4,
                                                                4]).all()
    # Bounds by end and only end, when end < start
    assert (utilities.bounded_by_end([1, 2, 3, 4, 5], 3, 2) == [2, 2, 3, 4,
                                                                5]).all()
Beispiel #2
0
 def new_amplitude_array(self, time_array):
     '''Calcululate the amplitude values for the next chunk of data.'''
     dir = utilities.direction(self.amplitude, self.goal_amplitude)
     new_amplitude = self.amplitude * utilities.decibels_to_amplitude_ratio(
         dir * self.decibels_per_second * time_array)
     return utilities.bounded_by_end(new_amplitude, self.amplitude,
                                     self.goal_amplitude)
Beispiel #3
0
 def new_frequency_array(self, time_array):
     '''Calcululate the frequency values for the next chunk of data.'''
     dir = utilities.direction(self.frequency, self.goal_frequency)
     new_frequency = self.frequency * utilities.interval_to_frequency_ratio(
         dir * self.pitch_per_second * time_array)
     return utilities.bounded_by_end(new_frequency, self.frequency,
                                     self.goal_frequency)