[{"name":"Audio","comment":"\n\n\n# Applications\n\nCreate an Elm app that supports playing audio.\n\n@docs elementWithAudio, documentWithAudio, applicationWithAudio, Program\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, VolumeTimeline\n\n\n# Lamdera stuff\n\nWIP support for Lamdera. Ignore this for now.\n\n@docs lamderaFrontendWithAudio, userModel, withUserModel, mapUserMsg\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":"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` 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","args":[],"type":"{ loop : Maybe.Maybe Audio.LoopConfig, playbackRate : Basics.Float, startAt : Duration.Duration }"},{"name":"Program","comment":" Alias for Platform.Program\n","args":["flags","userModel","userMsg"],"type":"Platform.Program flags (Audio.Model userMsg userModel) (Audio.Msg userMsg)"},{"name":"VolumeTimeline","comment":" A nonempty list of (time, volume) points for defining how loud a sound should be at any point in time.\nThe points don't need to be sorted but don't include multiple points that have the same time.\n","args":[],"type":"List.Nonempty.Nonempty ( Time.Posix, Basics.Float )"}],"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 } -> Audio.Program flags model msg"},{"name":"audio","comment":" Play audio from an audio source at a given time. This is the same as using `audioWithConfig audioDefaultConfig`.\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","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 } -> Audio.Program flags model 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 } -> Audio.Program flags model 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":"mapUserMsg","comment":" Change the `userMsg` type in `Model`. Useful for dealing with migrations in Lamdera.\n","type":"(userMsgOld -> userMsgNew) -> Audio.Model userMsgOld userModel -> Audio.Model userMsgNew userModel"},{"name":"scaleVolume","comment":" Scale how loud a given `Audio` is. If 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 a given `Audio` is at given points in time. The volume will transition linearly between those points.\n\n    import Audio\n    import List.Nonempty exposing (Nonempty)\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            (Nonempty\n                ( addSeconds -2 fadeInTime, 0 )\n                [ ( fadeInTime, 1 )\n                , ( fadeOutTime, 1 )\n                , ( addSeconds 2 fadeOutTime, 0 )\n                ]\n            )\n            audio\n\n    addSeconds s =\n        Time.posixToMillis >> ((+) s * 1000) >> Time.millisToPosix\n\n","type":"Audio.VolumeTimeline -> Audio.Audio -> Audio.Audio"},{"name":"silence","comment":" The sound of no sound at all.\n","type":"Audio.Audio"},{"name":"userModel","comment":" Get the user state stored in `Model`.\n","type":"Audio.Model userMsg userModel -> userModel"},{"name":"withUserModel","comment":" Set the user state stored in `Model`. Useful for dealing with migrations in Lamdera.\n","type":"userModelNew -> Audio.Model userMsg userModelOld -> Audio.Model userMsg userModelNew"}],"binops":[]}]