Beispiel #1
0
    def get_scale(self,reference="tonic"):
        """Get the scale of the melody.

        Args:
            reference (float): the reference frequencies to calculate the scale. It could be the _tonic_ (self.tonique) or the _domin_ (self.dominante)
        Return:
            self.intervals (list) : the intervals in the the choosen linear Unit.
            self.scale (): The scale compared to reference intervals.
        """
        if reference == 'tonic':
            self.intervals = diastema.dias(self.ordredpeaks['xpeaks']/self.tonique)
        if reference == 'domin':
            self.intervals = diastema.dias(self.ordredpeaks['xpeaks']/self.dominante)

        scale = []
        x = 0
        for interval in self.intervals:
            var = (self.ordredpeaks['xpeaks'].iloc[x].astype('str'), diastema.get_inter_ref(interval))
            scale.append(var)
            x = x + 1
        self.scale = scale
Beispiel #2
0
 def test_get_inter_ref(self):
     di.set_unit('savart')
     inter = 300
     self.assertEqual(di.get_inter_ref(inter)[1],"2/1")
Beispiel #3
0
 def test_get_inter_ref(self):
     di.set_unit('savart')
     inter = 300
     self.assertEqual(di.get_inter_ref(inter)[1], "2/1")