user: Show practical ways to work with Sound Operators in a Blender add-on or script – include code.

assistant: # Sound Operators

bpy.ops.sound.bake_animation()
:   Update the audio animation cache

bpy.ops.sound.mixdown(*\**, *filepath=''*, *check_existing=True*, *filter_blender=False*, *filter_backup=False*, *filter_image=False*, *filter_movie=False*, *filter_python=False*, *filter_font=False*, *filter_sound=True*, *filter_text=False*, *filter_archive=False*, *filter_btx=False*, *filter_alembic=False*, *filter_usd=False*, *filter_obj=False*, *filter_volume=False*, *filter_folder=True*, *filter_blenlib=False*, *filemode=9*, *relative_path=True*, *display_type='DEFAULT'*, *sort_method=''*, *accuracy=1024*, *container='FLAC'*, *codec='FLAC'*, *channels='STEREO'*, *format='S16'*, *mixrate=48000*, *bitrate=192*, *split_channels=False*)
:   Mix the scene’s audio to a sound file

    Parameters:
    :   - **filepath** (*string**,* *(**optional**,* *never None**)*) – File Path, Path to file
        - **check_existing** (*boolean**,* *(**optional**)*) – Check Existing, Check and warn on overwriting existing files
        - **filter_blender** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_backup** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_image** (*boolean**,* *(**optional**)*) – Filter image files
        - **filter_movie** (*boolean**,* *(**optional**)*) – Filter movie files
        - **filter_python** (*boolean**,* *(**optional**)*) – Filter Python files
        - **filter_font** (*boolean**,* *(**optional**)*) – Filter font files
        - **filter_sound** (*boolean**,* *(**optional**)*) – Filter sound files
        - **filter_text** (*boolean**,* *(**optional**)*) – Filter text files
        - **filter_archive** (*boolean**,* *(**optional**)*) – Filter archive files
        - **filter_btx** (*boolean**,* *(**optional**)*) – Filter btx files
        - **filter_alembic** (*boolean**,* *(**optional**)*) – Filter Alembic files
        - **filter_usd** (*boolean**,* *(**optional**)*) – Filter USD files
        - **filter_obj** (*boolean**,* *(**optional**)*) – Filter OBJ files
        - **filter_volume** (*boolean**,* *(**optional**)*) – Filter OpenVDB volume files
        - **filter_folder** (*boolean**,* *(**optional**)*) – Filter folders
        - **filter_blenlib** (*boolean**,* *(**optional**)*) – Filter Blender IDs
        - **filemode** (*int in* *[**1**,* *9**]**,* *(**optional**)*) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file
        - **relative_path** (*boolean**,* *(**optional**)*) – Relative Path, Select the file relative to the blend file
        - **display_type** (enum in [`'DEFAULT'`, `'LIST_VERTICAL'`, `'LIST_HORIZONTAL'`, `'THUMBNAIL'`], (optional)) –

          Display Type

          - `DEFAULT`
            Default – Automatically determine display type for files.
          - `LIST_VERTICAL`
            Short List – Display files as short list.
          - `LIST_HORIZONTAL`
            Long List – Display files as a detailed list.
          - `THUMBNAIL`
            Thumbnails – Display files as thumbnails.
        - **sort_method** (*enum in* *[**]**,* *(**optional**)*) – File sorting mode
        - **accuracy** (*int in* *[**1**,* *inf**]**,* *(**optional**)*) – Accuracy, Sample accuracy, important for animation data (the lower the value, the more accurate)
        - **container** (enum in [`'AAC'`, `'AC3'`, `'FLAC'`, `'MATROSKA'`, `'MP2'`, `'MP3'`, `'OGG'`, `'WAV'`], (optional)) –

          Container, File format

          - `AAC`
            AAC – Advanced Audio Coding.
          - `AC3`
            AC3 – Dolby Digital ATRAC 3.
          - `FLAC`
            FLAC – Free Lossless Audio Codec.
          - `MATROSKA`
            MKV – Matroska.
          - `MP2`
            MP2 – MPEG-1 Audio Layer II.
          - `MP3`
            MP3 – MPEG-2 Audio Layer III.
          - `OGG`
            OGG – Xiph.Org Ogg Container.
          - `WAV`
            WAV – Waveform Audio File Format.
        - **codec** (enum in [`'AAC'`, `'AC3'`, `'FLAC'`, `'MP2'`, `'MP3'`, `'PCM'`, `'VORBIS'`], (optional)) –

          Codec, Audio Codec

          - `AAC`
            AAC – Advanced Audio Coding.
          - `AC3`
            AC3 – Dolby Digital ATRAC 3.
          - `FLAC`
            FLAC – Free Lossless Audio Codec.
          - `MP2`
            MP2 – MPEG-1 Audio Layer II.
          - `MP3`
            MP3 – MPEG-2 Audio Layer III.
          - `PCM`
            PCM – Pulse Code Modulation (RAW).
          - `VORBIS`
            Vorbis – Xiph.Org Vorbis Codec.
        - **channels** (enum in [`'MONO'`, `'STEREO'`, `'STEREO_LFE'`, `'SURROUND4'`, `'SURROUND5'`, `'SURROUND51'`, `'SURROUND61'`, `'SURROUND71'`], (optional)) –

          Channels, Audio channel count

          - `MONO`
            Mono – Single audio channel.
          - `STEREO`
            Stereo – Stereo audio channels.
          - `STEREO_LFE`
            Stereo LFE – Stereo with LFE channel.
          - `SURROUND4`
            4 Channels – 4 channel surround sound.
          - `SURROUND5`
            5 Channels – 5 channel surround sound.
          - `SURROUND51`
            5.1 Surround – 5.1 surround sound.
          - `SURROUND61`
            6.1 Surround – 6.1 surround sound.
          - `SURROUND71`
            7.1 Surround – 7.1 surround sound.
        - **format** (enum in [`'U8'`, `'S16'`, `'S24'`, `'S32'`, `'F32'`, `'F64'`], (optional)) –

          Format, Sample format

          - `U8`
            U8 – 8-bit unsigned.
          - `S16`
            S16 – 16-bit signed.
          - `S24`
            S24 – 24-bit signed.
          - `S32`
            S32 – 32-bit signed.
          - `F32`
            F32 – 32-bit floating-point.
          - `F64`
            F64 – 64-bit floating-point.
        - **mixrate** (*int in* *[**8000**,* *192000**]**,* *(**optional**)*) – Sample Rate, Sample rate in samples/s
        - **bitrate** (*int in* *[**32**,* *512**]**,* *(**optional**)*) – Bitrate, Bitrate in kbit/s
        - **split_channels** (*boolean**,* *(**optional**)*) – Split channels, Each channel will be rendered into a mono file

bpy.ops.sound.open(*\**, *filepath=''*, *hide_props_region=True*, *check_existing=False*, *filter_blender=False*, *filter_backup=False*, *filter_image=False*, *filter_movie=True*, *filter_python=False*, *filter_font=False*, *filter_sound=True*, *filter_text=False*, *filter_archive=False*, *filter_btx=False*, *filter_alembic=False*, *filter_usd=False*, *filter_obj=False*, *filter_volume=False*, *filter_folder=True*, *filter_blenlib=False*, *filemode=9*, *relative_path=True*, *show_multiview=False*, *use_multiview=False*, *display_type='DEFAULT'*, *sort_method=''*, *cache=False*, *mono=False*)
:   Load a sound file

    Parameters:
    :   - **filepath** (*string**,* *(**optional**,* *never None**)*) – File Path, Path to file
        - **hide_props_region** (*boolean**,* *(**optional**)*) – Hide Operator Properties, Collapse the region displaying the operator settings
        - **check_existing** (*boolean**,* *(**optional**)*) – Check Existing, Check and warn on overwriting existing files
        - **filter_blender** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_backup** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_image** (*boolean**,* *(**optional**)*) – Filter image files
        - **filter_movie** (*boolean**,* *(**optional**)*) – Filter movie files
        - **filter_python** (*boolean**,* *(**optional**)*) – Filter Python files
        - **filter_font** (*boolean**,* *(**optional**)*) – Filter font files
        - **filter_sound** (*boolean**,* *(**optional**)*) – Filter sound files
        - **filter_text** (*boolean**,* *(**optional**)*) – Filter text files
        - **filter_archive** (*boolean**,* *(**optional**)*) – Filter archive files
        - **filter_btx** (*boolean**,* *(**optional**)*) – Filter btx files
        - **filter_alembic** (*boolean**,* *(**optional**)*) – Filter Alembic files
        - **filter_usd** (*boolean**,* *(**optional**)*) – Filter USD files
        - **filter_obj** (*boolean**,* *(**optional**)*) – Filter OBJ files
        - **filter_volume** (*boolean**,* *(**optional**)*) – Filter OpenVDB volume files
        - **filter_folder** (*boolean**,* *(**optional**)*) – Filter folders
        - **filter_blenlib** (*boolean**,* *(**optional**)*) – Filter Blender IDs
        - **filemode** (*int in* *[**1**,* *9**]**,* *(**optional**)*) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file
        - **relative_path** (*boolean**,* *(**optional**)*) – Relative Path, Select the file relative to the blend file
        - **show_multiview** (*boolean**,* *(**optional**)*) – Enable Multi-View
        - **use_multiview** (*boolean**,* *(**optional**)*) – Use Multi-View
        - **display_type** (enum in [`'DEFAULT'`, `'LIST_VERTICAL'`, `'LIST_HORIZONTAL'`, `'THUMBNAIL'`], (optional)) –

          Display Type

          - `DEFAULT`
            Default – Automatically determine display type for files.
          - `LIST_VERTICAL`
            Short List – Display files as short list.
          - `LIST_HORIZONTAL`
            Long List – Display files as a detailed list.
          - `THUMBNAIL`
            Thumbnails – Display files as thumbnails.
        - **sort_method** (*enum in* *[**]**,* *(**optional**)*) – File sorting mode
        - **cache** (*boolean**,* *(**optional**)*) – Cache, Cache the sound in memory
        - **mono** (*boolean**,* *(**optional**)*) – Mono, Merge all the sound’s channels into one

bpy.ops.sound.open_mono(*\**, *filepath=''*, *hide_props_region=True*, *check_existing=False*, *filter_blender=False*, *filter_backup=False*, *filter_image=False*, *filter_movie=True*, *filter_python=False*, *filter_font=False*, *filter_sound=True*, *filter_text=False*, *filter_archive=False*, *filter_btx=False*, *filter_alembic=False*, *filter_usd=False*, *filter_obj=False*, *filter_volume=False*, *filter_folder=True*, *filter_blenlib=False*, *filemode=9*, *relative_path=True*, *show_multiview=False*, *use_multiview=False*, *display_type='DEFAULT'*, *sort_method=''*, *cache=False*, *mono=True*)
:   Load a sound file as mono

    Parameters:
    :   - **filepath** (*string**,* *(**optional**,* *never None**)*) – File Path, Path to file
        - **hide_props_region** (*boolean**,* *(**optional**)*) – Hide Operator Properties, Collapse the region displaying the operator settings
        - **check_existing** (*boolean**,* *(**optional**)*) – Check Existing, Check and warn on overwriting existing files
        - **filter_blender** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_backup** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_image** (*boolean**,* *(**optional**)*) – Filter image files
        - **filter_movie** (*boolean**,* *(**optional**)*) – Filter movie files
        - **filter_python** (*boolean**,* *(**optional**)*) – Filter Python files
        - **filter_font** (*boolean**,* *(**optional**)*) – Filter font files
        - **filter_sound** (*boolean**,* *(**optional**)*) – Filter sound files
        - **filter_text** (*boolean**,* *(**optional**)*) – Filter text files
        - **filter_archive** (*boolean**,* *(**optional**)*) – Filter archive files
        - **filter_btx** (*boolean**,* *(**optional**)*) – Filter btx files
        - **filter_alembic** (*boolean**,* *(**optional**)*) – Filter Alembic files
        - **filter_usd** (*boolean**,* *(**optional**)*) – Filter USD files
        - **filter_obj** (*boolean**,* *(**optional**)*) – Filter OBJ files
        - **filter_volume** (*boolean**,* *(**optional**)*) – Filter OpenVDB volume files
        - **filter_folder** (*boolean**,* *(**optional**)*) – Filter folders
        - **filter_blenlib** (*boolean**,* *(**optional**)*) – Filter Blender IDs
        - **filemode** (*int in* *[**1**,* *9**]**,* *(**optional**)*) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file
        - **relative_path** (*boolean**,* *(**optional**)*) – Relative Path, Select the file relative to the blend file
        - **show_multiview** (*boolean**,* *(**optional**)*) – Enable Multi-View
        - **use_multiview** (*boolean**,* *(**optional**)*) – Use Multi-View
        - **display_type** (enum in [`'DEFAULT'`, `'LIST_VERTICAL'`, `'LIST_HORIZONTAL'`, `'THUMBNAIL'`], (optional)) –

          Display Type

          - `DEFAULT`
            Default – Automatically determine display type for files.
          - `LIST_VERTICAL`
            Short List – Display files as short list.
          - `LIST_HORIZONTAL`
            Long List – Display files as a detailed list.
          - `THUMBNAIL`
            Thumbnails – Display files as thumbnails.
        - **sort_method** (*enum in* *[**]**,* *(**optional**)*) – File sorting mode
        - **cache** (*boolean**,* *(**optional**)*) – Cache, Cache the sound in memory
        - **mono** (*boolean**,* *(**optional**)*) – Mono, Mixdown the sound to mono

bpy.ops.sound.pack()
:   Pack the sound into the current blend file

bpy.ops.sound.unpack(*\**, *method='USE_LOCAL'*, *id=''*)
:   Unpack the sound to the samples filename

    Parameters:
    :   - **method** (enum in [Unpack Method Items](bpy_types_enum_items/unpack_method_items.html#rna-enum-unpack-method-items), (optional)) – Method, How to unpack
        - **id** (*string**,* *(**optional**,* *never None**)*) – Sound Name, Sound data-block name to unpack

bpy.ops.sound.update_animation_flags()
:   Update animation flags