In [1]:
%matplotlib inline
import pylab
pylab.rcParams['figure.figsize'] = (10, 8)
import os
import json
import matplotlib.pyplot as plt
from alignednotemodel.alignednotemodel import AlignedNoteModel
In [2]:
folder = 'ussak--sazsemaisi--aksaksemai----dede_salih_efendi'
pitch_file = os.path.join(folder, 'pitch_corrected.json')
note_file = os.path.join(folder, 'aligned_notes.json')
tonic_file = os.path.join(folder, 'tonic.json')
model_save_file = os.path.join(folder, 'note_models.json')
In [3]:
pitch = json.load(open(pitch_file, 'r'))
aligned_notes = json.load(open(note_file, 'r'))['notes']
tonic_symbol = json.load(open(tonic_file, 'r'))['scoreInformed']['Symbol']
In [4]:
alignedNoteModel = AlignedNoteModel(kernel_width=7.5, step_size = 7.5)
note_models, pitch_distibution, new_tonic = alignedNoteModel.get_models(
pitch, aligned_notes, tonic_symbol)
alignedNoteModel.to_json(note_models, model_save_file)
In [5]:
fig, (ax1, ax2) = alignedNoteModel.plot(note_models, pitch_distibution, aligned_notes, pitch)
plt.show()