Example #1
0
def task_transcode(source,
                   media,
                   encoder_id,
                   item_public_id,
                   mime_type,
                   metadata=None):
    # Get or Set transcoding status flag
    item = MediaItem.objects.get(public_id=item_public_id)
    transcoded_flag = MediaItemTranscodingFlag.objects.get(item=item,
                                                           mime_type=mime_type)
    progress_flag, c = MediaItemTranscodingFlag.objects.get_or_create(
        item=item, mime_type=mime_type + '/transcoding')

    progress_flag.value = False
    progress_flag.save()
    # Transcode
    decoder = get_processor('file_decoder')(source)
    encoder = get_processor(encoder_id)(media, streaming=False, overwrite=True)
    if metadata:
        encoder.set_metadata(metadata)
    pipe = decoder | encoder

    progress_flag.value = True
    progress_flag.save()
    pipe.run()

    transcoded_flag.value = True
    transcoded_flag.save()
    progress_flag.delete()
Example #2
0
    def __init__(self):
        """
        Parameters:
        ----------
        """
        super(LabriSing, self).__init__()

        # feature extraction defition
        feature_plan = [
            'mfcc: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12',
            'e: Energy blockSize=480 stepSize=160',
            'mfcc_d1: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12 > Derivate DOrder=1',
            'e_d1: Energy blockSize=480 stepSize=160 > Derivate DOrder=1',
            'mfcc_d2: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12 > Derivate DOrder=2',
            'e_d2: Energy blockSize=480 stepSize=160 > Derivate DOrder=2'
        ]
        self.parents['yaafe'] = get_processor('yaafe')(
            feature_plan=feature_plan, input_samplerate=self.force_samplerate)

        self.parents['aubio_temporal'] = get_processor('aubio_temporal')(
        )  # TF: ici on rajoute AubioTemporal() comme parent

        # these are not really taken into account by the system
        # these are bypassed by yaafe feature plan
        # BUT they are important for aubio (onset detection)
        self.input_blocksize = 1024
        self.input_stepsize = self.input_blocksize // 2
        self.input_samplerate = self.force_samplerate
Example #3
0
def task_transcode(source, media, encoder_id,
                   item_public_id, mime_type,
                   metadata=None):
    # Get or Set transcoding status flag
    item = MediaItem.objects.get(public_id=item_public_id)
    transcoded_flag = MediaItemTranscodingFlag.objects.get(
        item=item,
        mime_type=mime_type)
    progress_flag, c = MediaItemTranscodingFlag.objects.get_or_create(
        item=item,
        mime_type=mime_type + '/transcoding')

    progress_flag.value = False
    progress_flag.save()
    # Transcode
    decoder = get_processor('file_decoder')(source)
    encoder = get_processor(encoder_id)(media,
                                        streaming=False,
                                        overwrite=True)
    if metadata:
        encoder.set_metadata(metadata)
    pipe = decoder | encoder

    progress_flag.value = True
    progress_flag.save()
    pipe.run() 
        
    transcoded_flag.value = True
    transcoded_flag.save()
    progress_flag.delete()
    def __init__(self):
        """
        Parameters:
        ----------
        """
        super(LabriSing, self).__init__()

        # feature extraction defition
        feature_plan = ['mfcc: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12',
                        'e: Energy blockSize=480 stepSize=160',
                        'mfcc_d1: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12 > Derivate DOrder=1',
                        'e_d1: Energy blockSize=480 stepSize=160 > Derivate DOrder=1',
                        'mfcc_d2: MFCC blockSize=480 stepSize=160 MelMinFreq=20 MelMaxFreq=5000 MelNbFilters=22 CepsNbCoeffs=12 > Derivate DOrder=2',
                        'e_d2: Energy blockSize=480 stepSize=160 > Derivate DOrder=2']
        self.parents['yaafe'] = get_processor('yaafe')(feature_plan=feature_plan,
                                                       input_samplerate=self.force_samplerate)

        
        self.parents['aubio_temporal'] =get_processor('aubio_temporal')()  # TF: ici on rajoute AubioTemporal() comme parent


        # these are not really taken into account by the system
        # these are bypassed by yaafe feature plan
        # BUT they are important for aubio (onset detection)
        self.input_blocksize = 1024
        self.input_stepsize = self.input_blocksize // 2
        self.input_samplerate = self.force_samplerate
Example #5
0
    def testOnLevelAnaylyzer(self):
        from timeside.core import get_processor
        from timeside.core.tools.test_samples import samples

        wav_file = samples["C4_scale.wav"]
        decoder = get_processor("file_decoder")(uri=wav_file)
        analyzer = get_processor("level")()
        pipe = decoder | analyzer
        pipe.run()
        self.result = analyzer.results
Example #6
0
    def testOnLevelAnaylyzer(self):
        from timeside.core import get_processor
        from timeside.core.tools.test_samples import samples

        wav_file = samples['C4_scale.wav']
        decoder = get_processor('file_decoder')(uri=wav_file)
        analyzer = get_processor('level')()
        pipe = (decoder | analyzer)
        pipe.run()
        self.result = analyzer.results
Example #7
0
    def tearDown(self):
        decoder = FileDecoder(self.source)

        encoder_cls = get_processor(self.encoder_id)

        file_extension = '.' + encoder_cls.file_extension()

        self.target = tmp_file_sink(prefix=self.__class__.__name__,
                                    suffix=file_extension)
        encoder = encoder_cls(self.target)
        (decoder | encoder).run()

        decoder_encoded = FileDecoder(self.target)

        pipe = ProcessPipe(decoder_encoded)
        pipe.run()

        os.unlink(self.target)

        #print decoder.channels(), decoder.samplerate(), written_frames
        #print media_channels

        if self.test_channels:
            self.assertEqual(decoder.channels(), decoder_encoded.channels())
        else:
            self.assertEqual(2, decoder_encoded.channels())  # voaacenc bug ?

        self.assertEqual(decoder.samplerate(),
                         decoder_encoded.samplerate())

        if self.test_duration:
            self.assertAlmostEqual(decoder.input_duration,
                                   decoder_encoded.input_duration,
                                   delta=0.2)
 def _benchmark_analyzer(self, analyzer_id, benchmark_type='time'):
     analyzer = get_processor(analyzer_id)()
     pipe = (self.decoder | analyzer)
     pipe.run()
     print pipe.results.keys()
     if benchmark_type == 'mem':
         return pipe
Example #9
0
def analyze_speech(nbuffs=1000, use_vad=False):
    decoder = get_processor('live_decoder')(num_buffers=nbuffs, vad=use_vad)
    decoder.output_blocksize = 4096
    decoder.output_samplerate = 8000
    decoder.output_channels = 1

     # apply Hamming with numpy before processing
    featplan = ['lpc: LPC LPCNbCoeffs=12 blockSize=256 stepSize=64',
                'loud: Loudness FFTWindow=Hamming LMode=Total blockSize=256 stepSize=128',
                'autopeaks: Energy blockSize=256 stepSize=128 > AutoCorrelationPeaksIntegrator ACPNbPeaks=3 ACPInterPeakMinDist=3 NbFrames=32 StepNbFrames=8']
#                'magspec: MagnitudeSpectrum blockSize=512 stepSize=128 '
                

    level = get_processor('level')()
    aubio = get_processor('aubio_pitch')(blocksize_s=256, stepsize_s=64)
    yaaf = get_processor('yaafe')(featplan, 8000)
    # irit = get_processor('irit_speech_4hz')()
    # iritgraph = get_processor('grapher_irit_speech_4hz_segments')
    # odf = get_processor('onset_detection_function')()
    # odfgraph = get_processor('grapher_onset_detection_function')()

    pipe = (decoder | aubio | yaaf | level) # | odf | irit)
    pipe.run()
#    print 'Pauses: %s' % str(decoder.pauses)
    print
    loud_mean, loud_std = yaaf.loud_mean(), yaaf.loud_std()
    level_rms, level_max = level.results['level.rms'].data[0], level.results['level.max'].data[0]
    pitch_mean, pitch_std = mean(aubio.results['aubio_pitch.pitch'].data), std(aubio.results['aubio_pitch.pitch'].data)
    syllrate_mean, syllrate_std = yaaf.syll_rate_mean(), yaaf.syll_rate_std()
    fps = yaaf.fp_count

    
    
    print 'Average Loudness = %.1f sons\t(level = %.1f dBFS)' % (yaaf.loud_mean(),
                                                                 level.results['level.rms'].data[0])
    print 'Average articulation rate = %.2f syllables/sec' % (yaaf.syll_rate_mean())
    print 'Total filled pauses: %d' % fps
    return pipe
Example #10
0
def process_wav(wavfile):
    # if not os.path.isdir(OUTPUT_DIR):
    #    os.makedirs(OUTPUT_DIR)

    # TODO: set bit rate for mp3 file to 320kbps
    # TODO: calculate BPM
    decoder = get_processor('file_decoder')(wavfile)

    result_dir = os.path.join(OUTPUT_DIR, decoder.sha1)
    if not os.path.isdir(result_dir):
        os.makedirs(result_dir)

    grapher = get_processor('waveform_simple')()
    analyzer_aubio_temporal = get_processor('aubio_temporal')()
    analyzer_aubio_mfcc = get_processor('aubio_mfcc')()
    encoder = get_processor('mp3_encoder')(os.path.join(result_dir, 'encoded.mp3'))

    pipe = decoder | grapher | analyzer_aubio_temporal | analyzer_aubio_mfcc | encoder
    pipe.run(samplerate=44100)
    grapher.render(os.path.join(result_dir, 'waveform_simple.png'))
    for res_uuid, result in pipe.results.items():
        result_path = os.path.join(result_dir, res_uuid + '.yaml')
        result.to_yaml(result_path)
    def tearDown(self):
        decoder = FileDecoder(self.source)
        encoder_cls = get_processor(self.encoder_id)

        file_extension = '.' + encoder_cls.file_extension()

        self.target_filesink = tmp_file_sink(prefix=self.__class__.__name__,
                                             suffix=file_extension)

        self.target_appsink = tmp_file_sink(prefix=self.__class__.__name__,
                                            suffix=file_extension)

        encoder = encoder_cls(self.target_filesink, streaming=True)
        pipe = (decoder | encoder)

        with open(self.target_appsink, 'w') as f:
            for chunk in pipe.stream():
                f.write(chunk)

        decoder_encoded = FileDecoder(self.target_filesink)

        pipe2 = ProcessPipe(decoder_encoded)
        pipe2.run()

        import os
        filesink_size = os.path.getsize(self.target_filesink)
        appsink_size = os.path.getsize(self.target_appsink)

        os.unlink(self.target_filesink)
        os.unlink(self.target_appsink)
        #print decoder.channels(), decoder.samplerate(), written_frames
        #print media_channels

        if self.test_channels:
            self.assertEqual(decoder.channels(), decoder_encoded.channels())
        else:
            self.assertEqual(2, decoder_encoded.channels())  # voaacenc bug ?

        if not self.expected_sample_rate:
            self.expected_sample_rate = decoder.samplerate()
        self.assertEqual(self.expected_sample_rate,
                         decoder_encoded.samplerate())

        if self.test_duration:
            self.assertAlmostEqual(decoder.input_duration,
                                   decoder_encoded.input_duration,
                                   delta=0.2)
        self.assertAlmostEqual(filesink_size, appsink_size,
                               delta=self.filesize_delta)
Example #12
0
    def tearDown(self):
        decoder = FileDecoder(self.source)
        encoder_cls = get_processor(self.encoder_id)

        file_extension = '.' + encoder_cls.file_extension()

        self.target_filesink = tmp_file_sink(prefix=self.__class__.__name__,
                                             suffix=file_extension)

        self.target_appsink = tmp_file_sink(prefix=self.__class__.__name__,
                                            suffix=file_extension)

        encoder = encoder_cls(self.target_filesink, streaming=True)
        pipe = (decoder | encoder)

        with open(self.target_appsink, 'w') as f:
            for chunk in pipe.stream():
                f.write(chunk)

        decoder_encoded = FileDecoder(self.target_filesink)

        pipe2 = ProcessPipe(decoder_encoded)
        pipe2.run()

        import os
        filesink_size = os.path.getsize(self.target_filesink)
        appsink_size = os.path.getsize(self.target_appsink)

        os.unlink(self.target_filesink)
        os.unlink(self.target_appsink)
        #print decoder.channels(), decoder.samplerate(), written_frames
        #print media_channels

        if self.test_channels:
            self.assertEqual(decoder.channels(), decoder_encoded.channels())
        else:
            self.assertEqual(2, decoder_encoded.channels())  # voaacenc bug ?

        if not self.expected_sample_rate:
            self.expected_sample_rate = decoder.samplerate()
        self.assertEqual(self.expected_sample_rate,
                         decoder_encoded.samplerate())

        if self.test_duration:
            self.assertAlmostEqual(decoder.input_duration,
                                   decoder_encoded.input_duration,
                                   delta=0.2)
        self.assertAlmostEqual(filesink_size, appsink_size,
                               delta=self.filesize_delta)
Example #13
0
def process_wav(wavfile):
    # if not os.path.isdir(OUTPUT_DIR):
    #    os.makedirs(OUTPUT_DIR)

    # TODO: set bit rate for mp3 file to 320kbps
    # TODO: calculate BPM
    decoder = get_processor('file_decoder')(wavfile)

    result_dir = os.path.join(OUTPUT_DIR, decoder.sha1)
    if not os.path.isdir(result_dir):
        os.makedirs(result_dir)

    grapher = get_processor('waveform_simple')()
    analyzer_aubio_temporal = get_processor('aubio_temporal')()
    analyzer_aubio_mfcc = get_processor('aubio_mfcc')()
    encoder = get_processor('mp3_encoder')(os.path.join(
        result_dir, 'encoded.mp3'))

    pipe = decoder | grapher | analyzer_aubio_temporal | analyzer_aubio_mfcc | encoder
    pipe.run(samplerate=44100)
    grapher.render(os.path.join(result_dir, 'waveform_simple.png'))
    for res_uuid, result in pipe.results.items():
        result_path = os.path.join(result_dir, res_uuid + '.yaml')
        result.to_yaml(result_path)
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core.tools.test_samples import samples
from timeside.core import get_processor

FileDecoder = get_processor('file_decoder')
try:
    AubioSpecdesc = get_processor('aubio_specdesc')
except:
    AubioSpecdesc = None


@unittest.skipIf(not AubioSpecdesc, 'Aubio library is not available')
class TestAubioSpecdesc(unittest.TestCase):
    def setUp(self):
        self.analyzer = AubioSpecdesc()

    def testOnSweep(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

    def testOnC4Scale(self):
        "runs on C4 scale"
        self.source = samples["C4_scale.wav"]

    def tearDown(self):
        decoder = FileDecoder(self.source)
        (decoder | self.analyzer).run()
        results = self.analyzer.results
Example #15
0
 def setUp(self):
     self.analyzer = get_processor('aubio_temporal')()
Example #16
0
 def setUp(self):
     self.analyzer_dissonance = get_processor('essentia_dissonance')()
     self.analyzer_dissonance_value = get_processor(
         'essentia_dissonance_value')()
Example #17
0
import timeside
from timeside.core import get_processor

# Define some processors:
file_decoder = get_processor('gst_dec')('sweep.wav')
analyzer = get_processor('level')()
grapher = get_processor('spectrogram_log')()
encoder = get_processor('gst_vorbis_enc')('sweep.ogg')

# Then, the magic pipeline:
(file_decoder | analyzer | grapher | encoder).run()

# Get the results:
grapher.render(output='image.png')
for key in analyzer.results.keys():
    print '%s in %s : %s' % (analyzer.results[key].name,
                             analyzer.results[key].unit,
                             analyzer.results[key].data)
Example #18
0
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core.tools.test_samples import samples
from timeside.core import get_processor

FileDecoder = get_processor('file_decoder')
try:
    AubioMfcc = get_processor('aubio_mfcc')
except:
    AubioMfcc = None


@unittest.skipIf(not AubioMfcc, 'Aubio library is not available')
class TestAubioMfcc(unittest.TestCase):
    def setUp(self):
        self.analyzer = AubioMfcc()

    def testOnSweep(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

    def testOnScale(self):
        "runs on C4 scale"
        self.source = samples["C4_scale.wav"]

    def tearDown(self):
        decoder = FileDecoder(self.source)
        (decoder | self.analyzer).run()
        results = self.analyzer.results
 def setUp(self):
     self.analyzer = get_processor('aubio_melenergy')()
Example #20
0
 def setUp(self):
     self.analyzer = get_processor('loudness_itu')()
Example #21
0
 def setUp(self):
     self.analyzer = get_processor('aubio_pitch')()
Example #22
0
import timeside
from timeside.core import get_processor

# Define some processors:
file_decoder = get_processor('gst_dec')('sweep.wav')
analyzer = get_processor('level')()
grapher = get_processor('spectrogram_log')()
encoder = get_processor('gst_vorbis_enc')('sweep.ogg')

# Then, the magic pipeline:
(file_decoder | analyzer | grapher | encoder).run()

# Get the results:
grapher.render(output='image.png')
for key in analyzer.results.keys():
    print '%s in %s : %s'% (analyzer.results[key].name,
                            analyzer.results[key].unit,
                            analyzer.results[key].data)
Example #23
0
 def setUp(self):
     self.analyzer = get_processor('vamp_tempo')()
 def setUp(self):
     self.analyzer = get_processor('vamp_simple_host')()
Example #25
0
 def setUp(self):
     self.analyzer = get_processor("aubio_mfcc")()
Example #26
0
from __future__ import division
import matplotlib.pylab as pylab
pylab.rcParams['figure.figsize'] = 16, 12  # that's default image size for this interactive session
import timeside
from timeside.core import get_processor

import matplotlib.pyplot as plt
import numpy as np
import sys, os

audiofile = sys.argv[1]
analysis_def = sys.argv[2]

# normal
file_decoder = get_processor('file_decoder')(audiofile, start=10, duration=20)
#e = timeside.encoder.VorbisEncoder('output.ogg', overwrite = True)
aubio_pitch = get_processor('aubio_pitch')()
aubio_temporal = get_processor('aubio_temporal')()
level = get_processor('level')()
specgram_ = get_processor('spectrogram_analyzer')()
waveform = get_processor('waveform_analyzer')()
#g  =  timeside.grapher.Spectrogram()

speech_decoder = get_processor('file_decoder')(audiofile, start=10, duration=20)
speech_decoder.output_blocksize=2048
irit4hz = get_processor('irit_speech_4hz')()
iritEntropy = get_processor('irit_speech_entropy')()
spspecgram_ = get_processor('spectrogram_analyzer')()

#print 'Pitch (etc.) results:\n'
Example #27
0
 def setUp(self):
     self.analyzer = get_processor('vamp_tempo')()
Example #28
0
 def setUp(self):
     self.analyzer = get_processor('vamp_tuning')()
Example #29
0
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core.tools.test_samples import samples
from timeside.core import get_processor

FileDecoder = get_processor('file_decoder')
try:
    AubioPitch = get_processor('aubio_pitch')
except:
    AubioPitch = None


@unittest.skipIf(not AubioPitch, 'Aubio library is not available')
class TestAubioPitch(unittest.TestCase):
    def setUp(self):
        self.analyzer = AubioPitch()

    def testOnSweep(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

    def testOnC4Scale(self):
        "runs on C4 scale"
        self.source = samples["C4_scale.wav"]

    def tearDown(self):
        decoder = FileDecoder(self.source)
        (decoder | self.analyzer).run()
        results = self.analyzer.results
Example #30
0
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core.tools.test_samples import samples
from timeside.core import get_processor

FileDecoder = get_processor('file_decoder')
try:
    Yaafe = get_processor('yaafe')
except Exception:
    Yaafe = None

@unittest.skipIf(not Yaafe, 'Yaafe library is not available')
class TestYaafe(unittest.TestCase):

    def setUp(self):
        self.samplerate = 16000

    def testOnSweepWithFeaturePlan(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

        # Setup Yaafe Analyzer
        # Define Yaafe Feature Plan
        fp = ['mfcc: MFCC blockSize=512 stepSize=256',
              'mfcc_d1: MFCC blockSize=512 stepSize=256 > Derivate DOrder=1',
              'mfcc_d2: MFCC blockSize=512 stepSize=256 > Derivate DOrder=2']

        # Setup a new Yaafe TimeSide analyzer
        # from FeaturePlan
 def setUp(self):
     self.analyzer = get_processor('vamp_constantq')()
Example #32
0
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core import get_processor
from timeside.core.tools.test_samples import samples

FileDecoder = get_processor('file_decoder')
try:
    AubioMelEnergy = get_processor('aubio_melenergy')
except:
    AubioMelEnergy = None


@unittest.skipIf(not AubioMelEnergy, 'Aubio library is not available')
class TestAubioMelEnergy(unittest.TestCase):
    def setUp(self):
        self.analyzer = AubioMelEnergy()

    def testOnSweep(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

    def testOnGuitar(self):
        "runs on C4_scale"
        self.source = samples["C4_scale.wav"]

    def tearDown(self):
        decoder = FileDecoder(self.source)
        (decoder | self.analyzer).run()
        results = self.analyzer.results
Example #33
0
 def setUp(self):
     self.analyzer = get_processor('aubio_mfcc')()
Example #34
0
 def setUp(self):
     self.analyzer = get_processor('vamp_tuning')()
Example #35
0
 def setUp(self):
     self.analyzer = get_processor('aubio_melenergy')()
Example #36
0
 def setUp(self):
     self.gain = 2
     self.fx = get_processor('fx_gain')(gain=self.gain)
     self.level = get_processor('level')()
Example #37
0
    def __init__(self,
                 sad_model='etape',
                 dews=0.2,
                 speech_threshold=1.,
                 dllh_min=-10.,
                 dllh_max=10.,
                 adapt=False,
                 exclude=0.01,
                 keep=0.20):
        """
        Parameters:
        ----------

        sad_model : string bellowing to ['etape', 'maya']
          Allows the selection of trained speech activity detection models.
          * 'etape' models were trained on data distributed in the framework of the
            ETAPE campaign (http://www.afcp-parole.org/etape.html)
            These models are suited for radionews material (0.974 AUC on Etape data)
          * 'maya' models were obtained on data collected by EREA – Centre
            Enseignement et Recherche en Ethnologie Amerindienne
            These models are suited to speech obtained in noisy environments
            (0.915 AUC on Maya data)


        dews: dilatation and erosion window size (seconds)
          This value correspond to the size in seconds of the sliding window
          used to perform a dilation followed by an erosion procedure
          these procedures consist to output the max (respectively the min) of the
          speech detection estimate. The order of these procedures is aimed at removing
          non-speech frames corresponding to fricatives or short pauses
          The size of the windows correspond to the minimal size of the resulting
          speech/non speech segments

        speech_threshold: threshold used for speech/non speech decision
          based on the log likelihood difference

        dllh_min, dllh_max: raw log likelihood difference estimates will be bound
          according this (min_llh_difference, max_llh_difference) tuple
          Usefull for plotting log likelihood differences
          if set to None, no bounding will be done

        adapt: perform unsupervised adaptation of models (bool)

        exclude, keep: ratio of higher/lower LLR-frames to keep for retraining
          speech/non-speech models
        """
        super(LimsiSad, self).__init__()

        # feature extraction defition
        feature_plan = [
            'mfcc: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256',
            'mfccd1: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256 > Derivate DOrder=1',
            'mfccd2: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256 > Derivate DOrder=2',
            'zcr: ZCR blockSize=1024 stepSize=256'
        ]
        yaafe_analyzer = get_processor('yaafe')
        self.parents['yaafe'] = yaafe_analyzer(
            feature_plan=feature_plan, input_samplerate=self.force_samplerate)

        # informative parameters
        # these are not really taken into account by the system
        # these are bypassed by yaafe feature plan
        self.input_blocksize = 1024
        self.input_stepsize = 256

        # load gmm model
        if sad_model not in ['etape', 'maya']:
            raise ValueError(
                "argument sad_model %s not supported. Supported values are 'etape' or 'maya'"
                % sad_model)
        self.sad_model = sad_model
        path = os.path.split(__file__)[0]
        models_dir = os.path.join(path, 'trained_models')
        picfname = os.path.join(models_dir, 'limsi_sad_%s.pkl' % sad_model)
        self.gmms = pickle.load(open(picfname, 'rb'))

        self.dews = dews
        self.speech_threshold = speech_threshold
        self.dllh_min = dllh_min
        self.dllh_max = dllh_max

        self.adapt = adapt
        self.exclude = exclude
        self.keep = keep
Example #38
0
 def setUp(self):
     self.analyzer = get_processor('aubio_specdesc')()
Example #39
0
 def setUp(self):
     self.gain = 2
     self.fx = get_processor('fx_gain')(gain=self.gain)
     self.level = get_processor('level')()
 def setUp(self):
     self.analyzer = get_processor('vamp_simple_host')()
Example #41
0
#! /usr/bin/env python

import unittest
from unit_timeside import TestRunner
from timeside.core.tools.test_samples import samples
from timeside.core import get_processor

FileDecoder = get_processor('file_decoder')
try:
    AubioTemporal = get_processor('aubio_temporal')
except:
    AubioTemporal = None


@unittest.skipIf(not AubioTemporal, 'Aubio library is not available')
class TestAubioTemporal(unittest.TestCase):
    def setUp(self):
        self.analyzer = AubioTemporal()

    def testOnSweep(self):
        "runs on sweep"
        self.source = samples["sweep.wav"]

    def testOnC4Scale(self):
        "runs on C4 scale"
        self.source = samples["C4_scale.wav"]

    def tearDown(self):
        decoder = FileDecoder(self.source)
        (decoder | self.analyzer).run()
        results = self.analyzer.results
Example #42
0
 def setUp(self):
     self.analyzer = get_processor('aubio_specdesc')()
Example #43
0
    def __init__(self, sad_model='etape', dews=0.2, speech_threshold=1.,
                 dllh_min = -10., dllh_max = 10., adapt = False, exclude = 0.01, keep = 0.20):
        """
        Parameters:
        ----------

        sad_model : string bellowing to ['etape', 'maya']
          Allows the selection of trained speech activity detection models.
          * 'etape' models were trained on data distributed in the framework of the
            ETAPE campaign (http://www.afcp-parole.org/etape.html)
            These models are suited for radionews material (0.974 AUC on Etape data)
          * 'maya' models were obtained on data collected by EREA – Centre
            Enseignement et Recherche en Ethnologie Amerindienne
            These models are suited to speech obtained in noisy environments
            (0.915 AUC on Maya data)


        dews: dilatation and erosion window size (seconds)
          This value correspond to the size in seconds of the sliding window
          used to perform a dilation followed by an erosion procedure
          these procedures consist to output the max (respectively the min) of the
          speech detection estimate. The order of these procedures is aimed at removing
          non-speech frames corresponding to fricatives or short pauses
          The size of the windows correspond to the minimal size of the resulting
          speech/non speech segments

        speech_threshold: threshold used for speech/non speech decision
          based on the log likelihood difference

        dllh_min, dllh_max: raw log likelihood difference estimates will be bound
          according this (min_llh_difference, max_llh_difference) tuple
          Usefull for plotting log likelihood differences
          if set to None, no bounding will be done

        adapt: perform unsupervised adaptation of models (bool)

        exclude, keep: ratio of higher/lower LLR-frames to keep for retraining
          speech/non-speech models
        """
        super(LimsiSad, self).__init__()

        # feature extraction defition
        feature_plan = ['mfcc: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256',
                        'mfccd1: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256 > Derivate DOrder=1',
                        'mfccd2: MFCC CepsIgnoreFirstCoeff=0 blockSize=1024 stepSize=256 > Derivate DOrder=2',
                        'zcr: ZCR blockSize=1024 stepSize=256']
        yaafe_analyzer = get_processor('yaafe')
        self.parents['yaafe'] = yaafe_analyzer(feature_plan=feature_plan,
                                                input_samplerate=self.force_samplerate)

        # informative parameters
        # these are not really taken into account by the system
        # these are bypassed by yaafe feature plan
        self.input_blocksize = 1024
        self.input_stepsize = 256

        # load gmm model
        if sad_model not in ['etape', 'maya']:
            raise ValueError(
                "argument sad_model %s not supported. Supported values are 'etape' or 'maya'" % sad_model)
        self.sad_model = sad_model
        path = os.path.split(__file__)[0]
        models_dir = os.path.join(path, 'trained_models')
        picfname = os.path.join(models_dir, 'limsi_sad_%s.pkl' % sad_model)
        self.gmms = pickle.load(open(picfname, 'rb'))

        self.dews = dews
        self.speech_threshold = speech_threshold
        self.dllh_min = dllh_min
        self.dllh_max = dllh_max

        self.adapt = adapt
        self.exclude = exclude
        self.keep = keep
Example #44
0
 def setUp(self):
     self.analyzer = get_processor('vamp_constantq')()
Example #45
0
 def setUp(self):
     self.analyzer = get_processor('aubio_pitch')()