Repository: gradio-app/gradio
File: gradio/components/audio.py (Python)

Code before:
                f"Invalid value for parameter `format`: {format}. Please choose from one of: {' '.join(valid_formats)}"
            )
        self.format = format and format.lower()
        self.autoplay = autoplay
        self.loop = loop
        self.show_download_button = show_download_button
        self.show_share_button = (
            (utils.get_space() is not None)
            if show_share_button is None
            else show_share_button
        )
        self.editable = editable
        if waveform_options is None:
            self.waveform_options = WaveformOptions()
        elif isinstance(waveform_options, dict):
            self.waveform_options = WaveformOptions(**waveform_options)
        else:
            self.waveform_options = waveform_options
        if self.waveform_options.show_controls is not False:
            warnings.warn(
                "The `show_controls` parameter is deprecated and will be removed in a future release. Use `show_recording_waveform` instead."
            )
        self.min_length = min_length
        self.max_length = max_length
        self.recording = recording
        if subtitles is not None:
            self.subtitles = handle_file(subtitles)
        else:
            self.subtitles = None

        super().__init__(
            label=label,
            every=every,
            inputs=inputs,
            show_label=show_label,
            container=container,
            scale=scale,
            min_width=min_width,
            interactive=interactive,
            visible=visible,
            elem_id=elem_id,
            elem_classes=elem_classes,
            render=render,
            key=key,
            preserved_by_key=preserved_by_key,
            value=value,
        )
        self._value_description = (
            "a filepath to an audio file"
            if self.type == "filepath"
            else "a tuple of [sample_rate: int, data: np.ndarray] of audio data"

Review comment (suggestion):
Nit:

```suggestion
        self.subtitles = None
        if subtitles is not None:
            self.subtitles = handle_file(subtitles)
```

Code after:
                f"Invalid value for parameter `format`: {format}. Please choose from one of: {' '.join(valid_formats)}"
            )
        self.format = format and format.lower()
        self.autoplay = autoplay
        self.loop = loop
        self.show_download_button = show_download_button
        self.show_share_button = (
            (utils.get_space() is not None)
            if show_share_button is None
            else show_share_button
        )
        self.editable = editable
        if waveform_options is None:
            self.waveform_options = WaveformOptions()
        elif isinstance(waveform_options, dict):
            self.waveform_options = WaveformOptions(**waveform_options)
        else:
            self.waveform_options = waveform_options
        if self.waveform_options.show_controls is not False:
            warnings.warn(
                "The `show_controls` parameter is deprecated and will be removed in a future release. Use `show_recording_waveform` instead."
            )
        self.min_length = min_length
        self.max_length = max_length
        self.recording = recording
        super().__init__(
            label=label,
            every=every,
            inputs=inputs,
            show_label=show_label,
            container=container,
            scale=scale,
            min_width=min_width,
            interactive=interactive,
            visible=visible,
            elem_id=elem_id,
            elem_classes=elem_classes,
            render=render,
            key=key,
            preserved_by_key=preserved_by_key,
            value=value,
        )
        self._value_description = (
            "a filepath to an audio file"
            if self.type == "filepath"
            else "a tuple of [sample_rate: int, data: np.ndarray] of audio data"
        )
        self.subtitles = None
        if subtitles is not None:
            if isinstance(subtitles, list):
                self.subtitles = self._process_json_subtitles(subtitles)