-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic level offset indexer (currently only working with NoteRes…
…t indexer).
- Loading branch information
Showing
5 changed files
with
206 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
#N canvas 0 22 450 300 10; | ||
#N canvas 266 40 527 284 10; | ||
#X obj 182 29 inlet; | ||
#X obj 115 187 pyext OffsetIndexer Set; | ||
#X msg 61 92 doc; | ||
#X msg 61 119 doc+; | ||
#X msg 61 146 reload; | ||
#X msg 300 108 1; | ||
#X msg 330 108 2; | ||
#X msg 360 108 4; | ||
#X msg 390 108 8; | ||
#X floatatom 270 158 5 0 0 0 - - -, f 5; | ||
#X obj 270 59 inlet; | ||
#X obj 182 124 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144 | ||
-1 -1; | ||
#X obj 182 154 list; | ||
#X obj 182 64 t b l; | ||
#X obj 241 30 inlet; | ||
#X text 282 30 <= Recall previously loaded files.; | ||
#X msg 300 85 0; | ||
#X text 332 85 <= Resets offsets.; | ||
#X connect 0 0 13 0; | ||
#X connect 2 0 1 0; | ||
#X connect 3 0 1 0; | ||
#X connect 4 0 1 0; | ||
#X connect 5 0 9 0; | ||
#X connect 6 0 9 0; | ||
#X connect 7 0 9 0; | ||
#X connect 8 0 9 0; | ||
#X connect 9 0 1 2; | ||
#X connect 10 0 9 0; | ||
#X connect 11 0 12 0; | ||
#X connect 12 0 1 1; | ||
#X connect 13 0 11 0; | ||
#X connect 13 1 12 1; | ||
#X connect 14 0 11 0; | ||
#X connect 16 0 9 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,86 @@ | ||
# -*- coding: utf-8 -*- | ||
# -*- coding: utf-8 -*- | ||
|
||
import sys, os, music21, pandas, requests, vis, pyext | ||
from vis.models.indexed_piece import Importer | ||
|
||
try: | ||
print("OffIndexer.py was loaded.") | ||
except: | ||
print("Loading OffIndexer.py failed.") | ||
|
||
|
||
class Set(pyext._class): | ||
|
||
_inlets = 2 | ||
_outlets = 2 | ||
|
||
def __init__(self, | ||
symbolic_scores=0, | ||
scores_paths=0, | ||
scores_imported=[], | ||
events=5, | ||
df_offset=0): | ||
self.symbolic_scores = symbolic_scores | ||
self.scores_paths = scores_paths | ||
self.scores_imported = scores_imported | ||
self.events = events | ||
self.df_offset = df_offset | ||
|
||
|
||
def _anything_1(self, *symbolic_scores): | ||
|
||
|
||
if(len(symbolic_scores) >= 1): | ||
|
||
try: | ||
|
||
self.scores_paths = [str(x) for x in symbolic_scores] | ||
|
||
for i in range(len(self.scores_paths)): | ||
self.scores_imported.append( | ||
pandas.read_pickle(self.scores_paths[i])) | ||
|
||
# Convert score paths from symbols to strings: | ||
#self.scores_paths = [str(x) for x in symbolic_scores] | ||
|
||
# Create Music21 streams and index them with VIS: | ||
#self.scores_imported = [Importer(x) for x in self.scores_paths] | ||
|
||
#print(self.scores_imported) | ||
|
||
for x, y in zip(self.scores_paths,self.scores_imported): | ||
#self._generate_name(x) | ||
y.columns.set_levels(['Part'], level=0, inplace=True) | ||
y.columns.set_names(['Score','Events'], inplace=True) | ||
print(y.head(self.events).to_csv( | ||
sep='\t', | ||
na_rep='^')) | ||
|
||
except Exception as e: | ||
|
||
print(e) | ||
#self._print_output('not_indexed') | ||
|
||
else: | ||
|
||
#self._print_output('no_scores') | ||
print("...there were no scores...") | ||
|
||
def _anything_2(self, offset): | ||
|
||
self.df_offset = offset | ||
|
||
for x, y in zip(self.scores_paths,self.scores_imported): | ||
#self._generate_name(x) | ||
y.columns.set_levels(['Part'], level=0, inplace=True) | ||
y.columns.set_names(['Score','Events'], inplace=True) | ||
|
||
if(self.df_offset == 0): | ||
print(y.head(self.events).to_csv( | ||
sep='\t', | ||
na_rep='^')) | ||
else: | ||
print(y[::self.df_offset].head(self.events).to_csv( | ||
sep='\t', | ||
na_rep='^')) | ||
|