From a8c039899bc0fba9ec1eae88c0a1126b5fa499db Mon Sep 17 00:00:00 2001 From: Maxime LE COZ Date: Tue, 25 Feb 2014 13:09:11 +0100 Subject: [PATCH] New Start session localizer IRIT speech & music detector modified to use frame_adapter --- timeside/analyzer/irit_noise_startSilences.py | 193 ++++++++++++++++++ timeside/analyzer/protoStart.dat | Bin 0 -> 572 bytes timeside/analyzer/protoStart2.dat | Bin 0 -> 329 bytes timeside/analyzer/protoStart3.dat | Bin 0 -> 329 bytes 4 files changed, 193 insertions(+) create mode 100644 timeside/analyzer/irit_noise_startSilences.py create mode 100644 timeside/analyzer/protoStart.dat create mode 100644 timeside/analyzer/protoStart2.dat create mode 100644 timeside/analyzer/protoStart3.dat diff --git a/timeside/analyzer/irit_noise_startSilences.py b/timeside/analyzer/irit_noise_startSilences.py new file mode 100644 index 0000000..2128bbc --- /dev/null +++ b/timeside/analyzer/irit_noise_startSilences.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 Maxime Le Coz + +# This file is part of TimeSide. + +# TimeSide is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# TimeSide is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with TimeSide. If not, see . +# Author: Maxime Le Coz + +from timeside.analyzer.utils import segmentFromValues +from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter +from timeside.analyzer.core import Analyzer +from timeside.analyzer.preprocessors import frames_adapter +from timeside.api import IAnalyzer +from aubio import pitch +import numpy +from scipy.signal import firwin,lfilter +from scipy.ndimage.morphology import binary_opening,binary_closing +import pylab + + + + +class IRITStartSeg(Analyzer): + implements(IAnalyzer) + ''' + Segmentor MOnophony/Polyphony based on the analalysis of yin confidence. + + Properties: + ''' + + @interfacedoc + def setup(self, channels=None, samplerate=None, + blocksize=None, totalframes=None): + + super(IRITStartSeg, self).setup(channels, + samplerate, + blocksize, + totalframes) + lowFreq = 100.0 + + self.input_blocksize = int(0.02 * samplerate) + self.input_stepsize = int(0.008 * samplerate) + + + sr = float(samplerate) + highFreq = sr/2 + f1= lowFreq/sr + f2= highFreq/sr + self.filtre = firwin(10, [f1,f2], pass_zero=False) + self.energy = [] + self.maxenergy = 0.002 + self.min_overlap = 20 + self.threshold = 0.1 + @staticmethod + @interfacedoc + def id(): + return "irit_monopoly" + + @staticmethod + @interfacedoc + def name(): + return "IRIT Monophony / Polyphony classification" + + @staticmethod + @interfacedoc + def unit(): + return "" + + def __str__(self): + return "Labeled Monophonic/Polyphonic segments" + + @frames_adapter + def process(self, frames, eod=False): + ''' + + ''' + + self.energy += [numpy.sqrt(numpy.mean(lfilter(self.filtre,1.0,frames.T[0])**2))] + return frames, eod + + def post_process(self): + ''' + + ''' + self.energy = numpy.array(self.energy)/max(self.energy) + silences = numpy.zeros((1,len(self.energy)))[0] + silences[self.energy= m2 : + fin = numpy.min([l1-decal,l2]) + if fin-decal > min_overlap: + + v1_out = numpy.array(v1[decal:decal+fin]) + v2_out = numpy.array(v2[:fin]) + d = numpy.mean(numpy.abs(v1_out-v2_out)) + else : + v1_out = [0] + v2_out = [1] + d = 1 + else : + return computeDist(v2, v1,min_overlap) + + + return d,v1_out,v2_out + diff --git a/timeside/analyzer/protoStart.dat b/timeside/analyzer/protoStart.dat new file mode 100644 index 0000000000000000000000000000000000000000..463f177e7703b1d01e4c272b5b137150c1f465ae GIT binary patch literal 572 zcmV-C0>k})0%LAL3UL8rZgp*N zc?xc1VRCX|c?xj?O8|vc0b++zaRVqz0ZTW9V{UbAaCr)3ba`-P3ULHg0%kZ%080Uf zQgH<+O9NE_JWftdO8@`=|4RS=|Nlz>bYh8AxB&nFkq#!WgTA>xGmOpRySueNO4O(L z!O5#X-c_`@abmJR{QOwmrD{o`RRyp=qvvi9EuN=8H2W?Ns@bJKc$ntvw}YZT zKbxXh%OR#e|I7hMGzO?YVvM{38(646Dqxa)$*iV7RsD*h9uTHKe~%bMpB$z?)u>#V_eebY^S-h_MEOh;^dhJ~_bDnSH&3TOeg$z=l+>j^ zN*4I(6F#OtYD~t^is+|5No8j`{%@y0^~5Sbd-kb6IB#q(5a+Ewp(^+t4kFk;-G|JF zm5km$`XSbK$8g|3D$$IfBxY= z8c(ylnQh=dJ0aZB$urVF3ledV!NkHpNCf!m^Y6kxsZQc1_QJy{t5a3 literal 0 HcmV?d00001 diff --git a/timeside/analyzer/protoStart2.dat b/timeside/analyzer/protoStart2.dat new file mode 100644 index 0000000000000000000000000000000000000000..3f061271492929fe06ff5240aadd60989fc68ccc GIT binary patch literal 329 zcmZo*O3o|IEvVE>&M!*U%Pq|*$xJLNO049HFG@|$&nqq|DorloDrAJH;>t^b$QCkr zGqi>>Cbb6@GHZAfEFXg{^&&=Eh_STAbE}k^LWX~;BIN{)tL-rml zKVE%)f5?8N-y^kehmPAk literal 0 HcmV?d00001 diff --git a/timeside/analyzer/protoStart3.dat b/timeside/analyzer/protoStart3.dat new file mode 100644 index 0000000000000000000000000000000000000000..718c07d9e68be9bc51663de33d46e47bb69a372b GIT binary patch literal 329 zcmZo*O3o|IEvVE>&M!*U%Pq|*$xJLNO049HFG@|$&nqq|DorloDrAJH;>t^b$QCkr zGqi>>Cbb6@GHZA