datasource.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Peppy 作者: project-owner 项目源码 文件源码
def get_channel(self, previous_value, new_value):
        """ Prepares signal value depending on the previous one and algorithm. """

        if self.stereo_algorithm == STEREO_ALGORITHM_NEW:
            channel_value = new_value
        elif self.stereo_algorithm == STEREO_ALGORITHM_LOGARITHM:
            if previous_value == 0.0:
                channel_value = 0.0
            else:
                channel_value = 20 * math.log10(new_value/previous_value)
            if channel_value < -20:
                channel_value = -20
            if channel_value > 3:
                channel_value = 3
            channel_value = (channel_value + 20) * (100/23)
        elif self.stereo_algorithm == STEREO_ALGORITHM_AVERAGE:
            channel_value = statistics.mean([previous_value, new_value])    
        return channel_value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号