1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Mathematical sequence generators for algorithmic music
//!
//! This module provides a comprehensive collection of sequence generators organized into four categories:
//!
//! # Mathematical Sequences
//!
//! Classic mathematical sequences that create interesting melodic and rhythmic patterns:
//! - **Fibonacci**: Natural growth patterns converging to golden ratio
//! - **Primes**: Irregular but deterministic patterns for non-repetitive rhythms
//! - **Arithmetic**: Linear progressions for scales and regular patterns
//! - **Geometric**: Exponential growth for dramatic changes
//! - **Triangular**: Sum sequences for smooth contours
//! - **Powers of Two**: Binary patterns fundamental to digital audio
//! - **Collatz**: The 3n+1 problem creating unpredictable wandering melodies
//!
//! # Rhythmic Patterns
//!
//! Specialized algorithms for generating rhythmic patterns:
//! - **Euclidean**: Mathematically optimal beat distribution used worldwide
//! - **Golden Ratio Rhythm**: Non-periodic but balanced rhythmic patterns
//! - **Shepard Tone**: Illusion of infinitely rising/falling pitch
//!
//! # Generative Algorithms
//!
//! Complex algorithms for creating evolving, non-repetitive patterns:
//! - **Random Walk**: Smooth stochastic variation (Brownian motion)
//! - **Bounded Walk**: Random variation constrained to a range
//! - **Logistic Map**: Classic chaos theory for controllable complexity
//! - **Tent Map**: Simple chaotic map with predictable triangular dynamics
//! - **Sine Map**: Smooth chaotic sequences based on sine waves (very musical!)
//! - **Hénon Map**: 2D chaotic attractor with complex structure
//! - **Baker's Map**: Fractal mixing and distribution patterns
//! - **Thue-Morse**: Fair binary sequences avoiding repetition
//! - **Recamán**: Backward-looking sequence creating spiraling patterns
//! - **Van der Corput**: Quasi-random low-discrepancy sequences
//! - **Cellular Automaton**: Rule-based pattern evolution
//! - **L-System**: Fractal growth patterns from rewriting rules
//! - **Markov Chain**: Probabilistic sequences learned from data
//! - **Cantor Set**: Fractal rhythm patterns from recursive subdivision
//!
//! # Musical Transformations
//!
//! Functions for mapping sequences into musical parameters:
//! - **Harmonic Series**: Generate overtone frequencies (1, 2, 3, 4...)
//! - **Undertone Series**: Mirror of harmonic series (1, 1/2, 1/3, 1/4...)
//! - **Circle of Fifths**: Key relationships through perfect fifths
//! - **Circle of Fourths**: Reverse circle of fifths progression
//! - **Pythagorean Tuning**: Pure fifth-based tuning system
//! - **Just Intonation**: Pure harmonic ratios for major/minor scales
//! - **Golden Ratio**: Powers of φ for natural proportions
//! - **Golden Sections**: Divide values by golden ratio
//! - **Normalize**: Map sequences to specified ranges
//! - **Map to Scale**: Quantize values to musical scales
//!
//! # Examples
//!
//! ```
//! use tunes::sequences;
//! use tunes::prelude::*;
//!
//! // Create a Fibonacci melody
//! let fib = sequences::fibonacci::generate(8);
//! let melody = sequences::normalize(&fib, 220.0, 880.0);
//!
//! // Create Euclidean rhythm
//! let kick_pattern = sequences::euclidean::generate(4, 16);
//! let snare_pattern = sequences::euclidean::generate(3, 16);
//!
//! // Generate chaotic variation
//! let chaos = sequences::logistic_map::generate(3.9, 0.5, 32);
//!
//! // Map to C major scale
//! let scale_notes = sequences::map_to_scale(
//! &fib,
//! &sequences::Scale::major(),
//! C4, // Middle C (use note constant!)
//! 2 // Two octaves
//! );
//! ```
// Re-export all functions for backward compatibility
pub use *;
pub use *;
pub use *;
pub use *;