Skip to content

Commit

Permalink
Print the estimation in cents #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Mar 31, 2024
1 parent 7350401 commit 13eebc5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/remucs/tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ def howto_shift_pitch(src: Path, opts: RemucsOptions) -> float:
assert hist[0].shape == bins.shape
assert hist[1].shape == edges.shape

a4 = bins[numpy.argmax(hist[0])]
q = opts.a4 / a4
a4 = bins[numpy.argmax(hist[0])]
factor = opts.a4 / a4
cents = round(1200 * numpy.log2(factor))

if not opts.quiet:
click.echo(f'Estimated pitch shifting factor {q} (from {a4} Hz to {opts.a4} Hz)')
click.echo(f'Estimated pitch shifting factor \"-p 0{cents:+d}\" cents (from {a4} Hz to {opts.a4} Hz)')

return q
return factor

0 comments on commit 13eebc5

Please sign in to comment.