[{"name":"Audio","comment":"\n\n\n# Applications\n\nCreate an Elm app that supports playing audio.\n\n@docs elementWithAudio, documentWithAudio, applicationWithAudio, Model, Msg\n\n\n# Load audio\n\nLoad audio so you can later play it.\n\n@docs AudioCmd, loadAudio, LoadError, Source, cmdMap, cmdBatch, cmdNone\n\n\n# Play audio\n\nDefine what audio should be playing.\n\n@docs Audio, audio, group, silence, audioWithConfig, audioDefaultConfig, PlayAudioConfig, LoopConfig\n\n\n# Audio effects\n\nEffects you can apply to `Audio`.\n\n@docs scaleVolume, scaleVolumeAt\n\n\n# Lamdera stuff\n\nWIP support for Lamdera. Ignore this for now.\n\n@docs lamderaFrontendWithAudio, migrateModel, migrateMsg\n\n","unions":[{"name":"Audio","comment":" Some kind of sound we want to play. To create `Audio` start with `audio`.\n","args":[],"cases":[]},{"name":"AudioCmd","comment":" An audio command.\n","args":["userMsg"],"cases":[]},{"name":"LoadError","comment":" Possible errors we can get when loading audio files.\n","args":[],"cases":[["MediaDecodeAudioDataUnknownContentType",[]],["NetworkError",[]],["ErrorThatHappensWhenYouLoadMoreThan1000SoundsDueToHackyWorkAroundToMakeThisPackageBehaveMoreLikeAnEffectPackage",[]]]},{"name":"Model","comment":" ","args":["userMsg","userModel"],"cases":[]},{"name":"Msg","comment":" ","args":["userMsg"],"cases":[]},{"name":"Source","comment":" Audio data we can use to play sounds\n","args":[],"cases":[]}],"aliases":[{"name":"LoopConfig","comment":" Control how audio loops. `loopEnd` defines where (relative to the start of the audio) the audio should loop and `loopStart` defines where it should loop to.\n\n    -- Here we have a song that plays an intro once and then loops between the 10 second point and the end of the song.\n    let\n        default =\n            Audio.audioDefaultConfig\n\n        -- This package doesn't support getting how long a sound plays for so we need to hard code it instead.\n        songLength =\n            Duration.seconds 120\n    in\n    audioWithConfig\n        { default | loop = Just { loopStart = Duration.seconds 10, loopEnd = songLength } }\n        coolBackgroundMusic\n        startTime\n\n","args":[],"type":"{ loopStart : Duration.Duration, loopEnd : Duration.Duration }"},{"name":"PlayAudioConfig","comment":" Extra settings when playing audio from a file.\n\n    -- Here we play a song at half speed and it skips the first 15 seconds of the song.\n    audioWithConfig\n        { loop = Nothing\n        , playbackRate = 0.5\n        , startAt = Duration.seconds 15\n        }\n        myCoolSong\n        songStartTime\n\n","args":[],"type":"{ loop : Maybe.Maybe Audio.LoopConfig, playbackRate : Basics.Float, startAt : Duration.Duration }"}],"values":[{"name":"applicationWithAudio","comment":" Browser.application but with the ability to play sounds.\n","type":"{ init : flags -> Url.Url -> Browser.Navigation.Key -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), view : model -> Browser.Document msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), subscriptions : model -> Platform.Sub.Sub msg, onUrlRequest : Browser.UrlRequest -> msg, onUrlChange : Url.Url -> msg, audio : model -> Audio.Audio, audioPort : Audio.Ports msg } -> Platform.Program flags (Audio.Model msg model) (Audio.Msg msg)"},{"name":"audio","comment":" Play audio from an audio source at a given time. This is the same as using `audioWithConfig audioDefaultConfig`.\n\nNote that in some browsers audio will be muted until user interacts with the webpage.\n\n","type":"Audio.Source -> Time.Posix -> Audio.Audio"},{"name":"audioDefaultConfig","comment":" Default config used for `audioWithConfig`.\n","type":"Audio.PlayAudioConfig"},{"name":"audioWithConfig","comment":" Play audio from an audio source at a given time with config.\n\nNote that in some browsers audio will be muted until user interacts with the webpage.\n\n","type":"Audio.PlayAudioConfig -> Audio.Source -> Time.Posix -> Audio.Audio"},{"name":"cmdBatch","comment":" Combine multiple commands into a single command. Conceptually the same as Cmd.batch.\n","type":"List.List (Audio.AudioCmd userMsg) -> Audio.AudioCmd userMsg"},{"name":"cmdMap","comment":" Map a command from one type to another. Conceptually the same as Cmd.map\n","type":"(a -> b) -> Audio.AudioCmd a -> Audio.AudioCmd b"},{"name":"cmdNone","comment":" A command that does nothing. Conceptually the same as Cmd.none.\n","type":"Audio.AudioCmd msg"},{"name":"documentWithAudio","comment":" Browser.document but with the ability to play sounds.\n","type":"{ init : flags -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), view : model -> Browser.Document msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), subscriptions : model -> Platform.Sub.Sub msg, audio : model -> Audio.Audio, audioPort : Audio.Ports msg } -> Platform.Program flags (Audio.Model msg model) (Audio.Msg msg)"},{"name":"elementWithAudio","comment":" Browser.element but with the ability to play sounds.\n","type":"{ init : flags -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), view : model -> Html.Html msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg, Audio.AudioCmd msg ), subscriptions : model -> Platform.Sub.Sub msg, audio : model -> Audio.Audio, audioPort : Audio.Ports msg } -> Platform.Program flags (Audio.Model msg model) (Audio.Msg msg)"},{"name":"group","comment":" Combine multiple `Audio`s into a single `Audio`.\n","type":"List.List Audio.Audio -> Audio.Audio"},{"name":"lamderaFrontendWithAudio","comment":" Lamdera.frontend but with the ability to play sounds (highly experimental, just ignore this for now).\n","type":"{ init : Url.Url -> Browser.Navigation.Key -> ( model, Platform.Cmd.Cmd frontendMsg, Audio.AudioCmd frontendMsg ), view : model -> Browser.Document frontendMsg, update : frontendMsg -> model -> ( model, Platform.Cmd.Cmd frontendMsg, Audio.AudioCmd frontendMsg ), updateFromBackend : toFrontend -> model -> ( model, Platform.Cmd.Cmd frontendMsg, Audio.AudioCmd frontendMsg ), subscriptions : model -> Platform.Sub.Sub frontendMsg, onUrlRequest : Browser.UrlRequest -> frontendMsg, onUrlChange : Url.Url -> frontendMsg, audio : model -> Audio.Audio, audioPort : Audio.Ports frontendMsg } -> { init : Url.Url -> Browser.Navigation.Key -> ( Audio.Model frontendMsg model, Platform.Cmd.Cmd (Audio.Msg frontendMsg) ), view : Audio.Model frontendMsg model -> Browser.Document (Audio.Msg frontendMsg), update : Audio.Msg frontendMsg -> Audio.Model frontendMsg model -> ( Audio.Model frontendMsg model, Platform.Cmd.Cmd (Audio.Msg frontendMsg) ), updateFromBackend : toFrontend -> Audio.Model frontendMsg model -> ( Audio.Model frontendMsg model, Platform.Cmd.Cmd (Audio.Msg frontendMsg) ), subscriptions : Audio.Model frontendMsg model -> Platform.Sub.Sub (Audio.Msg frontendMsg), onUrlRequest : Browser.UrlRequest -> Audio.Msg frontendMsg, onUrlChange : Url.Url -> Audio.Msg frontendMsg }"},{"name":"loadAudio","comment":" Load audio from a url.\n","type":"(Result.Result Audio.LoadError Audio.Source -> msg) -> String.String -> Audio.AudioCmd msg"},{"name":"migrateModel","comment":" Use this function when migrating your model in Lamdera.\n","type":"(msgOld -> msgNew) -> (modelOld -> ( modelNew, Platform.Cmd.Cmd msgNew )) -> Audio.Model msgOld modelOld -> ( Audio.Model msgNew modelNew, Platform.Cmd.Cmd msgNew )"},{"name":"migrateMsg","comment":" Use this function when migrating messages in Lamdera.\n","type":"(msgOld -> ( msgNew, Platform.Cmd.Cmd msgNew )) -> Audio.Msg msgOld -> ( Audio.Msg msgNew, Platform.Cmd.Cmd msgNew )"},{"name":"scaleVolume","comment":" Scale how loud a given `Audio` is.\n1 preserves the current volume, 0.5 halves it, and 0 mutes it.\nIf the the volume is less than 0, 0 will be used instead.\n","type":"Basics.Float -> Audio.Audio -> Audio.Audio"},{"name":"scaleVolumeAt","comment":" Scale how loud some `Audio` is at different points in time.\nThe volume will transition linearly between those points.\nThe points in time don't need to be sorted but they need to be unique.\n\n    import Audio\n    import Time\n\n\n    -- Here we define a function that fades in audio to full volume and then fades it out until it's muted.\n    --\n    --  1                ________\n    --                 /         \\\n    --  0 ____________/           \\_______\n    --     t ->    fade in     fade out\n    fadeInOut fadeInTime fadeOutTime audio =\n        Audio.scaleVolumeAt\n            [ ( addSeconds -2 fadeInTime, 0 )\n            , ( fadeInTime, 1 )\n            , ( fadeOutTime, 1 )\n            , ( addSeconds 2 fadeOutTime, 0 )\n            ]\n            audio\n\n    addSeconds s =\n        Time.posixToMillis >> ((+) s * 1000) >> Time.millisToPosix\n\n","type":"List.List ( Time.Posix, Basics.Float ) -> Audio.Audio -> Audio.Audio"},{"name":"silence","comment":" The sound of no sound at all.\n","type":"Audio.Audio"}],"binops":[]}]