Source code for deeptone.deeptone

import logging

from deeptone.file_processing import FileProcessing
from deeptone.speaker_recognition import SpeakerRecognition
from deeptone.models.arousal_model import LOW, HIGH, NEUTRAL, NO_SPEECH
from deeptone.models.emotions_model import HAPPY, TIRED, IRRITATED, NEUTRAL as EMO_NEUTRAL
from deeptone.models.gender_model import FEMALE, MALE, UNKNOWN
from deeptone.models.language_model import DE, EN, ES, FR, IT
from deeptone.models.language_model import UNKNOWN as LANG_UNKNOWN
from deeptone.models.base_three_class_speech_model import SPEECH, MUSIC, OTHER, SILENCE
from deeptone.stream_processing import StreamProcessing

# model outputs
AROUSAL_LOW = LOW
AROUSAL_HIGH = HIGH
AROUSAL_NEUTRAL = NEUTRAL
AROUSAL_NO_SPEECH = NO_SPEECH
AROUSAL_SILENCE = SILENCE

GENDER_FEMALE = FEMALE
GENDER_MALE = MALE
GENDER_UNKNOWN = UNKNOWN
GENDER_NO_SPEECH = NO_SPEECH
GENDER_SILENCE = SILENCE

SPEECH_SPEECH = SPEECH
SPEECH_MUSIC = MUSIC
SPEECH_OTHER = OTHER
SPEECH_SILENCE = SILENCE

SPEECH_RT_SPEECH = SPEECH
SPEECH_RT_MUSIC = MUSIC
SPEECH_RT_OTHER = OTHER
SPEECH_RT_SILENCE = SILENCE

EMOTIONS_HAPPY = HAPPY
EMOTIONS_TIRED = TIRED
EMOTIONS_IRRITATED = IRRITATED
EMOTIONS_NEUTRAL = EMO_NEUTRAL
EMOTIONS_NO_SPEECH = NO_SPEECH
EMOTIONS_SILENCE = SILENCE

LANGUAGE_DE = DE
LANGUAGE_EN = EN
LANGUAGE_ES = ES
LANGUAGE_FR = FR
LANGUAGE_IT = IT
LANGUAGE_UNKNOWN = LANG_UNKNOWN
LANGUAGE_NO_SPEECH = NO_SPEECH
LANGUAGE_SILENCE = SILENCE

logger = logging.getLogger(__name__)


[docs]class Deeptone(FileProcessing, StreamProcessing, SpeakerRecognition): """ Entry point for the Deeptone SDK. Once this class is initialized, it provides access to the Deeptone Deep Learning models, which allow you to extract insights from your audio files. Three processing modes are supported: * File Processing: This mode allows you to provide a file to Deeptone, which will provide a time series analysis, \ alongside a summary and list of transitions for the entire file. * Audio Bytes Processing: This mode allows you to provide audio bytes to Deeptone. The output will be the same \ as in the File Processing case. * Stream Processing: This mode allows you to provide a real-time audio stream, which results in a continuous \ analysis, which will periodically generate insights as the stream progresses. Performance Considerations: Initialization of the Deep Learning models that power Deeptone is a time-consuming operation. As such, the initialization process of this class can be costly, and thus, we recommend that instances be long-lived. Thread Safety Considerations: Instances of `Deeptone` are thread-safe. However, the actual inference process is done within a critical section, meaning that performance might be limited when using a single instance across multiple threads. If performance is a critical requirement, youshould either ensure each thread has its own `Deeptone` instance (usage of a pool is recommended). Raises: LicenseManagerError: When the License Key is invalid or cannot be validated """