# `Mx.Engine.Mxs.Native`
[🔗](https://github.com/mx-music/mx/blob/main/lib/mx/engine/mxs/native.ex#L1)

The functions mxs, the Rust engine, provides as NIFs.

# `catalog`

Every synth's options, and those every note, sample and effect takes, as `{synths, note, sample, effects, effect}`.

# `check_sample`

The length in seconds of the file at a path, reading only its headers, or why mxs cannot play it.

# `inputs`

How many channels of the sound card's input the engine reads.

# `load_sample`

Loads a sample, and returns its number and channels.

# `now`

The seconds the engine has played so far.

# `panic_on_purpose`

Panics on purpose, so a test can check that a panic raises in Elixir instead of stopping the BEAM.

# `pitches`

The pitch in Hz of each frame of the samples with pYIN, or nil where it finds the frame unvoiced; frame i is centred on sample `i * hop`.

# `play`

Plays `{seconds, event}` pairs, each event a note, a sample, an input, a change to sounds playing, or a stop.

# `rate`

The rate the engine plays and renders at, in Hz.

# `record`

Records `{:input, number}`, numbered from 0, or `{:sample, sample}` to a WAV file from `at` seconds.

# `record_output`

Records the main output to a WAV file from `at` seconds.

# `register_effect_graph`

Registers an effect traced by defeffect: its options' declarations, and the graph of one channel.

# `register_graph`

Registers a synth traced by defsynth: its options' declarations, and each clause as the options it matches and its graph.

# `render`

Renders the next seconds of an offline engine, as the left and right channels in native-endian 32-bit floats.

# `sample_peak`

The loudest sample of the file at a path, as a level from 0, read from all of it.

# `seconds_at`

The engine's seconds at which it renders the Unix time given in microseconds, or nil for an offline engine.

# `sounding`

Whether any note or sample is still sounding.

# `start`

Starts an engine with every synth and effect registered: playing live, with the sound card's input or without, or offline.

# `start_effects`

Starts an effect chain of effects, each a name and its options, in order, and returns the chain notes name to play into.

# `stop_effects`

Removes an effect chain at `at` seconds, once its notes and its effects' tails have ended.

# `stop_recording`

Stops the recording `record/4` started.

# `stop_recording_output`

Stops the recording `record_output/3` started.

# `warnings`

Values held to their ranges since the last call, once for each option, and how many notes were stolen to keep to the voice limit.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
