# st.audio_input

Source: https://docs.streamlit.io/develop/api-reference/widgets/st.audio_input

* Function signature:

   ```python
   st.audio_input(label, *, sample_rate=16000, key=None, help=None, on_change="rerun", args=None, kwargs=None, disabled=False, label_visibility="visible", width="stretch")
   ```

* Parameters:

   | name | type | default | description |
   |---|---|---|---|
   | label | str |  | A short label explaining to the user what this widget is used for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Common block-level Markdown (headings, lists, blockquotes) is automatically escaped and displays as literal text in labels. See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. |
   | sample_rate | int or None | sample | The target sample rate for the audio recording in Hz. This defaults to 16000, which is optimal for speech recognition. The following values are supported: 8000 (telephone quality), 11025, 16000 (speech-recognition quality), 22050, 24000, 32000, 44100, 48000 (high-quality), or None. If this is None, the widget uses the browser's default sample rate (typically 44100 or 48000 Hz). |
   | key | str, int, or None |  | An optional string or integer to use as the unique key for the widget. If this is None (default), a key will be generated for the widget based on the values of the other parameters. No two widgets may have the same key. Assigning a key stabilizes the widget's identity and preserves its state across reruns even when other parameters change. A key lets you access the widget's value via st.session_state[key] (read-only). For more details, see Widget behavior. Additionally, if key is provided, it will be used as a CSS class name prefixed with st-key-. |
   | help | str or None |  | A tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible". If this is None (default), no tooltip is displayed. The tooltip can optionally contain GitHub-flavored Markdown, including the Markdown directives described in the body parameter of st.markdown. |
   | on_change | callable, "rerun", "ignore", or None |  | How the audio input should respond to value changes. This controls whether or not Streamlit reruns the app when the user interacts with the audio input. on_change can be one of the following:  "rerun" (default): Streamlit will rerun the app when the user commits a new value (after a recording upload completes or a recording is cleared). "ignore": Streamlit will not rerun the app when the user commits a new value. The audio input still updates in the UI. The new value is available on the next rerun triggered by something else, such as another widget interaction. The WAV itself is still uploaded to the server immediately; only the rerun is deferred. Ignored commits are held in the browser and are lost if the page is refreshed before that rerun. Inside st.form, this has no effect: the form already defers all commits until submit. A callable: Streamlit will rerun the app and execute the callable as a callback function before the rest of the app. None: This is the same as on_change="rerun". This value exists for backwards compatibility and shouldn't be used. |
   | args | list or tuple |  | An optional list or tuple of args to pass to the callback. |
   | kwargs | dict |  | An optional dict of kwargs to pass to the callback. |
   | disabled | bool | is | An optional boolean that disables the audio input if set to True. Default is False. |
   | label_visibility | "visible", "hidden", or "collapsed" | is | The visibility of the label. The default is "visible". If this is "hidden", Streamlit displays an empty spacer instead of the label, which can help keep the widget aligned with other widgets. If this is "collapsed", Streamlit displays no label or spacer. |
   | width | "stretch" or int |  | The width of the audio input widget. This can be one of the following:  "stretch" (default): The width of the widget matches the width of the parent container. An integer specifying the width in pixels: The widget has a fixed width. If the specified width is greater than the width of the parent container, the width of the widget matches the width of the parent container. |

* Returns: None or UploadedFile

    The UploadedFile class is a subclass of BytesIO, and
therefore is "file-like". This means you can pass an instance of it
anywhere a file is expected. The MIME type for the audio data is
audio/wav. To use this type in an annotation, import it from
streamlit.typing.

Note
The resulting UploadedFile is subject to the size
limitation configured in server.maxUploadSize. If you
expect large sound files, update the configuration option
appropriately.
