]> git.parisson.com Git - timeside-diadems.git/commitdiff
Enable TimeSide to work without external libraries such as Yafe, Aubio, Vamp
authorThomas Fillon <thomas@parisson.com>
Mon, 14 Apr 2014 21:02:41 +0000 (23:02 +0200)
committerThomas Fillon <thomas@parisson.com>
Mon, 14 Apr 2014 21:02:41 +0000 (23:02 +0200)
Add automatic detection of Yaafe, Aubio and Vamp and add a conditional import of related analyzers in timeside/anaylers/__init__.py

timeside/analyzer/__init__.py
timeside/analyzer/limsi_sad.py

index 27aa32d344913f70c19ae31541a92b4ff2b89b6b..3f5eb52b9eabeb5b38d3ecd46e5a5015d2699519 100644 (file)
@@ -1,17 +1,41 @@
 # -*- coding: utf-8 -*-
 
+# ----- Load external libraries ------
+# Aubio
+try:
+    WITH_AUBIO = True
+    from aubio_temporal import AubioTemporal
+    from aubio_pitch import AubioPitch
+    from aubio_mfcc import *
+    from aubio_melenergy import *
+    from aubio_specdesc import *
+except ImportError:
+    WITH_AUBIO = False
+
+# Yaafe
+try:
+    WITH_YAAFE = True
+    from yaafe import *
+
+except ImportError:
+    WITH_YAAFE = False
+
+# Vamp Plugins
+try:
+    from vamp_plugin import VampSimpleHost
+    VampSimpleHost.SimpleHostProcess(['-v'])
+    WITH_VAMP = True
+except OSError:
+    WITH_VAMP = False
+
+
+# ----- Load timeside analyzers ------
 from level import Level
 from dc import MeanDCShift
-from aubio_temporal import AubioTemporal
-from aubio_pitch import AubioPitch
-from aubio_mfcc import *
-from aubio_melenergy import *
-from aubio_specdesc import *
-from yaafe import *
 from spectrogram import Spectrogram
 from waveform import Waveform
-from vamp_plugin import VampSimpleHost
 from irit_speech_entropy import IRITSpeechEntropy
 from irit_speech_4hz import IRITSpeech4Hz
 from odf import OnsetDetectionFunction
-from limsi_sad import LimsiSad
+if WITH_YAAFE:
+    from limsi_sad import LimsiSad
index 5586aad607089889c2c4425b95b763b5ce96771a..5a5afa03a12c11f54a33ab06a658496c83795375 100644 (file)
@@ -23,8 +23,10 @@ from timeside.core import implements, interfacedoc
 from timeside.analyzer.core import Analyzer
 from timeside.api import IAnalyzer
 import timeside
-from yaafe import Yaafe
-import yaafelib
+from timeside.analyzer import WITH_YAAFE
+if WITH_YAAFE:
+    from yaafe import Yaafe
+    import yaafelib
 import numpy as N
 import pickle
 import os.path