Microphone

class marimo.ui.microphone(*, label: str = '', on_change: Callable[[BytesIO], None] | None = None)

An audio recorder element.

Use mo.ui.microphone to record audio via the user’s browser. The user must grant permission to use the microphone.

Example.

mic = mo.ui.microphone()
mic
mo.audio(mic.value)

Attributes.

  • value: The blob of the recorded audio, as an io.BytesIO object.

Initialization Args.

  • label: optional text label for the element

  • on_change: optional callback to run when this element’s value changes

Public methods

Inherited from UIElement

form([label, bordered, loading, ...])

Create a submittable form out of this UIElement.

send_message(message, buffers)

Send a message to the element rendered on the frontend from the backend.

Inherited from Html

batch(**elements)

Convert an HTML object with templated text into a UI element.

center()

Center an item.

right()

Right-justify.

left()

Left-justify.

callout([kind])

Create a callout containing this HTML element.

style([style])

Wrap an object in a styled container.

Public Data Attributes:

name

Inherited from UIElement

value

The element’s current value.

Inherited from Html

text

A string of HTML representing this element.