Exemplo n.º 1
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)
Exemplo n.º 2
0
    def __init__(self,
                 pitch,
                 pitch_per_second=12,
                 decibels=1,
                 decibels_per_second=1,
                 samplerate=utilities.DEFAULT_SAMPLE_RATE):
        self.frequency = utilities.pitch_to_frequency(pitch)
        self.phase = 0
        self.amplitude = utilities.decibels_to_amplitude_ratio(decibels)

        self.pitch_per_second = pitch_per_second
        self.decibels_per_second = decibels_per_second
        self.goal_frequency = self.frequency
        self.goal_amplitude = self.amplitude
        self.samplerate = samplerate
Exemplo n.º 3
0
 def set_decibels(self, decibels):
     '''Set the amplitude (in decibels) that the sinewave will gradually shift towards.'''
     self.goal_amplitude = utilities.decibels_to_amplitude_ratio(decibels)