lgcantarelli / emusic / Emusic

DSL that implements the music patterns and functions to make it easy to write music and parse its structures to send to browser.

Instrument type


type Instrument
    = AMSynth
    | FMSynth
    | MBSynth

Intrument type

MAction type


type MAction
    = X
    | O

Music action

MPattern type


type MPattern
    = MPattern (List MAction)

Music pattern

Song type


type Song
    = Song (List Track)

Song type

Track type


type Track
    = Track Instrument MPattern

Track type

SongData type


type alias SongData =
List TrackObject

Song data to send to JS

SongIdentifier type


type alias SongIdentifier =
{ songName : SongName
, song : Song 
}

Song identifier type

SongName type


type alias SongName =
String

Song name type

TrackObject type


type alias TrackObject =
{ instrument : Basics.Int
, actions : List String 
}

Track data to send to JS

Msg type


type Msg
    = Play SongName
    | Stop

Msg type

Model type


type alias Model =
{ songs : List SongIdentifier
, currentSong : SongName 
}

Model type

Exposed methods

init : List SongIdentifier -> ( Model, Platform.Cmd.Cmd Msg )

Init program with a list of song identifiers

update : Msg -> Model -> (SongData -> Platform.Cmd.Cmd Msg) -> ( Model, Platform.Cmd.Cmd Msg )

Update program

repeat : Basics.Int -> List MAction -> List MAction

Repeat action lists