-- | Bill Alves. \"Pleng: Composing for a Justly Tuned Gender
-- Barung\". 1/1: Journal of the Just Intonation Network, 1:4-11, Spring
-- 1997.  <http://www2.hmc.edu/~alves/pleng.html>
module Music.Theory.Tuning.Alves_1997 where

import Music.Theory.Tuning.Type {- hmt -}

-- > import Music.Theory.Tuning {- hmt -}
-- > let c = [0,231,498,765,996]
-- > map (round . ratio_to_cents) alves_slendro_r == c
alves_slendro_r :: [Rational]
alves_slendro_r :: [Rational]
alves_slendro_r = [Rational
1,Rational
8forall a. Fractional a => a -> a -> a
/Rational
7,Rational
4forall a. Fractional a => a -> a -> a
/Rational
3,Rational
14forall a. Fractional a => a -> a -> a
/Rational
9,Rational
16forall a. Fractional a => a -> a -> a
/Rational
9]

{- | HMC /slendro/ tuning.

> cents_i alves_slendro == [0,231,498,765,996]

> import Music.Theory.Tuning.Scala {- hmt -}
> scl <- scl_load "alves_slendro"
> tn_cents_i (scale_to_tuning 0.01 scl) == tn_cents_i alves_slendro
-}
alves_slendro :: Tuning
alves_slendro :: Tuning
alves_slendro = Either [Rational] [Cents]
-> Maybe (Either Rational Cents) -> Tuning
Tuning (forall a b. a -> Either a b
Left [Rational]
alves_slendro_r) forall a. Maybe a
Nothing

-- > let c = [0,231,316,702,814]
-- > map (round . ratio_to_cents) alves_pelog_bem_r == c
alves_pelog_bem_r :: [Rational]
alves_pelog_bem_r :: [Rational]
alves_pelog_bem_r = [Rational
1,Rational
8forall a. Fractional a => a -> a -> a
/Rational
7,Rational
6forall a. Fractional a => a -> a -> a
/Rational
5,Rational
3forall a. Fractional a => a -> a -> a
/Rational
2,Rational
8forall a. Fractional a => a -> a -> a
/Rational
5]

{- | HMC /pelog bem/ tuning.

> tn_cents_i alves_pelog_bem == [0,231,316,702,814]

> scl <- scl_load "alves_pelog"
> tn_cents_i (scale_to_tuning 0.01 scl) == [0,231,316,471,702,814,969]
-}
alves_pelog_bem :: Tuning
alves_pelog_bem :: Tuning
alves_pelog_bem = Either [Rational] [Cents]
-> Maybe (Either Rational Cents) -> Tuning
Tuning (forall a b. a -> Either a b
Left [Rational]
alves_pelog_bem_r) forall a. Maybe a
Nothing

-- > let c = [0,386,471,857,969]
-- > map (round . ratio_to_cents) alves_pelog_barang_r == c
alves_pelog_barang_r :: [Rational]
alves_pelog_barang_r :: [Rational]
alves_pelog_barang_r = [Rational
1,Rational
5forall a. Fractional a => a -> a -> a
/Rational
4,Rational
21forall a. Fractional a => a -> a -> a
/Rational
16,Rational
105forall a. Fractional a => a -> a -> a
/Rational
64,Rational
7forall a. Fractional a => a -> a -> a
/Rational
4]

-- | HMC /pelog barang/ tuning.
--
-- > tn_cents_i alves_pelog_barang == [0,386,471,857,969]
alves_pelog_barang :: Tuning
alves_pelog_barang :: Tuning
alves_pelog_barang = Either [Rational] [Cents]
-> Maybe (Either Rational Cents) -> Tuning
Tuning (forall a b. a -> Either a b
Left [Rational]
alves_pelog_barang_r) forall a. Maybe a
Nothing

-- > let c = [0,386,471,702,969]
-- > map (round . ratio_to_cents) alves_pelog_23467_r == c
alves_pelog_23467_r :: [Rational]
alves_pelog_23467_r :: [Rational]
alves_pelog_23467_r = [Rational
1,Rational
5forall a. Fractional a => a -> a -> a
/Rational
4,Rational
21forall a. Fractional a => a -> a -> a
/Rational
16,Rational
3forall a. Fractional a => a -> a -> a
/Rational
2,Rational
7forall a. Fractional a => a -> a -> a
/Rational
4]

-- | HMC /pelog 2,3,4,6,7/ tuning.
--
-- > tn_cents_i alves_pelog_23467 == [0,386,471,702,969]
alves_pelog_23467 :: Tuning
alves_pelog_23467 :: Tuning
alves_pelog_23467 = Either [Rational] [Cents]
-> Maybe (Either Rational Cents) -> Tuning
Tuning (forall a b. a -> Either a b
Left [Rational]
alves_pelog_23467_r) forall a. Maybe a
Nothing