def computeLowLevel(input_file, pool, startTime, endTime, namespace=''):
    llspace = 'lowlevel.'
    rhythmspace = 'rhythm.'
    if namespace:
        llspace = namespace + '.lowlevel.'
        rhythmspace = namespace + '.rhythm.'

    rgain, sampleRate, downmix = getAnalysisMetadata(pool)
    loader = streaming.EqloudLoader(filename=input_file,
                                    sampleRate=sampleRate,
                                    startTime=startTime,
                                    endTime=endTime,
                                    replayGain=rgain,
                                    downmix=downmix)

    lowlevel.compute(loader.audio, loader.audio, pool, startTime, endTime,
                     namespace)
    essentia.run(loader)

    # check if we processed enough audio for it to be useful, in particular did
    # we manage to get an estimation for the loudness (2 seconds required)
    if not pool.containsKey(llspace + "loudness"):
        INFO('ERROR: File is too short (< 2sec)... Aborting...')
        sys.exit(2)

    numOnsets = len(pool[rhythmspace + 'onset_times'])
    sampleRate = pool['metadata.audio_properties.analysis_sample_rate']
    onset_rate = numOnsets / float(loader.audio.totalProduced()) * sampleRate
    pool.set(rhythmspace + 'onset_rate', onset_rate)
예제 #2
0
def computeLowLevel(input_file, pool, startTime, endTime, namespace=''):
    llspace = 'lowlevel.'
    rhythmspace = 'rhythm.'
    if namespace :
        llspace = namespace + '.lowlevel.'
        rhythmspace = namespace + '.rhythm.'

    rgain, sampleRate, downmix = getAnalysisMetadata(pool)
    loader = streaming.EqloudLoader(filename = input_file,
                                    sampleRate = sampleRate,
                                    startTime = startTime,
                                    endTime = endTime,
                                    replayGain = rgain,
                                    downmix = downmix)

    lowlevel.compute(loader.audio, loader.audio, pool, startTime, endTime, namespace)
    essentia.run(loader)

    # check if we processed enough audio for it to be useful, in particular did
    # we manage to get an estimation for the loudness (2 seconds required)
    if not pool.containsKey(llspace + "loudness"):
        INFO('ERROR: File is too short (< 2sec)... Aborting...')
        sys.exit(2)

    numOnsets = len(pool[rhythmspace + 'onset_times'])
    sampleRate = pool['metadata.audio_properties.analysis_sample_rate']
    onset_rate = numOnsets/float(loader.audio.totalProduced())*sampleRate
    pool.set(rhythmspace + 'onset_rate', onset_rate)
예제 #3
0
def computeMidLevel(input_file, pool, startTime, endTime, namespace=''):
    rgain, sampleRate, downmix = getAnalysisMetadata(pool)
    loader = streaming.EqloudLoader(filename = input_file,
                                    sampleRate = sampleRate,
                                    startTime = startTime,
                                    endTime = endTime,
                                    replayGain = rgain,
                                    downmix = downmix)
    midlevel.compute(loader.audio, pool, startTime, endTime, namespace)
    essentia.run(loader)
def computeMidLevel(input_file, pool, startTime, endTime, namespace=''):
    rgain, sampleRate, downmix = getAnalysisMetadata(pool)
    loader = streaming.EqloudLoader(filename=input_file,
                                    sampleRate=sampleRate,
                                    startTime=startTime,
                                    endTime=endTime,
                                    replayGain=rgain,
                                    downmix=downmix)
    midlevel.compute(loader.audio, pool, startTime, endTime, namespace)
    essentia.run(loader)
def computeMidLevel(input_file, neqPool, eqPool, startTime, endTime, namespace=''):
    rgain, sampleRate, downmix = getAnalysisMetadata(neqPool)
    loader = streaming.EasyLoader(filename = input_file,
                                  sampleRate = sampleRate,
                                  startTime = startTime,
                                  endTime = endTime,
                                  replayGain = rgain,
                                  downmix = downmix)

    eqloud = streaming.EqualLoudness()
    loader.audio >> eqloud.signal
    midlevel.compute(loader.audio, neqPool, startTime, endTime, namespace)
    midlevel.compute(eqloud.signal, eqPool, startTime, endTime, namespace)
    essentia.run(loader)
예제 #6
0
def computeMidLevel(input_file,
                    neqPool,
                    eqPool,
                    startTime,
                    endTime,
                    namespace=''):
    rgain, sampleRate, downmix = getAnalysisMetadata(neqPool)
    loader = streaming.EasyLoader(filename=input_file,
                                  sampleRate=sampleRate,
                                  startTime=startTime,
                                  endTime=endTime,
                                  replayGain=rgain,
                                  downmix=downmix)

    eqloud = streaming.EqualLoudness()
    loader.audio >> eqloud.signal
    midlevel.compute(loader.audio, neqPool, startTime, endTime, namespace)
    midlevel.compute(eqloud.signal, eqPool, startTime, endTime, namespace)
    essentia.run(loader)
def computeLowLevel(input_file, neqPool, eqPool, startTime, endTime, namespace=""):
    llspace = "lowlevel."
    rhythmspace = "rhythm."
    if namespace:
        llspace = namespace + ".lowlevel."
        rhythmspace = namespace + ".rhythm."

    rgain, sampleRate, downmix = getAnalysisMetadata(neqPool)
    loader = streaming.EasyLoader(
        filename=input_file,
        sampleRate=sampleRate,
        startTime=startTime,
        endTime=endTime,
        replayGain=rgain,
        downmix=downmix,
    )

    eqloud = streaming.EqualLoudness()
    loader.audio >> eqloud.signal
    lowlevel.compute(eqloud.signal, loader.audio, neqPool, startTime, endTime, namespace)
    lowlevel.compute(eqloud.signal, eqloud.signal, eqPool, startTime, endTime, namespace)
    essentia.run(loader)

    # check if we processed enough audio for it to be useful, in particular did
    # we manage to get an estimation for the loudness (2 seconds required)
    if not neqPool.containsKey(llspace + "loudness") and not eqPool.containsKey(llspace + "loudness"):
        INFO("ERROR: File is too short (< 2sec)... Aborting...")
        sys.exit(2)

    sampleRate = neqPool["metadata.audio_properties.analysis_sample_rate"]

    numOnsets = len(neqPool[rhythmspace + "onset_times"])
    onset_rate = numOnsets / float(loader.audio.totalProduced()) * sampleRate
    neqPool.set(rhythmspace + "onset_rate", onset_rate)

    numOnsets = len(eqPool[rhythmspace + "onset_times"])
    onset_rate = numOnsets / float(loader.audio.totalProduced()) * sampleRate
    eqPool.set(rhythmspace + "onset_rate", onset_rate)
예제 #8
0
    import replaygain

    opts, args = parse_args()

    if len(args) != 2:
        sys.exit(1)
        cmd = './' + os.path.basename(sys.argv[0]) + ' -h'
        os.system(cmd)
        sys.exit(1)

    startTime = float(opts.startTime)
    endTime = float(opts.endTime)
    pool = essentia.Pool()
    readMetadata(args[0], pool)
    replaygain.compute(args[0], pool, startTime, endTime)
    rgain, sampleRate, downmix = getAnalysisMetadata(pool)

    loader = streaming.EqloudLoader(filename=args[0],
                                    sampleRate=sampleRate,
                                    startTime=startTime,
                                    endTime=endTime,
                                    replayGain=rgain,
                                    downmix=downmix)

    compute(loader.audio,
            loader.audio,
            pool,
            startTime,
            endTime,
            sampleRate=analysisSampleRate)
예제 #9
0
    import replaygain

    opts, args = parse_args()

    if len(args) != 2:
        sys.exit(1)
        cmd = './'+os.path.basename(sys.argv[0])+ ' -h'
        os.system(cmd)
        sys.exit(1)

    startTime = float(opts.startTime)
    endTime=float(opts.endTime)
    pool = essentia.Pool()
    readMetadata(args[0], pool)
    replaygain.compute(args[0], pool, startTime, endTime)
    rgain, sampleRate, downmix = getAnalysisMetadata(pool)

    loader = streaming.EqloudLoader(filename = args[0],
                                    sampleRate = sampleRate,
                                    startTime = startTime,
                                    endTime = endTime,
                                    replayGain = rgain,
                                    downmix = downmix)

    compute(loader.audio, loader.audio, pool, startTime, endTime,
            sampleRate=analysisSampleRate)

    essentia.run(loader)

    # check if we processed enough audio for it to be useful, in particular did
    # we manage to get an estimation for the loudness (2 seconds required)