Example #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
Example #2
0
    def test_dias_following_unit(self):
	global unit
	di.set_unit("savart")
	self.assertEqual(di.dias(3/2.),di.savart(3/2.))
	di.set_unit("cent")
	self.assertEqual(di.dias(3/2.),di.cent(3/2.))
Example #3
0
 def test_dias_following_unit(self):
     global unit
     di.set_unit("savart")
     self.assertEqual(di.dias(3 / 2.), di.savart(3 / 2.))
     di.set_unit("cent")
     self.assertEqual(di.dias(3 / 2.), di.cent(3 / 2.))