Files
iot-logic/src/signal_processor/soundsignalprocessor.py
Torma Kristóf 15f369446c
All checks were successful
continuous-integration/drone/push Build is passing
wire it all together
2020-08-25 01:40:09 +02:00

38 lines
1.0 KiB
Python

#!/usr/bin/env python3
from sensor import SoundSensor
from sender import SoundSender
from preprocessor import SoundPreProcessor
from .abcsignalprocessor import AbcSignalProcessor
"""
Abstract base class for signalprocessor
"""
__author__ = "@tormakris"
__copyright__ = "Copyright 2020, Birbnetes Team"
__module_name__ = "soundsignalprocessor"
__version__text__ = "1"
class SoundSignalProcessor(AbcSignalProcessor):
"""
SoundSignalProcessor class, responsible for handling the sound signal processor pipeline.
"""
def __init__(self):
"""
Create dependency objects.
"""
self.soundsensor = SoundSensor()
self.soundpreprocessor = SoundPreProcessor()
self.soundsender = SoundSender()
def processcurrentsignal(self):
"""
Process a sound sample.
:return:
"""
soundsample_name = self.soundsensor.getvalue()
sample_decision = self.soundpreprocessor.preprocesssignal(soundsample_name)
self.soundsender.sendvalue(soundsample_name, sample_decision)