asdfang / HarmonizeMe

Web app to make chordal harmony to accompany a user sung input
https://asdfang.pythonanywhere.com
0 stars 0 forks source link

When there are no onsets #5

Closed asdfang closed 7 years ago

asdfang commented 7 years ago

Traceback (most recent call last): File "/Users/asdfang/miniconda2/envs/HarmonizeMe/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/Users/asdfang/miniconda2/envs/HarmonizeMe/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/asdfang/miniconda2/envs/HarmonizeMe/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/asdfang/miniconda2/envs/HarmonizeMe/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/Users/asdfang/miniconda2/envs/HarmonizeMe/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/Users/asdfang/Desktop/YEAR3/17SPRING/399EECSindependentstudy/HarmonizeMe/flasktesting/examples/flask_test.py", line 47, in harmonizeData newdata = processAudioWithHarmonies(audiodata, tonic, mode) File "/Users/asdfang/Desktop/YEAR3/17SPRING/399EECSindependentstudy/HarmonizeMe/flasktesting/examples/flask_test.py", line 99, in processAudioWithHarmonies newaudio = harmonizeme(array, tonic, mode) File "/Users/asdfang/Desktop/YEAR3/17SPRING/399EECSindependentstudy/HarmonizeMe/flasktesting/examples/Harmonizer.py", line 225, in harmonizeme pitchspliced.append(pitchesmelody_verb[0:pitch_indices[0]]) IndexError: list index out of range

asdfang commented 7 years ago

What the problem was: if there were no onsets, then there is nothing in pitch_indices, but I parse it by hardcoding the first segment, this resulting in a list index out of range. To solve it: just return the original audio. Normalize only if the max sample exceeds 1.