def JDC(self, wavPath, output, sr=SAMPLE_RATE):
     """<Joint Detection and Classification of Singing Voice Melody Using Convolutional Recurrent Neural Networks>"""
     commands = ("python", "./melodyExtraction_JDC.py", wavPath, output)
     ret = subprocess.call(commands, cwd=ALGO_BASE_DIRS["JDC"])
     assert ret == 0, f"return value: {ret} != 0"
     times, pitches = load_time_series(output, delimiter=r"\s+|,")
     return {"times": times, "pitches": pitches}
Beispiel #2
0
def loadMel(melfile):
    try:
        times, freqs = load_time_series(melfile, delimiter=r'\s+|\t+|,')
    except ValueError:
        cols = load_delimited(melfile, [int, int, str, float, float])
        times, freqs = np.array(cols[0]) / 100., np.array(cols[3])
    return times, freqs
def callOnFile(wav, commands, wavPath, melPath, scKwargs={}):
    '''call <commands> with <wav> write to <wavPath>, then collect results from <melPath>'''
    if not VERBOSE_OUT:
        scKwargs['stdout'] = subprocess.DEVNULL
    if not VERBOSE_ERR:
        scKwargs['stderr'] = subprocess.DEVNULL
    write_wav(wavPath, wav[0], wav[1])
    ret = subprocess.call(commands, **scKwargs)
    assert ret == 0, f'return value: {ret} != 0'
    times, pitches = load_time_series(melPath, delimiter=r'\s+|,')
    return times, pitches
 def SSL(self, wavPath, output, sr=SAMPLE_RATE):
     """<Semi-supervised learning using teacher-student models for vocal melody extraction>"""
     dirname = os.path.dirname(output) + "/"
     output = f"pitch_{os.path.basename(wavPath)}.txt"
     output = os.path.join(dirname, output)
     commands = ("python", "./melodyExtraction_NS.py", "-p", wavPath, "-o", dirname)
     logger.debug(f"SSL commands={commands}")
     ret = subprocess.call(commands, cwd=ALGO_BASE_DIRS["SSL"])
     assert ret == 0, f"return value: {ret} != 0"
     times, pitches = load_time_series(output, delimiter=r"\s+|,")
     return {"times": times, "pitches": pitches}
Beispiel #5
0
 def loadGT(self, GTPath):
     gt = load_time_series(GTPath, delimiter=',')
     return gt
Beispiel #6
0
 def loadGT(self, GTPath):
     gt = load_time_series(GTPath)
     return gt