Module

Ocarina.Interpret

Package
purescript-ocarina
Repository
mikesol/purescript-ocarina

#AudioWorkletNodeRequest Source

data AudioWorkletNodeRequest :: Symbol -> Type -> Type -> Type -> Row Type -> Row Type -> Typedata AudioWorkletNodeRequest (node :: Symbol) (numberOfInputs :: Type) (numberOfOutputs :: Type) (outputChannelCount :: Type) (parameterData :: Row Type) (processorOptions :: Row Type)

Constructors

#AudioWorkletNodeResponse Source

data AudioWorkletNodeResponse :: Symbol -> Type -> Type -> Type -> Row Type -> Row Type -> Typedata AudioWorkletNodeResponse (node :: Symbol) (numberOfInputs :: Type) (numberOfOutputs :: Type) (outputChannelCount :: Type) (parameterData :: Row Type) (processorOptions :: Row Type)

#audioWorkletAddModule_ Source

audioWorkletAddModule_ :: AudioContext -> String -> Effect (Promise Unit)

For a given audio context, add the audio worklet module at a given URI.

#getAudioClockTime Source

getAudioClockTime :: AudioContext -> Effect Number

Gets the audio ctime from an audio context.

#stopMediaRecorder Source

stopMediaRecorder :: MediaRecorder -> Effect Unit

Stops a media recorder

#mediaRecorderToBlob Source

mediaRecorderToBlob :: String -> (Blob -> Effect Unit) -> MediaRecorder -> Effect Unit

For a given MIME type, pass the URL-ified content of a media recorder as a string to a handler.

mediaRecorderToUrl "audio/ogg" setAudioTagUrlToThisContent recorder

#isTypeSupported Source

isTypeSupported :: String -> Effect Boolean

Is this MIME type supported by this browser.

#decodeAudioDataFromUri Source

decodeAudioDataFromUri :: AudioContext -> String -> Aff BrowserAudioBuffer

Given an audio context and a URI, decode the content of the URI to an audio buffer.

#bracketCtx Source

bracketCtx :: forall a. (AudioContext -> Aff a) -> Aff a

#decodeAudioDataFromBase64EncodedString Source

decodeAudioDataFromBase64EncodedString :: AudioContext -> String -> Effect (Promise BrowserAudioBuffer)

Given an audio context and a base-64-encoded audio file, decode the content of the string to an audio buffer.

#makeAudioBuffer_ Source

makeAudioBuffer_ :: AudioContext -> { arr :: Array (Array Number), size :: Int } -> Effect BrowserAudioBuffer

For a given audio context, use an audio buffer to create a browser audio buffer. This is useful when doing DSP in the browser. Note that AudioBuffer is a purescript type whereas WebAPI.BrowserAudioBuffer is an optimized browser-based type. That means that, once you write to WebAPI.BrowserAudioBuffer, it is effectively a blob and its contents cannot be retrieved using the Ocarina API.

#makeFloatArray Source

makeFloatArray :: Array Number -> BrowserFloatArray

Make a float 32 array. Useful when creating a waveshaper node.

#context_ Source

context_ :: Effect AudioContext

Make a new audio context.

#context Source

context :: forall m. MonadEffect m => m AudioContext

#constant0Hack_ Source

constant0Hack_ :: AudioContext -> Effect (Effect Unit)

Send 0s from a context immediately. This is useful on iOS so that the context doesn't switch to a suspended state.

#constant0Hack Source

#contextState_ Source

contextState_ :: AudioContext -> Effect String

Get the state of the context

#contextState Source

#contextResume_ Source

contextResume_ :: AudioContext -> Effect (Promise Unit)

Get the state of the context Get the state of the context

#contextResume Source

#contextResumeAff Source

#close_ Source

close_ :: AudioContext -> Effect Unit

Close an audio context.

#close Source

close :: forall e. MonadEffect e => AudioContext -> e Unit

#BrowserMediaStream Source

#Audio Source

data Audio

#audioWorkletAddModule Source

audioWorkletAddModule :: forall node payload numberOfInputs numberOfOutputs outputChannelCount parameterData processorOptions. IsSymbol node => Nat numberOfInputs => Pos numberOfOutputs => ValidateOutputChannelCount numberOfOutputs outputChannelCount => Homogeneous parameterData (AudioParameter payload) => WriteForeign (Record processorOptions) => AudioContext -> String -> (AudioWorkletNodeRequest node numberOfInputs numberOfOutputs outputChannelCount parameterData processorOptions) -> Aff (AudioWorkletNodeResponse node numberOfInputs numberOfOutputs outputChannelCount parameterData processorOptions)

#getMicrophoneAndCamera Source

#makeFFIAudioSnapshot Source

makeFFIAudioSnapshot :: AudioContext -> Effect FFIAudioSnapshot

Create a unit cache. This returns a fresh empty object {} that is used to cache audio units.

#makePeriodicWave Source

makePeriodicWave :: forall len. Lt D1 len => AudioContext -> Vec len Number -> Vec len Number -> Effect BrowserPeriodicWave

Make a browser periodic wave. A PureScript-ified version of the periodic wave constructor from the Web Audio API. Given an audio context, a vector of real parts of complex numbers, and a vector of imaginary parts of complex numbers, build a periodic wave interpretable by the Web Audio API.

#AudioBuffer Source

data AudioBuffer

A multi-channel audio buffer.

Constructors

Instances

#audioBuffer Source

audioBuffer :: forall bch blen. Pos bch => Pos blen => Int -> Vec bch (Vec blen Number) -> AudioBuffer

Make a multi-channel audio buffer. Each vector into the multi-channel buffer must be the same length.

#FFIAudioSnapshot Source

#Mbe Source

type Mbe = forall a b. b -> (a -> b) -> Maybe a -> b