System Message: WARNING/2 (/Users/anas/python/music22/docs/source/diastema.rst, line 2)

Field list ends without a blank line; unexpected unindent.

Diastema API

System Message: WARNING/2 (/Users/anas/python/music22/docs/source/diastema.rst, line 5)

Title underline too short.

Diastema API
~~~~~~~~~~~

Diastema : Core operations on intervals.

This module defines functions for basic operations on intervals, i. e. conversions from logarithmic into linear spaces, a list of reference epimoric intervals and a function for setting the unit be used.

You can also get the closest epimoric reference interval to an interval in the current unit, and the difference. If we are using the savart units :

>>> get_inter_ref(300)
('300.00', '2/1', '-', '1.03')
>>> get_inter_ref(303)
('303.00', '2/1', '+', '1.97')
music22.diastema.cent(y)[source]

Convert the given interval (as ratio) to cent.

>>> cent(3/2.)
701.95500086538743
music22.diastema.convert_ref()[source]

Convert all the reference intervals (given by get_intervals()) from ratios to a linear space.

music22.diastema.dias(y)[source]

Convert the given interval (as ratio) to the global chosen unit. Default is savart.

>>> dias(3/2.)
176.09125905568123
music22.diastema.get_inter_ref(x)[source]

Look for the closest epimoric interval.

Paramètres:x (int) – an interval in savart/cent.
Retourne:y – the closest interval from the reference intervals.
Type retourné:tuple

Example

>>> get_inter_ref(300)
('300.00', '2/1', '-', '1.03')
>>> get_inter_ref(303)
('303.00', '2/1', '+', '1.97')
music22.diastema.get_intervals()[source]

Prints de list of all available reference intervals.

music22.diastema.get_scale(echelle)[source]

Compare given intervals to reference intervals.

Paramètres:echelle (list) – a list containing intervals in a linear scale.
Retourne:Prints a list of tuples
Example :
>>> a = [125,256,300]
('125.00', '4/3', '+', '0.06')
('256.00', '3/2*6/5', '+', '0.73')
('300.00', '2/1', '-', '1.03')
music22.diastema.get_unit()[source]

Get the currently used unit.

music22.diastema.savart(y)[source]

Convert the given interval (as ratio) to savart.

>>> savart(3/2.)
176.09125905568123
music22.diastema.set_unit(x)[source]

Set the unit to be used : possible units are savart and cent.

>>> set_unit("savart")
Unit is now set to : savart