mutwo.generators.toussaint¶
Algorithms which are related to Canadian computer scientist G. T. Toussaint.
Functions:
|
Generates rhythm using the alternating hands method described by G. |
|
Return euclidean rhythm as described in a 2005 paper by G. |
|
Generates rhythm using the paradiddle method described by G. |
- alternating_hands(seed_rhythm)[source]¶
Generates rhythm using the alternating hands method described by G. T. Toussaint.
- Parameters
seed_rhythm (Tuple[int, ...]) – rhythm that shall be distributed on two hands.
- Returns
Return nested tuple that contains two tuple where each tuple represents one rhythm (both rhythms are complementary to each other). The rhythms are encoded in absolute time values.
- Return type
Tuple[Tuple[int, …], …]
Example:
>>> from mutwo.generators import toussaint >>> toussaint.alternating_hands((2, 2)) ((0, 6), (2, 4)) >>> toussaint.alternating_hands((3, 2, 2)) ((0, 5, 10), (3, 7, 12))
The alternating hands algorithm has been described by Godfried T. Toussaint in his paper ‘Generating “Good” Musical Rhythms Algorithmically’.
- euclidean(size, distribution)[source]¶
Return euclidean rhythm as described in a 2005 paper by G. T. Toussaint.
- Parameters
size (int) – how many beats the rhythm contains
distribution (int) – how many beats are played
- Returns
The rhythm in relative time.
- Return type
Tuple[int, …]
Example:
>>> from mutwo.generators import toussaint >>> toussaint.euclidean(8, 4) (2, 2, 2, 2) >>> toussaint.euclidean(7, 5) (2, 1, 1, 2, 1)
The title of Toussaints paper is “The Euclidean Algorithm Generates Traditional Musical Rhythms”.
- paradiddle(size)[source]¶
Generates rhythm using the paradiddle method described by G. T. Toussaint.
- Parameters
size (int) – how many beats the resulting rhythm shall last. ‘Size’ has to be divisible by 2 because of the symmetrical structure of the generated rhythm.
- Returns
Return nested tuple that contains two tuple where each tuple represents one rhythm (both rhythms are complementary to each other). The rhythms are encoded in absolute time values.
- Return type
Tuple[Tuple[int, …], …]
Example:
>>> from mutwo.generators import toussaint >>> toussaint.paradiddle(8) ((0, 2, 3, 5), (1, 4, 6, 7)) >>> toussaint.paradiddle(6) ((0, 4, 5), (1, 2, 3))
The paradiddle algorithm has been described by Godfried T. Toussaint in his paper ‘Generating “Good” Musical Rhythms Algorithmically’.