infinity-player

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

commit
5a8e296961ac8fded52a8b02073971d36b8ab783
parent
f10ad3d5ea7451176238de87d69ce729e18067a4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-10-20 18:00
add plot option

Diffstat

M player.py 14 ++++++++++++++

1 files changed, 14 insertions, 0 deletions


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

@@ -112,11 +112,21 @@ def play(buffers, sample_rate, jumps):
  112   112             i = 0
  113   113 
  114   114 
   -1   115 def plot(R):
   -1   116     import librosa.display
   -1   117     import matplotlib.pyplot as plt
   -1   118 
   -1   119     plt.figure()
   -1   120     librosa.display.specshow(R)
   -1   121     plt.show()
   -1   122 
   -1   123 
  115   124 def parse_args():
  116   125     parser = argparse.ArgumentParser()
  117   126     parser.add_argument('filename')
  118   127     parser.add_argument('-t', '--threshold', type=float, default=0.5)
  119   128     parser.add_argument('-f', '--force', action='store_true')
   -1   129     parser.add_argument('-P', '--plot', action='store_true')
  120   130     return parser.parse_args()
  121   131 
  122   132 
@@ -132,6 +142,10 @@ def main():
  132   142 
  133   143     print('Detected {} jump opportunities on {} beats'.format(
  134   144         jump_count, len(buffers)))
   -1   145 
   -1   146     if args.plot:
   -1   147         plot(R)
   -1   148 
  135   149     print('Playing… (Press Ctrl-C to stop)')
  136   150     play(buffers, sample_rate, jumps)
  137   151