def convert(self):
notes = []
for i in range(0, self.block_length):
part = self.wave[self.block_size i: self.block_size (i+1)]
pitchs = self.__fourier_transform(part)
note = []
for pitch in pitchs:
note.append(self.__decide_note(pitch))
notes.append(note)
for i in range(1, len(notes)):
if (notes[i]["pitch"] == "_" and notes[i]["pitch"] != notes[i-1]["pitch"] and notes[i]["pitch"] != notes[i+1]["pitch"]):
notes[i]["pitch"] = notes[i-1]["pitch"]
notes[i]["octave"] = notes[i-1]["octave"]
return notes
https://github.com/kookmin-sw/2018-cap1-14/blob/6d680df23de64b0660f337c8a681cc4f8519ead9/src/server/youtube_convertor/note_convertor.py#L15
def convert(self): notes = [] for i in range(0, self.block_length): part = self.wave[self.block_size i: self.block_size (i+1)] pitchs = self.__fourier_transform(part) note = [] for pitch in pitchs: note.append(self.__decide_note(pitch)) notes.append(note)