maialib 1.9.0__pp38-pypy38_pp73-win_amd64.whl → 1.9.1__pp38-pypy38_pp73-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maialib might be problematic. Click here for more details.
- maialib/maiacore/Release/maiacore.pyi +9 -4
- maialib/maiacore/Release/maiacore.pypy38-pp73-win_amd64.pyd +0 -0
- maialib/maiapy/plots.py +27 -7
- maialib/maiapy/sethares_dissonance.py +28 -17
- {maialib-1.9.0.dist-info → maialib-1.9.1.dist-info}/METADATA +1 -1
- {maialib-1.9.0.dist-info → maialib-1.9.1.dist-info}/RECORD +9 -9
- {maialib-1.9.0.dist-info → maialib-1.9.1.dist-info}/LICENSE.txt +0 -0
- {maialib-1.9.0.dist-info → maialib-1.9.1.dist-info}/WHEEL +0 -0
- {maialib-1.9.0.dist-info → maialib-1.9.1.dist-info}/top_level.txt +0 -0
|
@@ -50,10 +50,10 @@ class Chord:
|
|
|
50
50
|
def __init__(self) -> None:
|
|
51
51
|
...
|
|
52
52
|
@typing.overload
|
|
53
|
-
def __init__(self, notes: list[Note]) -> None:
|
|
53
|
+
def __init__(self, notes: list[Note], rhythmFigure: RhythmFigure = ...) -> None:
|
|
54
54
|
...
|
|
55
55
|
@typing.overload
|
|
56
|
-
def __init__(self, pitches: list[str]) -> None:
|
|
56
|
+
def __init__(self, pitches: list[str], rhythmFigure: RhythmFigure = ...) -> None:
|
|
57
57
|
...
|
|
58
58
|
def __ne__(self, arg0: Chord) -> bool:
|
|
59
59
|
...
|
|
@@ -431,7 +431,7 @@ class Helper:
|
|
|
431
431
|
def freq2midiNote(freq: float, modelo: typing.Callable[[float], int] = None) -> tuple[int, int]:
|
|
432
432
|
...
|
|
433
433
|
@staticmethod
|
|
434
|
-
def freq2pitch(freq: float, accType: str = '
|
|
434
|
+
def freq2pitch(freq: float, accType: str = '') -> tuple[str, int]:
|
|
435
435
|
...
|
|
436
436
|
@staticmethod
|
|
437
437
|
def frequencies2cents(freq_A: float, freq_B: float) -> int:
|
|
@@ -470,6 +470,11 @@ class Helper:
|
|
|
470
470
|
def noteType2ticks(noteType: str, divisionsPerQuarterNote: int = 256) -> int:
|
|
471
471
|
...
|
|
472
472
|
@staticmethod
|
|
473
|
+
@typing.overload
|
|
474
|
+
def notes2Intervals(pitches: list[str], firstNoteAsReference: bool = False) -> list[Interval]:
|
|
475
|
+
...
|
|
476
|
+
@staticmethod
|
|
477
|
+
@typing.overload
|
|
473
478
|
def notes2Intervals(notes: list[Note], firstNoteAsReference: bool = False) -> list[Interval]:
|
|
474
479
|
...
|
|
475
480
|
@staticmethod
|
|
@@ -1406,4 +1411,4 @@ C: ClefSign # value = <ClefSign.C: 2>
|
|
|
1406
1411
|
F: ClefSign # value = <ClefSign.F: 1>
|
|
1407
1412
|
G: ClefSign # value = <ClefSign.G: 0>
|
|
1408
1413
|
P: ClefSign # value = <ClefSign.P: 3>
|
|
1409
|
-
__version__: str = '"1.9.
|
|
1414
|
+
__version__: str = '"1.9.1"'
|
|
Binary file
|
maialib/maiapy/plots.py
CHANGED
|
@@ -144,9 +144,9 @@ def _score2DataFrame(score: mc.Score, kwargs) -> Tuple[pd.DataFrame, str, str]:
|
|
|
144
144
|
notePitch = currentNote.getPitch()
|
|
145
145
|
|
|
146
146
|
aux = currentTimePosition + internalStaveCurrentTime
|
|
147
|
-
noteStart = (aux / measureQuarterTimeAmount)
|
|
148
|
-
noteFinish = (
|
|
149
|
-
|
|
147
|
+
noteStart = (aux / measureQuarterTimeAmount)
|
|
148
|
+
noteFinish = (aux + noteDuration) / \
|
|
149
|
+
measureQuarterTimeAmount
|
|
150
150
|
|
|
151
151
|
# This plotly timeline function requires the use of these 3 names below: 'Tasks', 'Start' and 'Finish'
|
|
152
152
|
noteData = {
|
|
@@ -285,8 +285,14 @@ def plotPianoRoll(score: mc.Score, **kwargs) -> Tuple[plotly.graph_objs._figure.
|
|
|
285
285
|
d.x = df.delta.tolist()
|
|
286
286
|
|
|
287
287
|
# Update plot layout
|
|
288
|
-
fig.update_xaxes(
|
|
289
|
-
|
|
288
|
+
fig.update_xaxes(
|
|
289
|
+
type='linear',
|
|
290
|
+
range=[1, None], # Fixando limite inferior do eixo X em 1
|
|
291
|
+
showgrid=True,
|
|
292
|
+
gridwidth=1,
|
|
293
|
+
title="Measures"
|
|
294
|
+
)
|
|
295
|
+
|
|
290
296
|
fig.update_yaxes(autorange=True, showgrid=True,
|
|
291
297
|
gridwidth=1, title='Pitch',
|
|
292
298
|
tickvals=[12, 24, 36, 48, 60, 72, 84, 96, 108, 120],
|
|
@@ -539,6 +545,17 @@ def plotScorePitchEnvelope(score: mc.Score, **kwargs) -> Tuple[plotly.graph_objs
|
|
|
539
545
|
fig.update_layout(hovermode='x unified',
|
|
540
546
|
template="plotly_white", yaxis_showticksuffix="all")
|
|
541
547
|
|
|
548
|
+
fig.update_layout(
|
|
549
|
+
legend=dict(
|
|
550
|
+
orientation="h", # Horizontal
|
|
551
|
+
yanchor="bottom", # Ancorar a parte inferior da legenda
|
|
552
|
+
# Colocar a legenda abaixo do gráfico (ajuste conforme necessário)
|
|
553
|
+
y=-0.4,
|
|
554
|
+
xanchor="center", # Centralizar horizontalmente
|
|
555
|
+
x=0.5 # No meio do gráfico
|
|
556
|
+
)
|
|
557
|
+
)
|
|
558
|
+
|
|
542
559
|
fig.add_shape(
|
|
543
560
|
# Rectangle with reference to the plot
|
|
544
561
|
type="rect",
|
|
@@ -634,10 +651,13 @@ def plotChordsNumberOfNotes(score: mc.Score, **kwargs) -> Tuple[plotly.graph_obj
|
|
|
634
651
|
fig.update_xaxes(type='linear', autorange=True, showgrid=True,
|
|
635
652
|
gridwidth=1, title="Measures")
|
|
636
653
|
fig.update_yaxes(autorange=True, showgrid=True,
|
|
637
|
-
gridwidth=1, ticksuffix=" ", title="Number of Notes")
|
|
654
|
+
gridwidth=1, ticksuffix=" ", title="Number of Notes", gridcolor='lightgray')
|
|
638
655
|
fig.update_layout(title_x=0.5, font={
|
|
639
656
|
"size": 14,
|
|
640
|
-
}
|
|
657
|
+
},
|
|
658
|
+
plot_bgcolor='white'
|
|
659
|
+
)
|
|
660
|
+
|
|
641
661
|
fig.add_shape(
|
|
642
662
|
# Rectangle with reference to the plot
|
|
643
663
|
type="rect",
|
|
@@ -6,7 +6,9 @@ import plotly.graph_objects as go
|
|
|
6
6
|
from maialib import maiacore as mc
|
|
7
7
|
from typing import List, Tuple, Callable, Optional
|
|
8
8
|
|
|
9
|
-
__all__ = ["plotSetharesDissonanceCurve", "plotScoreSetharesDissonance",
|
|
9
|
+
__all__ = ["plotSetharesDissonanceCurve", "plotScoreSetharesDissonance",
|
|
10
|
+
"plotChordDyadsSetharesDissonanceHeatmap"]
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
def _dissmeasure(fvec: List[float], amp: List[float], model: str = 'min') -> float:
|
|
12
14
|
"""
|
|
@@ -27,7 +29,7 @@ def _dissmeasure(fvec: List[float], amp: List[float], model: str = 'min') -> flo
|
|
|
27
29
|
freq_amp_dict = {}
|
|
28
30
|
for f, a in zip(fr_sorted, am_sorted):
|
|
29
31
|
freq_amp_dict[f] = freq_amp_dict.get(f, 0) + a
|
|
30
|
-
|
|
32
|
+
|
|
31
33
|
# Extract updated frequencies and amplitudes from the dictionary
|
|
32
34
|
fr_sorted = np.array(list(freq_amp_dict.keys()))
|
|
33
35
|
am_sorted = np.array(list(freq_amp_dict.values()))
|
|
@@ -64,6 +66,7 @@ def _dissmeasure(fvec: List[float], amp: List[float], model: str = 'min') -> flo
|
|
|
64
66
|
|
|
65
67
|
return D, fr_pairs, am_pairs
|
|
66
68
|
|
|
69
|
+
|
|
67
70
|
def plotSetharesDissonanceCurve(fundamentalFreq: float = 440, numPartials: int = 6, ratioLowLimit: float = 1.0, ratioHighLimit: float = 2.3, ratioStepIncrement: float = 0.001, amplCallback: Optional[Callable[[List[float]], List[float]]] = None) -> Tuple[go.Figure, pd.DataFrame]:
|
|
68
71
|
"""
|
|
69
72
|
Compute the Sethares Dissonance Curve of a given base frequency
|
|
@@ -128,7 +131,8 @@ def plotSetharesDissonanceCurve(fundamentalFreq: float = 440, numPartials: int =
|
|
|
128
131
|
tickvals=[n/d for n, d in filtered_intervals],
|
|
129
132
|
ticktext=['{}/{}'.format(n, d) for n, d in filtered_intervals]
|
|
130
133
|
),
|
|
131
|
-
yaxis=dict(showticklabels=True)
|
|
134
|
+
yaxis=dict(showticklabels=True),
|
|
135
|
+
plot_bgcolor='white'
|
|
132
136
|
)
|
|
133
137
|
|
|
134
138
|
fig.add_shape(
|
|
@@ -276,8 +280,9 @@ def plotScoreSetharesDissonance(score: mc.Score, plotType='line', lineShape='lin
|
|
|
276
280
|
|
|
277
281
|
return fig, df
|
|
278
282
|
|
|
283
|
+
|
|
279
284
|
def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote: int = 6, useMinModel: bool = True, amplCallback: Optional[Callable[[
|
|
280
|
-
|
|
285
|
+
List[float]], List[float]]] = None, dissonanceThreshold: float = 0.1, dissonanceDecimalPoint: int = 2) -> Tuple[plotly.graph_objs._figure.Figure, pd.DataFrame]:
|
|
281
286
|
"""Plot chord dyads Sethares dissonance heatmap
|
|
282
287
|
|
|
283
288
|
Args:
|
|
@@ -304,28 +309,34 @@ def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote:
|
|
|
304
309
|
>>> fig, df = plotChordDyadsSetharesDissonanceHeatmap(myChord)
|
|
305
310
|
>>> fig.show()
|
|
306
311
|
"""
|
|
307
|
-
df = chord.getSetharesDyadsDataFrame(
|
|
312
|
+
df = chord.getSetharesDyadsDataFrame(
|
|
313
|
+
numPartialsPerNote=numPartialsPerNote, useMinModel=useMinModel, amplCallback=amplCallback)
|
|
308
314
|
dfFiltered = df[df.dissonance > dissonanceThreshold]
|
|
309
|
-
|
|
310
|
-
# Pivot the dataframe to create a matrix
|
|
311
|
-
matrix_df = dfFiltered.pivot(
|
|
315
|
+
|
|
316
|
+
# Pivot the dataframe to create a matrix with baseFreq on X and targetFreq on Y
|
|
317
|
+
matrix_df = dfFiltered.pivot(
|
|
318
|
+
index='targetFreq', columns='baseFreq', values='dissonance')
|
|
312
319
|
|
|
313
320
|
# Create a heatmap using Plotly
|
|
314
|
-
fig = px.imshow(matrix_df,
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
fig = px.imshow(matrix_df,
|
|
322
|
+
labels=dict(x="Base Frequency (Hz)",
|
|
323
|
+
y="Target Frequency (Hz)", color="Dissonance"),
|
|
324
|
+
color_continuous_scale='Inferno')
|
|
325
|
+
|
|
317
326
|
# Extract unique frequencies for x and y ticks
|
|
318
|
-
x_ticks = sorted(matrix_df.columns.unique())
|
|
319
|
-
y_ticks = sorted(matrix_df.index.unique())
|
|
327
|
+
x_ticks = sorted(matrix_df.columns.unique()) # baseFreq
|
|
328
|
+
y_ticks = sorted(matrix_df.index.unique()) # targetFreq
|
|
320
329
|
|
|
321
330
|
roundedXTicksValues = [round(num, 0) for num in x_ticks]
|
|
322
331
|
roundedYTicksValues = [round(num, 0) for num in y_ticks]
|
|
323
332
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
fig.update_yaxes(type='
|
|
333
|
+
fig.update_xaxes(type='linear', tickvals=x_ticks,
|
|
334
|
+
ticktext=roundedXTicksValues)
|
|
335
|
+
fig.update_yaxes(type='linear', tickvals=y_ticks,
|
|
336
|
+
ticktext=roundedYTicksValues, autorange=True)
|
|
327
337
|
|
|
328
338
|
roundedDissonanceValue = round(df.dissonance.sum(), dissonanceDecimalPoint)
|
|
329
|
-
fig.update_layout(
|
|
339
|
+
fig.update_layout(
|
|
340
|
+
title=f'<b>Chord Dyads Sethares Dissonance Heatmap</b><br><i>Chord Dissonance={str(roundedDissonanceValue)}</i>', title_x=0.5)
|
|
330
341
|
|
|
331
342
|
return fig, dfFiltered
|
|
@@ -3,15 +3,15 @@ maialib/setup.py,sha256=SRFKCV1MVKftVrdnbrjQkL-ee4nR6pzlaURgwSJgqXU,2221
|
|
|
3
3
|
maialib/maiacore/__init__.py,sha256=0sK4fUTlwdUaieWSoGvL11TBkw6BebR2cd-MpYpJn1o,81
|
|
4
4
|
maialib/maiacore/__init__.pyi,sha256=68w5bv3qhq6lEK0JNHSWER9zuyQN8mxJV-y3JayNxNA,1472
|
|
5
5
|
maialib/maiacore/Release/__init__.pyi,sha256=ncPiCbsaSZXZUykVnOw-yqVPbE-I285Kj5moTnKTNCU,84
|
|
6
|
-
maialib/maiacore/Release/maiacore.pyi,sha256=
|
|
7
|
-
maialib/maiacore/Release/maiacore.pypy38-pp73-win_amd64.pyd,sha256=
|
|
6
|
+
maialib/maiacore/Release/maiacore.pyi,sha256=QVaokZgCNtkhHm-x7UnbPoGxKDVjOSU8MeTC-Bo1X4c,49818
|
|
7
|
+
maialib/maiacore/Release/maiacore.pypy38-pp73-win_amd64.pyd,sha256=zUOK1w8tWFq7fhG1KERyNGMa7WbFSlxXpyldQY-vOOY,4594688
|
|
8
8
|
maialib/maiapy/__init__.py,sha256=Kd9D0GBofeJYa6ampk8C47otrr20uwoTYlJlPyMu6fU,80
|
|
9
9
|
maialib/maiapy/__init__.pyi,sha256=Kd9D0GBofeJYa6ampk8C47otrr20uwoTYlJlPyMu6fU,80
|
|
10
10
|
maialib/maiapy/other.py,sha256=Gcxbxp5zWsbYWi8Zd9ikBJPDOAVqm53tj5_KdzAURh4,4484
|
|
11
11
|
maialib/maiapy/other.pyi,sha256=kjn7QULRPrLmGCwj0SJzcuJ544Yo4vpduumq3v9CUzg,2242
|
|
12
|
-
maialib/maiapy/plots.py,sha256=
|
|
12
|
+
maialib/maiapy/plots.py,sha256=d7Uic7eAZqZZHHravS_o2tkF4-AKnK_aob1C9U4DlV0,24356
|
|
13
13
|
maialib/maiapy/plots.pyi,sha256=FCiM2grDLYPqFkyHPG3x0-Y1NbD8L6UfAMWXFMLv5K0,3723
|
|
14
|
-
maialib/maiapy/sethares_dissonance.py,sha256=
|
|
14
|
+
maialib/maiapy/sethares_dissonance.py,sha256=Prxd5R2NN5HOeTbUwKQR5nmLf9hIVotF3oIFpjKZDQE,13311
|
|
15
15
|
maialib/maiapy/sethares_dissonance.pyi,sha256=iBoK28luL78I--NeJMxa-CaOYyG7OuvO6qXH7meTGA0,3680
|
|
16
16
|
maialib/xml-scores-examples/Bach_Cello_Suite_1.mxl,sha256=0XGNlcW8o0W7kkeG8j2V_M4eggdOnrxvvvCkpf6x_z4,29622
|
|
17
17
|
maialib/xml-scores-examples/Beethoven_Symphony_5_mov_1.xml,sha256=GHDk53y0lbR9Ajc-63vHDP2tT1BX0ZWfx9jpFDUU5sU,4947722
|
|
@@ -20,8 +20,8 @@ maialib/xml-scores-examples/Dvorak_Symphony_9_mov_4.mxl,sha256=s7FGUEmFmgcIdmkZ-
|
|
|
20
20
|
maialib/xml-scores-examples/Mahler_Symphony_8_Finale.mxl,sha256=F2-QBKNYjBv_sWT-z4LWi1rX84-P3msxtl-g6joA2FQ,229034
|
|
21
21
|
maialib/xml-scores-examples/Mozart_Requiem_Introitus.mxl,sha256=_wc4hMaPhtgocUoL94uVzfVN3TGb08z8Xa2BL4SHfgA,91112
|
|
22
22
|
maialib/xml-scores-examples/Strauss_Also_Sprach_Zarathustra.mxl,sha256=nOQra05RHHDe_dXFs5WBJG2l9R1KQk64urV7lWYC2vw,18863
|
|
23
|
-
maialib-1.9.
|
|
24
|
-
maialib-1.9.
|
|
25
|
-
maialib-1.9.
|
|
26
|
-
maialib-1.9.
|
|
27
|
-
maialib-1.9.
|
|
23
|
+
maialib-1.9.1.dist-info/LICENSE.txt,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
|
|
24
|
+
maialib-1.9.1.dist-info/METADATA,sha256=FjM-EcGmwzKZE3jI6oUayTumgkWwnLaiAccmpjh9Xg4,7241
|
|
25
|
+
maialib-1.9.1.dist-info/WHEEL,sha256=Ud1iIBeo_0He1fs5taa1TvkeU9XIUeToqiq5pfQ8w5w,106
|
|
26
|
+
maialib-1.9.1.dist-info/top_level.txt,sha256=sZWQaa-Up2ba00WpAxBhOLKM6qQYTpUKJMXgSE0Nc48,17
|
|
27
|
+
maialib-1.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|