Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -3,16 +3,18 @@ · 2 unmodified lines | |||
| 3 | from aubio import source, tempo | 3 | from aubio import source, tempo |
| 4 | from numpy import median, diff | 4 | from numpy import median, diff |
| 5 | 5 | ||
| 6 | def get_file_bpm(path, params = {}): | 6 | def get_file_bpm(path, params = None): |
| 7 | """ Calculate the beats per minute (bpm) of a given file. | 7 | """ Calculate the beats per minute (bpm) of a given file. |
| 8 | path: path to the file | 8 | path: path to the file |
| 9 | param: dictionary of parameters | 9 | param: dictionary of parameters |
| 10 | """ | 10 | """ |
| 11 | if params == None: | ||
| 12 | params = {} | ||
| 11 | try: | 13 | try: |
| 12 | win_s = params['win_s'] | 14 | win_s = params['win_s'] |
| 13 | samplerate = params['samplerate'] | 15 | samplerate = params['samplerate'] |
| 14 | hop_s = params['hop_s'] | 16 | hop_s = params['hop_s'] |
| 15 | except: | 17 | except KeyError: |
| 16 | """ | 18 | """ |
| 17 | # super fast | 19 | # super fast |
| 18 | samplerate, win_s, hop_s = 4000, 128, 64 | 20 | samplerate, win_s, hop_s = 4000, 128, 64 |