maialib 1.8.2__cp311-cp311-macosx_10_15_universal2.whl → 1.9.1__cp311-cp311-macosx_10_15_universal2.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.

@@ -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
  ...
@@ -295,8 +295,12 @@ class Chord:
295
295
  ...
296
296
  def isSorted(self) -> bool:
297
297
  ...
298
+ def isSus(self) -> bool:
299
+ ...
298
300
  def isTonal(self, model: typing.Callable[[Chord], bool] = None) -> bool:
299
301
  ...
302
+ def isWholeDiminishedChord(self) -> bool:
303
+ ...
300
304
  def print(self) -> None:
301
305
  ...
302
306
  def printStack(self) -> None:
@@ -427,7 +431,7 @@ class Helper:
427
431
  def freq2midiNote(freq: float, modelo: typing.Callable[[float], int] = None) -> tuple[int, int]:
428
432
  ...
429
433
  @staticmethod
430
- def freq2pitch(freq: float, accType: str = '#') -> tuple[str, int]:
434
+ def freq2pitch(freq: float, accType: str = '') -> tuple[str, int]:
431
435
  ...
432
436
  @staticmethod
433
437
  def frequencies2cents(freq_A: float, freq_B: float) -> int:
@@ -466,6 +470,11 @@ class Helper:
466
470
  def noteType2ticks(noteType: str, divisionsPerQuarterNote: int = 256) -> int:
467
471
  ...
468
472
  @staticmethod
473
+ @typing.overload
474
+ def notes2Intervals(pitches: list[str], firstNoteAsReference: bool = False) -> list[Interval]:
475
+ ...
476
+ @staticmethod
477
+ @typing.overload
469
478
  def notes2Intervals(notes: list[Note], firstNoteAsReference: bool = False) -> list[Interval]:
470
479
  ...
471
480
  @staticmethod
@@ -1402,4 +1411,4 @@ C: ClefSign # value = <ClefSign.C: 2>
1402
1411
  F: ClefSign # value = <ClefSign.F: 1>
1403
1412
  G: ClefSign # value = <ClefSign.G: 0>
1404
1413
  P: ClefSign # value = <ClefSign.P: 3>
1405
- __version__: str = '"1.8.2"'
1414
+ __version__: str = '"1.9.1"'
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) + 1
148
- noteFinish = ((aux + noteDuration) /
149
- measureQuarterTimeAmount) + 1
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(type='linear', autorange=True, showgrid=True,
289
- gridwidth=1, title="Measures")
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", "plotChordDyadsSetharesDissonanceHeatmap"]
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
- List[float]], List[float]]] = None, dissonanceThreshold: float = 0.1, dissonanceDecimalPoint: int = 2) -> Tuple[plotly.graph_objs._figure.Figure, pd.DataFrame]:
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(numPartialsPerNote=numPartialsPerNote, useMinModel=useMinModel, amplCallback=amplCallback)
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(index='baseFreq', columns='targetFreq', values='dissonance')
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
- labels=dict(x="Target Frequency (Hz)", y="Base Frequency (Hz)", color="Dissonance"), color_continuous_scale='Inferno')
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
- # Update x and y ticks to only show unique frequencies and set log scale
325
- fig.update_xaxes(type='log', tickvals=x_ticks, ticktext=roundedXTicksValues)
326
- fig.update_yaxes(type='log', tickvals=y_ticks, ticktext=roundedYTicksValues)
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(title=f'<b>Chord Dyads Sethares Dissonance Heatmap</b><br><i>Chord Dissonance={str(roundedDissonanceValue)}</i>', title_x=0.5)
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
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: maialib
3
- Version: 1.8.2
3
+ Version: 1.9.1
4
4
  Summary: A C++/Python library to manipulate sheet music data
5
5
  Home-page: https://github.com/nyckmaia/maialib
6
6
  Author: Nycholas Maia
@@ -31,6 +31,7 @@ Dynamic: description-content-type
31
31
  Dynamic: home-page
32
32
  Dynamic: keywords
33
33
  Dynamic: license
34
+ Dynamic: license-file
34
35
  Dynamic: project-url
35
36
  Dynamic: requires-dist
36
37
  Dynamic: requires-python
@@ -9,18 +9,18 @@ maialib/xml-scores-examples/Strauss_Also_Sprach_Zarathustra.mxl,sha256=nOQra05RH
9
9
  maialib/xml-scores-examples/Bach_Cello_Suite_1.mxl,sha256=0XGNlcW8o0W7kkeG8j2V_M4eggdOnrxvvvCkpf6x_z4,29622
10
10
  maialib/maiacore/__init__.pyi,sha256=cJfflEKHJ6BPUTlDQt95xZmi2N3zwHJkHEXy27fBd5c,1282
11
11
  maialib/maiacore/__init__.py,sha256=IW7E0LuzAttsn0b37SEthCA0LKuzSgkepSpq8DWExYQ,77
12
- maialib/maiacore/maiacore.cpython-311-darwin.so,sha256=KCHvsbq4qIwPWdQzBdDlVSe9owgIWVJcqASejhPRCvM,7992288
13
- maialib/maiacore/maiacore.pyi,sha256=R_fUKVVS-QrDN55l1k3kb0vjHo92ZmlHZwfrBdQTucM,48067
12
+ maialib/maiacore/maiacore.cpython-311-darwin.so,sha256=NDREM6icoqYo5IVQfkq9xb1FFhTOVz7KlBIa8L5gEFA,8255856
13
+ maialib/maiacore/maiacore.pyi,sha256=O24ef-D3bEU4EMpwl9asJUZDROrHqMqZmRTiBhunQQ0,48404
14
14
  maialib/maiapy/other.pyi,sha256=jEmAc-MDc3iMA2-5hp41RLgNrfBQRMvq-sF2_pexhbo,2163
15
15
  maialib/maiapy/__init__.pyi,sha256=L8YtZYJMw_9TrdejcKs2c5xTbu5WMRwlHhKz6Qzulf8,77
16
16
  maialib/maiapy/__init__.py,sha256=L8YtZYJMw_9TrdejcKs2c5xTbu5WMRwlHhKz6Qzulf8,77
17
17
  maialib/maiapy/other.py,sha256=4LjETHcpDpNRjSYIbMW_9CuRZTymuoAzog_L3CkYDA0,4345
18
- maialib/maiapy/sethares_dissonance.py,sha256=uRQLTQN55dk74hIFpzu9RlTWP0ZhRpVT3yTLI-su1ww,12830
18
+ maialib/maiapy/sethares_dissonance.py,sha256=M1g9IchSEXREPxez5wsSX14Y1yyuAxXbdmXJNLrO00s,12969
19
19
  maialib/maiapy/plots.pyi,sha256=nRNUQ9h9kjJHTdbQt4eXv933MOx7TIztIg-inThglB4,3620
20
- maialib/maiapy/plots.py,sha256=XjGhgQxFw2QfH-8iMvo3OR3gsxpNkOpBBTX_juYM1Js,23153
20
+ maialib/maiapy/plots.py,sha256=sg6W2OjzZNl8vEVy91URn1nFhfrlRHzXoBkvd4hoZXo,23680
21
21
  maialib/maiapy/sethares_dissonance.pyi,sha256=O8D_cYRPCE1K5Zw54ckg3I5frULcBGgs_di_bTOpuBU,3609
22
- maialib-1.8.2.dist-info/RECORD,,
23
- maialib-1.8.2.dist-info/WHEEL,sha256=LQUS7-mk2BHRsce3mafctF01yD34-ifmy0t1ZpgSN1c,115
24
- maialib-1.8.2.dist-info/top_level.txt,sha256=sZWQaa-Up2ba00WpAxBhOLKM6qQYTpUKJMXgSE0Nc48,17
25
- maialib-1.8.2.dist-info/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
26
- maialib-1.8.2.dist-info/METADATA,sha256=BOGGSVuAOtdWVnCgYTgcF8pN1TYi0JnFRLHMzXyOCsw,7304
22
+ maialib-1.9.1.dist-info/RECORD,,
23
+ maialib-1.9.1.dist-info/WHEEL,sha256=Gbb152AOxfNBOfY-AGDpXe-2V6a2OjA7bBYzci1XdfU,115
24
+ maialib-1.9.1.dist-info/top_level.txt,sha256=sZWQaa-Up2ba00WpAxBhOLKM6qQYTpUKJMXgSE0Nc48,17
25
+ maialib-1.9.1.dist-info/METADATA,sha256=v-dPYFfwglnbWCTSQiPwn6VEhehJuLjAtYJqAouJJ7U,7326
26
+ maialib-1.9.1.dist-info/licenses/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-macosx_10_15_universal2
5
5