infinity-player

infinite jukebox clone using librosa
git clone https://git.ce9e.org/infinity-player.git

commit
b9998c25c62960d25d44599f562502614a0b181d
parent
d3cca0e532f1e3f1c08534b6676af95fc0caf3bb
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-10-20 18:05
tweak probabilities

Diffstat

M player.py 13 +++++++++++++

1 files changed, 13 insertions, 0 deletions


diff --git a/player.py b/player.py

@@ -89,14 +89,27 @@ def compute_buffers(y, beat_frames):
   89    89 
   90    90 
   91    91 def normalize(R, threshold):
   -1    92     n = len(R)
   -1    93 
   92    94     R = enhance_diagonals(R, 0.8, 4)
   93    95 
   -1    96     # scale
   94    97     x_max = R.max()
   95    98     x_min = x_max * threshold
   96    99     y_max = (x_max + 0.5) / 2
   97   100     # print('mapping {},{} to {},{}'.format(x_min, x_max, 0, y_max))
   98   101     R_norm = (R - x_min) / (x_max - x_min) * y_max
   99   102 
   -1   103     # privilege jumps back in order to prolong playing
   -1   104     R *= numpy.ones((n, n)) * 0.9 + numpy.tri(n, k=-1) * 0.1
   -1   105 
   -1   106     # privilege wide jumps
   -1   107     M = numpy.zeros((n, n))
   -1   108     for i in range(1, n):
   -1   109         M += numpy.tri(n, k=-i)
   -1   110         M += numpy.tri(n, k=-i).T
   -1   111     R *= (M / (n - 1)) ** 0.1
   -1   112 
  100   113     return R_norm * (R_norm > 0)
  101   114 
  102   115