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