medkit.io.medkit_json.audio
===========================

.. py:module:: medkit.io.medkit_json.audio


Functions
---------

.. autoapisummary::

   medkit.io.medkit_json.audio.load_audio_document
   medkit.io.medkit_json.audio.load_audio_documents
   medkit.io.medkit_json.audio.load_audio_anns
   medkit.io.medkit_json.audio.save_audio_document
   medkit.io.medkit_json.audio.save_audio_documents
   medkit.io.medkit_json.audio.save_audio_anns


Module Contents
---------------

.. py:function:: load_audio_document(input_file: str | pathlib.Path, anns_input_file: str | pathlib.Path | None = None, encoding: str | None = 'utf-8') -> medkit.core.audio.AudioDocument

   
   Load a single audio document from JSON.


   :Parameters:

       **input_file** : str or Path
           Path to the medkit-json file containing the document

       **anns_input_file** : str or Path, optional
           Optional medkit-json file containing separate annotations of the
           document.

       **encoding** : str, default="utf-8"
           Optional encoding of `input_file` and `anns_input_file`

   :Returns:

       AudioDocument
           The audio document in the file







   .. seealso::

       
       :obj:`save_audio_document`
           Save a single audio document to JSON.
       
       





   ..
       !! processed by numpydoc !!

.. py:function:: load_audio_documents(input_file: str | pathlib.Path, encoding: str | None = 'utf-8') -> Iterator[medkit.core.audio.AudioDocument]

   
   Load multiple audio documents from JSON.


   :Parameters:

       **input_file** : str or Path
           Path to the medkit-json file containing the documents

       **encoding** : str, default="utf-8"
           Optional encoding of `input_file`

   :Returns:

       iterator of AudioDocument
           An iterator to the audio documents in the file







   .. seealso::

       
       :obj:`save_audio_documents`
           Save multiple audio documents to JSON.
       
       





   ..
       !! processed by numpydoc !!

.. py:function:: load_audio_anns(input_file: str | pathlib.Path, encoding: str | None = 'utf-8') -> Iterator[medkit.core.audio.Segment]

   
   Load audio annotations from JSON.


   :Parameters:

       **input_file** : str or Path
           Path to the medkit-json file containing the annotations

       **encoding** : str, default="utf-8"
           Optional encoding of `input_file`

   :Returns:

       iterator of Segment
           An iterator to the audio annotations in the file







   .. seealso::

       
       :obj:`save_audio_anns`
           Save audio annotations to JSON.
       
       





   ..
       !! processed by numpydoc !!

.. py:function:: save_audio_document(doc: medkit.core.audio.AudioDocument, output_file: str | pathlib.Path, split_anns: bool = False, anns_output_file: str | pathlib.Path | None = None, encoding: str | None = 'utf-8')

   
   Save a single audio document to JSON.


   :Parameters:

       **doc** : AudioDocument
           The audio document to save

       **output_file** : str or Path
           Path of the generated medkit-json file

       **split_anns** : bool, default=False
           If True, the annotations will be saved in a separate medkit-json file
           instead of being included in the main document file

       **anns_output_file** : str or Path, optional
           Path of the medkit-json file storing the annotations if `split_anns` is True.
           If not provided, `output_file` will be used with an extra "_anns" suffix.

       **encoding** : str, default="utf-8"
           Optional encoding of `output_file` and `anns_output_file`








   .. seealso::

       
       :obj:`load_audio_document`
           Load a single audio document from JSON.
       
       





   ..
       !! processed by numpydoc !!

.. py:function:: save_audio_documents(docs: Iterable[medkit.core.audio.AudioDocument], output_file: str | pathlib.Path, encoding: str | None = 'utf-8')

   
   Save multiple audio documents to JSON.


   :Parameters:

       **docs** : iterable of AudioDocument
           The audio documents to save

       **output_file** : str or Path
           Path of the generated medkit-json file

       **encoding** : str, default="utf-8"
           Optional encoding of `output_file`








   .. seealso::

       
       :obj:`load_audio_documents`
           Load multiple audio documents from JSON.
       
       





   ..
       !! processed by numpydoc !!

.. py:function:: save_audio_anns(anns: Iterable[medkit.core.audio.Segment], output_file: str | pathlib.Path, encoding: str | None = 'utf-8')

   
   Save audio annotations to JSON.


   :Parameters:

       **docs** : iterable of Segment
           The audio annotations to save

       **output_file** : str or Path
           Path of the generated medkit-json file

       **encoding** : str, default="utf-8"
           Optional encoding of `output_file`








   .. seealso::

       
       :obj:`load_audio_anns`
           Load audio annotations to JSON.
       
       





   ..
       !! processed by numpydoc !!

