# Path: compmusic/extractors/log.py
# class ExtractorAdapter(logging.LoggerAdapter):
#     def set_documentid(self, docid):
#     def set_sourcefileid(self, sfid):
#     def process(self, msg, kwargs):
# def get_logger(modulename, moduleversion=None):


import math
import essentia as es
import essentia.standard as ess
import numpy as np
import scipy.stats as scistats
import parameters as params
from compmusic.extractors import log
    aksharaLocs = np.array([cumscore.argmax()]).astype(int)
    while ((backlink[aksharaLocs[0]] > 0) and (aksharaLocs.size < N)):
        aksharaLocs = np.append(backlink[aksharaLocs[0]], aksharaLocs)
    aksharaLocs = aksharaLocs.astype(int)
    aksharaTimes = ts[aksharaLocs]
    return aksharaLocs, aksharaTimes


##################################################################################
def PreProcessAudio(fname):
    '''
    Pre-process data so that an audio file can be input. Right now, just does nothing. No preprocessing done
    '''
    logger = log.get_logger("rhythm")
    logger.info('Pre-processing audio... [Nothing for now]')
    return True


##################################################################################
def getKritiStartBoundary(onsFn, onsTs):
    logger = log.get_logger("rhythm")
    logger.info('Obtaining Start of piece boundary...')
    peakLocs, peakVals = findpeaks(onsFn, imode='n', pmode='p', wdTol=0, ampTol=0.4, prominence=10.0)
    offsetIndex = peakLocs[0]
    offsetIndex = getNearestIndex(onsTs[offsetIndex] - 3.0, onsTs)  # Start three seconds
    return offsetIndex


##################################################################################
def getOnsetFunctions(fname):

# Path: compmusic/extractors/log.py
# class ExtractorAdapter(logging.LoggerAdapter):
#     def set_documentid(self, docid):
#     def set_sourcefileid(self, sfid):
#     def process(self, msg, kwargs):
# def get_logger(modulename, moduleversion=None):


# Path: compmusic/extractors/rhythmlib/aksharaPulseTrack.py
import math
import essentia as es
import essentia.standard as ess
import numpy as np
import scipy.stats as scistats
import parameters as params
from compmusic.extractors import log

    aksharaLocs = np.array([cumscore.argmax()]).astype(int)
    while ((backlink[aksharaLocs[0]] > 0) and (aksharaLocs.size < N)):
        aksharaLocs = np.append(backlink[aksharaLocs[0]], aksharaLocs)
    aksharaLocs = aksharaLocs.astype(int)
    aksharaTimes = ts[aksharaLocs]
    return aksharaLocs, aksharaTimes


##################################################################################
def PreProcessAudio(fname):
    '''
    Pre-process data so that an audio file can be input. Right now, just does nothing. No preprocessing done
    '''
    logger = log.get_logger("rhythm")
    logger.info('Pre-processing audio... [Nothing for now]')
    return True


##################################################################################
def getKritiStartBoundary(onsFn, onsTs):
    logger = log.get_logger("rhythm")
    logger.info('Obtaining Start of piece boundary...')
    peakLocs, peakVals = findpeaks(onsFn, imode='n', pmode='p', wdTol=0, ampTol=0.4, prominence=10.0)
    offsetIndex = peakLocs[0]
    offsetIndex = getNearestIndex(onsTs[offsetIndex] - 3.0, onsTs)  # Start three seconds
    return offsetIndex


##################################################################################
def getOnsetFunctions(fname):

    logger = log.get_logger("rhythm")