In [1]:
%matplotlib inline
import pylab 
pylab.rcParams['figure.figsize'] = (31.25, 2.6)

import os
import json
from seyiranalyzer.audioseyiranalyzer import AudioSeyirAnalyzer

In [2]:
scorefolder = 'muhayyer--pesrev--devrikebir----tanburi_cemil_bey/'
audiofolder = os.path.join(scorefolder, '132_Muhayyer_Pesrev__Mansur_Ney_')

audiofile = os.path.join(audiofolder, '132_Muhayyer_Pesrev__Mansur_Ney_.mp3')
pitchfile = os.path.join(audiofolder, 'predominantMelody.json')

In [3]:
audioSeyirAnalyzer = AudioSeyirAnalyzer()
pitch = json.load(open(pitchfile, 'r'))['pitch']

# compute number of frames from some simple rules set by the user
duration = pitch[-1][0]
min_num_frames = 40
max_frame_dur = 30
frame_dur = duration/min_num_frames if duration/min_num_frames<=max_frame_dur else max_frame_dur
frame_dur = int(5 * round(float(frame_dur)/5))  # round to 5 seconds

seyir_features = audioSeyirAnalyzer.analyze(pitch, frame_dur = frame_dur, hop_ratio = 0.5)

In [4]:
audioSeyirAnalyzer.plot(seyir_features)



In [5]:
for s in seyir_features:
    print s['time_interval']


[0.0, 5.0]
[0.0, 10.0]
[5.0, 15.0]
[10.0, 20.0]
[15.0, 25.0]
[20.0, 30.0]
[25.0, 35.0]
[30.0, 40.0]
[35.0, 45.0]
[40.0, 50.0]
[45.0, 55.0]
[50.0, 60.0]
[55.0, 65.0]
[60.0, 70.0]
[65.0, 75.0]
[70.0, 80.0]
[75.0, 85.0]
[80.0, 90.0]
[85.0, 95.0]
[90.0, 100.0]
[95.0, 105.0]
[100.0, 110.0]
[105.0, 115.0]
[110.0, 120.0]
[115.0, 125.0]
[120.0, 130.0]
[125.0, 135.0]
[130.0, 140.0]
[135.0, 145.0]
[140.0, 150.0]
[145.0, 155.0]
[150.0, 160.0]
[155.0, 165.0]
[160.0, 170.0]
[165.0, 175.0]
[170.0, 180.0]
[175.0, 185.0]
[180.0, 190.0]
[185.0, 195.0]
[190.0, 200.0]
[195.0, 205.0]
[200.0, 210.0]
[205.0, 215.0]
[210.0, 220.0]
[215.0, 225.0]
[220.0, 230.0]
[225.0, 235.0]
[230.0, 240.0]
[235.0, 245.0]
[240.0, 250.0]
[245.0, 255.0]
[250.0, 260.0]
[255.0, 265.0]
[260.0, 270.0]
[265.0, 275.0]
[270.0, 280.0]
[275.0, 285.0]
[280.0, 290.0]
[285.0, 295.0]
[290.0, 300.0]
[295.0, 305.0]
[300.0, 310.0]
[305.0, 315.0]
[310.0, 320.0]
[315.0, 325.0]
[320.0, 330.0]
[325.0, 335.0]
[330.0, 340.0]
[335.0, 345.0]
[340.0, 350.0]
[345.0, 355.0]
[350.0, 360.0]
[355.0, 365.0]
[360.0, 370.0]
[365.0, 375.0]
[370.0, 380.0]
[375.0, 385.0]
[380.0, 390.0]
[385.0, 395.0]
[390.0, 400.0]
[395.0, 405.0]
[400.0, 410.0]
[405.0, 415.0]
[410.0, 420.0]
[415.0, 425.0]
[420.0, 430.0]
[425.0, 431.64734693877551]
[430.0, 431.64734693877551]

In [8]:
seyir_features[1]


Out[8]:
{'average_pitch': 880.82566155139716,
 'pitch_distribution': <morty.pitchdistribution.PitchDistribution at 0x7fb305578210>,
 'stable_pitches': [{'frequency': 739.9888454232688,
   'value': 0.23511387407779694},
  {'frequency': 793.1004070975306, 'value': 0.866875171661377},
  {'frequency': 891.5115715708599, 'value': 0.9743112921714783},
  {'frequency': 984.9179363127289, 'value': 0.21330717206001282},
  {'frequency': 1002.1339985858885, 'value': 0.3594096601009369},
  {'frequency': 1041.9784416811015, 'value': 0.18532845377922058},
  {'frequency': 1051.045721190556, 'value': 0.19099581241607666}],
 'time_center': 5.0,
 'time_interval': [0.0, 10.0]}