Skip to content

Implementation of the algorithm for generating the C-score of a rhythm (i.e. "temporal pattern") from "Perception of Temporal Patterns" (Povel & Essens, 1985).

Notifications You must be signed in to change notification settings

Luke-Poeppel/povel_essens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of the algorithm for generating the C-score of a rhythm (i.e. temporal pattern) from "Perception of Temporal Patterns" (Povel & Essens, 1985).

Installation

>>> cd
>>> git clone https://github.com/Luke-Poeppel/povel_essens.git
>>> cd povel_essens
>>> pip3 install -e .

Usage

Given a clock, we calculate the C-score of a fragment as follows. Note that the default weight value W is set to 4, following the paper.

>>> fragment = np.array([0.75, 0.25, 0.25, 1.0, 0.5, 0.25])
>>> clock_choice = np.array([2, 5, 8, 11])
>>> c_score(fragment, clock_choice, W=4)
8

Povel & Essens provide a heuristic for marking accents in a temporal pattern according to three principles:

  1. Relatively isolated events (use get_indices_of_isolated_elements(temporal_pattern))
  2. The second tone in a cluster of two (use get_indices_of_isolated_short_clusters(temporal_pattern))
  3. The initial and final tones of a cluster consisting of >3 tones (use get_indices_of_isolated_long_clusters(temporal_pattern))

We can mark the accents in a temporal pattern with mark_accents.

We can generate all the clocks of a fragment as follows:

>>> example = np.array([1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0])
>>> for this_clock in generate_all_clocks(time_scale_array = example):
...     print(this_clock)
[ 0  1  2  3  4  5  6  7  8  9 10 11]
[ 0  2  4  6  8 10]
[ 1  3  5  7  9 11]
[0 3 6 9]
[ 1  4  7 10]
[ 2  5  8 11]
[0 4 8]
[1 5 9]
[ 2  6 10]
[ 3  7 11]
[ 0  5 10]
[ 1  6 11]
[ 2  7 12]
[ 3  8 13]
[ 4  9 14]

About

Implementation of the algorithm for generating the C-score of a rhythm (i.e. "temporal pattern") from "Perception of Temporal Patterns" (Povel & Essens, 1985).

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages