Linguistics#
- thebeat.linguistic.generate_moraic_sequence(n_feet, foot_ioi, rng=None)[source]#
This function generates a Sequence object with inter-onset intervals (IOIs) mimicing the rhythmic structure of mora-timed languages. The feet contain clusters of either one or two IOIs with the same total duration. The total duration is specified in
foot_ioi
.The phrases all have the same duration, but are made up of different combinations of IOIs.
- Parameters:
n_feet (
int
) – The number of feet in the sequence.foot_ioi (
float
) – The duration in milliseconds of the foot.rng (
Optional
[Generator
], default:None
) – Anumpy.random.Generator
object, if none is supplied will default tonumpy.random.default_rng()
- Return type:
Examples
>>> rng = np.random.default_rng(seed=123) >>> seq = generate_moraic_sequence(n_feet=3, foot_ioi=500, rng=rng) >>> print(seq.iois) [500. 208.33333333 291.66666667 500. ]
Notes
Both the methodology and the code are based on/taken from Ravignani and Norton [RN17].
- thebeat.linguistic.generate_stress_timed_sequence(n_events_per_phrase, syllable_ioi=500, n_phrases=1, rng=None)[source]#
This function generates a Sequence object with inter-onset intervals (IOIs) mimicing the rhythmic structure of stress-timed languages.
In one sequence (cf. ‘sentence’), there are
n_phrases
ofn_events_per_phrase
.The phrases all have the same duration, but are made up of different combinations of IOIs.
- Parameters:
n_events_per_phrase (
int
) – The number of events in a single ‘phrase’.syllable_ioi (
int
, default:500
) – The duration of the reference IOI in milliseconds.n_phrases (
int
, default:1
) – The number of phrases in the sequence.rng (
Optional
[Generator
], default:None
) – Anumpy.random.Generator
object. if none is supplied will default tonumpy.random.default_rng()
.
- Return type:
Examples
>>> rng = np.random.default_rng(seed=123) >>> seq = generate_stress_timed_sequence(n_events_per_phrase=4, n_phrases=3, rng=rng) >>> print(seq.iois) [ 62.5 687.5 562.5 687.5 62.5 875. 250. 812.5 250. 187.5 375. ]
Notes
Both the methodology and the code are based on/taken from Ravignani and Norton [RN17].