.. index:: pair: class; GVA::AudioEvent .. _doxid-class_g_v_a_1_1_audio_event: class GVA::AudioEvent ===================== .. toctree:: :hidden: Overview ~~~~~~~~ This class represents audio event - object describing audio event detection result (segment) and containing multiple :ref:`Tensor ` objects (inference results) attached by multiple models. For example, it can be audio event with detected speech and converts speech to text. It can be produced by a pipeline with gvaaudiodetect with detection model and gvaspeechtotext element with speechtotext model. Such :ref:`AudioEvent ` will have start and end timestamps filled and will have 2 :ref:`Tensor ` objects attached - 1 :ref:`Tensor ` object with detection result and other with speech to text tensor objectresult. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class AudioEvent { public: // construction :ref:`AudioEvent`(:ref:`GstGVAAudioEventMeta`* meta); // methods :ref:`Segment` :ref:`segment`() const; std::string :ref:`label`() const; double :ref:`confidence`() const; std::vector<:ref:`Tensor`> :ref:`tensors`() const; :ref:`Tensor` :ref:`add_tensor`(const std::string& name); :ref:`Tensor` :ref:`detection`(); int :ref:`label_id`() const; void :ref:`set_label`(std::string label); :ref:`GstGVAAudioEventMeta`* :ref:`_meta`() const; }; .. _details-class_g_v_a_1_1_audio_event: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ This class represents audio event - object describing audio event detection result (segment) and containing multiple :ref:`Tensor ` objects (inference results) attached by multiple models. For example, it can be audio event with detected speech and converts speech to text. It can be produced by a pipeline with gvaaudiodetect with detection model and gvaspeechtotext element with speechtotext model. Such :ref:`AudioEvent ` will have start and end timestamps filled and will have 2 :ref:`Tensor ` objects attached - 1 :ref:`Tensor ` object with detection result and other with speech to text tensor objectresult. Construction ------------ .. index:: pair: function; AudioEvent .. _doxid-class_g_v_a_1_1_audio_event_1ac2248d35a41ef7f1c1ae11d2c7622fb3: .. ref-code-block:: cpp :class: doxyrest-title-code-block AudioEvent(:ref:`GstGVAAudioEventMeta`* meta) Construct :ref:`AudioEvent ` instance from :ref:`GstGVAAudioEventMeta `. After this, :ref:`AudioEvent ` will obtain all tensors (detection & inference results) from :ref:`GstGVAAudioEventMeta `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - meta - :ref:`GstGVAAudioEventMeta ` containing AudioEVent information and tensors Methods ------- .. index:: pair: function; segment .. _doxid-class_g_v_a_1_1_audio_event_1abf8625c18e4410cc302d353d0482501b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Segment` segment() const Get :ref:`Segment ` of :ref:`AudioEvent ` as start and end timestamps, timestamps are presentation time. .. rubric:: Returns: Start and end time of :ref:`AudioEvent ` .. index:: pair: function; label .. _doxid-class_g_v_a_1_1_audio_event_1a0f0dce868b5b24ce4d58f985da21ee82: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string label() const Get :ref:`AudioEvent ` label. .. rubric:: Returns: :ref:`AudioEvent ` label .. index:: pair: function; confidence .. _doxid-class_g_v_a_1_1_audio_event_1a9bf388c2ee9ab5e472e79eb30a0cd81e: .. ref-code-block:: cpp :class: doxyrest-title-code-block double confidence() const Get :ref:`AudioEvent ` detection confidence (set by gvaaudiodetect) .. rubric:: Returns: last added detection :ref:`Tensor ` confidence if exists, otherwise 0.0 .. index:: pair: function; tensors .. _doxid-class_g_v_a_1_1_audio_event_1ab129e5558dd825c252821c899c8fd882: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`Tensor`> tensors() const Get all :ref:`Tensor ` instances added to this :ref:`AudioEvent `. .. rubric:: Returns: vector of :ref:`Tensor ` instances added to this :ref:`AudioEvent ` .. index:: pair: function; add_tensor .. _doxid-class_g_v_a_1_1_audio_event_1a744f70d539ba8f73fec6c19ecbb50048: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Tensor` add_tensor(const std::string& name) Add new tensor (inference result) to this :ref:`AudioEvent ` with name set. To add detection tensor, set name to "detection". .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - name - name for the tensor. If name is set to "detection", detection :ref:`Tensor ` will be created and set for this :ref:`AudioEvent ` .. rubric:: Returns: just created :ref:`Tensor ` object, which can be filled with tensor information further .. index:: pair: function; detection .. _doxid-class_g_v_a_1_1_audio_event_1a2e61091c817a9f66d1f3df7930ebc6aa: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Tensor` detection() Returns detection :ref:`Tensor `, last added to this :ref:`AudioEvent `. As any other :ref:`Tensor `, returned detection :ref:`Tensor ` can contain arbitrary information. If you use :ref:`AudioEvent ` based on :ref:`GstGVAAudioEventMeta ` attached by gvaaudiodetect by default, then this :ref:`Tensor ` will contain "label_id", "confidence", "start_timestamp", "end_timestamp" fields. If :ref:`AudioEvent ` doesn't have detection :ref:`Tensor `, it will be created in-place. .. rubric:: Returns: detection :ref:`Tensor `, empty if there were no detection :ref:`Tensor ` objects added to this :ref:`AudioEvent ` when this method was called .. index:: pair: function; label_id .. _doxid-class_g_v_a_1_1_audio_event_1a4e5c8c89553ef6dec963a56425bd5091: .. ref-code-block:: cpp :class: doxyrest-title-code-block int label_id() const Get label_id from detection :ref:`Tensor `, last added to this :ref:`AudioEvent `. .. rubric:: Returns: last added detection :ref:`Tensor ` label_id if exists, otherwise 0 .. index:: pair: function; set_label .. _doxid-class_g_v_a_1_1_audio_event_1a6436e8da526e7482bf56a1fc716e509b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void set_label(std::string label) Set :ref:`AudioEvent ` label. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - label - Label to set .. index:: pair: function; _meta .. _doxid-class_g_v_a_1_1_audio_event_1afd405cf035d5a84c85a830f14f7f430a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`GstGVAAudioEventMeta`* _meta() const Internal function, don't use or use with caution. .. rubric:: Returns: pointer to underlying :ref:`GstGVAAudioEventMeta `