Exemple #1
0
    def generate_pitch_values(self):
        # Estimate pitch using Crepe (https://pypi.org/project/crepe/)
        print(
            "Estimating pitch values. This will take some time based on the power of your CPU!\n"
            "Using GPU tensorflow will lead to better performance: https://www.tensorflow.org/install/gpu "
        )
        # Generate the paths for the file
        # crepe_cmd = "crepe output/" + os.path.splitext(self.details["song_file"])[0] + "/vocals.wav"
        # Calls the crepe subprocess
        # os.system(crepe_cmd)

        # audio, sr = a2n.audio_from_file("output/" + os.path.splitext(self.details["song_file"])[0] + "/vocals.wav")
        # time, frequency, confidence, activation = crepe.predict(audio, sr, viterbi=True)
        if not os.path.exists("output/" +
                              os.path.splitext(self.details["song_file"])[0] +
                              "/vocals.f0.csv"):
            crepe.process_file(
                "output/" + os.path.splitext(self.details["song_file"])[0] +
                "/vocals.wav",
                "output/" + os.path.splitext(self.details["song_file"])[0])
        else:
            print("Loading pitch values from cache")
        # All heavy data processing has been completed, let us load in the results
        csv_loc = "output/" + os.path.splitext(
            self.details["song_file"])[0] + "/vocals.f0.csv"

        return csv_loc
Exemple #2
0
def test_sweep():
    # this data contains a sine sweep
    file = os.path.join(os.path.dirname(__file__), 'sweep.wav')

    crepe.process_file(file)
    f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv')

    result = np.loadtxt(f0_file, delimiter=',', skiprows=1)

    # it should be confident enough about the presence of pitch in every frame
    assert np.mean(result[:, 2] > 0.5) > 0.98

    # the frequencies should be linear
    assert np.corrcoef(result[:, 1]) > 0.99
Exemple #3
0
def test_sweep():
    # this data contains a sine sweep
    file = os.path.join(os.path.dirname(__file__), 'sweep.wav')

    model = crepe.build_and_load_model()
    crepe.process_file(model, file,
                       crepe.parser.parse_args([file, '--skip-salience']))
    f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv')

    result = np.loadtxt(f0_file, delimiter=',')

    # the result should be confident enough about the presence of pitch in every
    # frame
    assert np.mean(result[:, 2] > 0.5) > 0.99

    # the frequencies should be linear
    assert np.corrcoef(result[:, 1]) > 0.99
Exemple #4
0
def test_sweep():
    crepe.process_file(file)
    verify_f0()
Exemple #5
0
def showTab():
	try:
		analyze.run("./csvFiles/"+lb.get(lb.curselection())[:-3]+"f0.csv")
	except:
		crepe.process_file("./savedRecordings/"+lb.get(lb.curselection()), output="csvFiles",viterbi=True)
		analyze.run("./csvFiles/"+lb.get(lb.curselection())[:-3]+"f0.csv")
Exemple #6
0
def test_sweep_torch():
    crepe.process_file(file, backend='torch')
    verify_f0()