Skip to main content

Audio specialization of Semantiva framework.

Project description

Semantiva - Audio specialization

Overview

semantiva_audio is the audio specialization of the Semantiva framework. It offers tailored data types and operations for audio operations. This module provides algorithms for processing single-channel and dual-channel audio data. It includes specialized algorithms for both types, as well as utilities for merging dual-channel audio into a single-channel format and expanding single-channel audio into dual-channel.

Installation

This module is available via Pypi:

pip install semantiva_audio

This command should install the package and all its dependencies, including Semantiva itself.


Getting Started: A Minimal Example

Below is a quick demonstration showing how to use the specialization. This assumes that the installation section was completed successfully. In this example, we will create a custom audio algorithm SingleChannelAudioMultiplyAlgorithm, which multiplies single-channel audio data by a given factor.

import numpy as np
from semantiva_audio.audio_data_types import SingleChannelAudioDataType
from semantiva_audio.audio_operations import SingleChannelAudioAlgorithm

class SingleChannelAudioMultiplyAlgorithm(SingleChannelAudioAlgorithm):
    """
    A specialized algorithm to multiply single-channel audio data by a given factor.
    """

    def _operation(self, data, factor):
        self.logger.debug("Inside the SingleChannelAudioMultiplyAlgorithm")
        multiplied_data = data.data * factor
        return SingleChannelAudioDataType(multiplied_data)

# Example usage of SingleChannelAudioMultiplyAlgorithm

# Create an instance of the multiplication algorithm
multiply_algorithm = SingleChannelAudioMultiplyAlgorithm()

# Example input: Single-channel audio data
input_audio = SingleChannelAudioDataType(np.random.rand(1000))

# Define a multiplication factor
factor = 2.0

# Process the data using the algorithm
output_audio = multiply_algorithm(input_audio, factor)

Explanation:

  1. Class Inheritance:

    • SingleChannelAudioMultiplyAlgorithm extends SingleChannelAudioAlgorithm, which defines input/output data types.
  2. Custom Operation:

    • The _operation(data, factor) method multiplies every element in the input audio data by a specified factor.
    • The method takes SingleChannelAudioDataType as input and returns a new instance of the same type.
  3. Usage Example:

    • We create a SingleChannelAudioMultiplyAlgorithm instance.
    • Provide an example single-channel audio input with numerical values.
    • Define a multiplication factor (2.0 in this case).
    • Call _operation(input_audio, factor) to process the data.
    • The modified output is printed, showing the multiplied values.

License

Semantiva is released under the MIT License, promoting collaborative development and broad adoption.

Acknowledgments

This framework draws inspiration from the rigorous demands of transparency and traceability in data-driven systems, particularly exemplified by the ALICE O2 project at CERN. The lessons learned from managing large-scale, high-throughput data in that environment—combined with the need for robust, domain-aligned workflows—shaped Semantiva’s emphasis on type-safe design, semantic clarity, and modular extensibility. By blending these concepts with principles of ontology-driven computing, Semantiva aims to deliver the same level of reliability and interpretability for any domain requiring advanced data processing and HPC integration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semantiva_audio-0.0.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semantiva_audio-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file semantiva_audio-0.0.1.tar.gz.

File metadata

  • Download URL: semantiva_audio-0.0.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.10.12 Linux/6.8.0-1020-azure

File hashes

Hashes for semantiva_audio-0.0.1.tar.gz
Algorithm Hash digest
SHA256 230b92ae4b8cb78099d7db736cba50e4fcd1f2dbf3db335c9564eef70ad29c85
MD5 bd6862b246c1c153ada038bbcf8e6dc5
BLAKE2b-256 6eba2986e8fe3a7f63018a89e7ff61cad77e45aec83c1f067d47bc7c2867401e

See more details on using hashes here.

File details

Details for the file semantiva_audio-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: semantiva_audio-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.10.12 Linux/6.8.0-1020-azure

File hashes

Hashes for semantiva_audio-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6a687bc3d7f6b542f79bf2bb44221fc87027d0cf12c9f102183452d2b3a1f2a
MD5 a960d22359cb406b53623aac23a4595b
BLAKE2b-256 5c9954629b1f6876b45449f69fbd8c5870f6b7cb15d0350f932a388be8561e04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page