_panel_manipulation Module#

_panel_manipulation Module#

waloviz._panel_manipulation.save_player_panel(player_panel: Viewable, out_file: Optional[Union[str, PathLike, IO]] = None, title: Optional[str] = None, resources: Resources = Resources(mode='inline'), embed: bool = True) Union[str, PathLike, IO][source]#
Saves a panel player to an HTML file.
Does not save the download button.

Parameters#

sourcepn.viewable.Viewable

The player created by wv.Audio

out_filestr | os.PathLike | IO

The output file path for the generated html, default is “{title}.html”

titlestr

The title to be used in the generated file name and the html title, if wv.Audio(title="...") was specified, then that value is used, otherwise, the default is “waloviz”.

resourcesbokeh.resources.Resources

The resources for the panel save method, default is INLINE

embedbool

The embed value for the panel save method, default is True

Returns#

out_filestr | os.PathLike | IO

The file that the HTML player content was written into


waloviz._panel_manipulation.wrap_player_with_panel(player_bokeh: Model, wav: Tensor, sr: int, title: Optional[str], width: Union[int, str], height: Union[int, str], audio_height: int, button_height: int, pbar_height: int, both_min_height: int, download_button: bool, native_player: bool, aspect_ratio: Optional[float], sizing_mode: Optional[str]) Viewable[source]#
Wraps the bokeh player with panel, adds the audio and optionally a download button.

Parameters#

player_bokehbokeh.model.Model

The generated bokeh player with the custom jslink interactivity, without the audio

wavtorch.Tensor

The audio tensor

srint

The sample rate

titlestr

A title to be used when saving the plot

heightint | str

The total height of the plot

widthint | str

The total width of the plot

audio_heightbool

The expected height of the audio widget

button_heightbool

The expected height of the download button

download_buttonbool

Whether to show the html download button

native_playerbool

Whether the underlying native audio player should be visible

aspect_ratiofloat

The ratio between the width and height, relevant only when either width, height or both are “responsive”

sizing_modestr

The panel sizing_mode , can be one of seven values: “stretch_width”, “stretch_height”, “stretch_both”, “scale_width”, “scale_height”, “scale_both”, or “fixed”.

Returns#

player_panelpn.viewable.Viewable

A panel pane with a fully featured interactive player