maialib 1.9.2__cp38-cp38-macosx_10_15_universal2.whl → 1.9.4__cp38-cp38-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.

@@ -1366,10 +1366,10 @@ class ScoreCollection:
1366
1366
  def clear(self) -> None:
1367
1367
  ...
1368
1368
  @typing.overload
1369
- def findMelodyPattern(self, melodyPattern: list[Note], totalIntervalsSimilarityThreshold: float = 0.5, totalRhythmSimilarityThreshold: float = 0.5, intervalsSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, rhythmSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, totalIntervalSimilarityCallback: typing.Callable[[list[float]], float] = None, totalRhythmSimilarityCallback: typing.Callable[[list[float]], float] = None, totalSimilarityCallback: typing.Callable[[float, float], float] = None) -> typing.Any:
1369
+ def findMelodyPatternDataFrame(self, melodyPattern: list[Note], totalIntervalsSimilarityThreshold: float = 0.5, totalRhythmSimilarityThreshold: float = 0.5, intervalsSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, rhythmSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, totalIntervalSimilarityCallback: typing.Callable[[list[float]], float] = None, totalRhythmSimilarityCallback: typing.Callable[[list[float]], float] = None, totalSimilarityCallback: typing.Callable[[float, float], float] = None) -> typing.Any:
1370
1370
  ...
1371
1371
  @typing.overload
1372
- def findMelodyPattern(self, melodyPatterns: list[list[Note]], totalIntervalsSimilarityThreshold: float = 0.5, totalRhythmSimilarityThreshold: float = 0.5, intervalsSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, rhythmSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, totalIntervalSimilarityCallback: typing.Callable[[list[float]], float] = None, totalRhythmSimilarityCallback: typing.Callable[[list[float]], float] = None, totalSimilarityCallback: typing.Callable[[float, float], float] = None) -> typing.Any:
1372
+ def findMelodyPatternDataFrame(self, melodyPatterns: list[list[Note]], totalIntervalsSimilarityThreshold: float = 0.5, totalRhythmSimilarityThreshold: float = 0.5, intervalsSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, rhythmSimilarityCallback: typing.Callable[[list[Note], list[Note]], list[float]] = None, totalIntervalSimilarityCallback: typing.Callable[[list[float]], float] = None, totalRhythmSimilarityCallback: typing.Callable[[list[float]], float] = None, totalSimilarityCallback: typing.Callable[[float, float], float] = None) -> typing.Any:
1373
1373
  ...
1374
1374
  def getDirectoriesPaths(self) -> list[str]:
1375
1375
  ...
@@ -1411,4 +1411,4 @@ C: ClefSign # value = <ClefSign.C: 2>
1411
1411
  F: ClefSign # value = <ClefSign.F: 1>
1412
1412
  G: ClefSign # value = <ClefSign.G: 0>
1413
1413
  P: ClefSign # value = <ClefSign.P: 3>
1414
- __version__: str = '"1.9.2"'
1414
+ __version__: str = '"1.9.4"'
@@ -282,7 +282,8 @@ def plotScoreSetharesDissonance(score: mc.Score, plotType='line', lineShape='lin
282
282
 
283
283
 
284
284
  def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote: int = 6, useMinModel: bool = True, amplCallback: Optional[Callable[[
285
- 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, showValues: bool = False,
286
+ valuesDecimalPlaces: int = 2) -> Tuple[plotly.graph_objs._figure.Figure, pd.DataFrame]:
286
287
  """Plot chord dyads Sethares dissonance heatmap
287
288
 
288
289
  Args:
@@ -295,6 +296,8 @@ def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote:
295
296
  amplCallback: Custom user function callback to generate the amplitude of each spectrum partial
296
297
  dissonanceThreshold (float): Dissonance threshold to skip small dissonance values
297
298
  dissonanceDecimalPoint (int): Round chord dissonance value in the plot title
299
+ showValues (bool): If True, show numerical values inside heatmap cells
300
+ valuesDecimalPlaces (int): Number of decimal places to display in cell values
298
301
 
299
302
  Returns:
300
303
  A list: [Plotly Figure, The plot data as a Pandas Dataframe]
@@ -313,30 +316,61 @@ def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote:
313
316
  numPartialsPerNote=numPartialsPerNote, useMinModel=useMinModel, amplCallback=amplCallback)
314
317
  dfFiltered = df[df.dissonance > dissonanceThreshold]
315
318
 
316
- # Pivot the dataframe to create a matrix with baseFreq on X and targetFreq on Y
319
+ # Pivot para matriz (targetFreq como linhas, baseFreq como colunas)
317
320
  matrix_df = dfFiltered.pivot(
318
- index='targetFreq', columns='baseFreq', values='dissonance')
321
+ index='targetFreq', columns='baseFreq', values='dissonance'
322
+ )
319
323
 
320
- # Create a heatmap using Plotly
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')
324
+ # Reordena linhas e colunas para consistência
325
+ matrix_df = matrix_df.reindex(
326
+ index=sorted(matrix_df.index),
327
+ columns=sorted(matrix_df.columns)
328
+ )
325
329
 
326
- # Extract unique frequencies for x and y ticks
327
- x_ticks = sorted(matrix_df.columns.unique()) # baseFreq
328
- y_ticks = sorted(matrix_df.index.unique()) # targetFreq
330
+ # Índices para o heatmap uniforme
331
+ x_ticks = list(range(len(matrix_df.columns)))
332
+ y_ticks = list(range(len(matrix_df.index)))
329
333
 
330
- roundedXTicksValues = [round(num, 0) for num in x_ticks]
331
- roundedYTicksValues = [round(num, 0) for num in y_ticks]
334
+ # Labels reais (frequências)
335
+ x_labels = [round(v, 0) for v in matrix_df.columns]
336
+ y_labels = [round(v, 0) for v in matrix_df.index]
332
337
 
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)
338
+ # Formatação do texto (caso showValues=True)
339
+ if showValues:
340
+ text_format = f".{valuesDecimalPlaces}f"
341
+ else:
342
+ text_format = False
343
+
344
+ # Criar heatmap com quadrados iguais
345
+ fig = px.imshow(
346
+ matrix_df.values,
347
+ labels=dict(x="Base Frequency (Hz)",
348
+ y="Target Frequency (Hz)", color="Dissonance"),
349
+ color_continuous_scale="Inferno",
350
+ origin="lower", # força o eixo Y a começar por baixo
351
+ text_auto=text_format
352
+ )
337
353
 
354
+ # Ajusta ticks para mostrar frequências reais
355
+ fig.update_xaxes(
356
+ tickmode="array",
357
+ tickvals=x_ticks,
358
+ ticktext=x_labels
359
+ )
360
+ fig.update_yaxes(
361
+ tickmode="array",
362
+ tickvals=y_ticks,
363
+ ticktext=y_labels,
364
+ )
365
+
366
+ # Mantém os quadrados sempre iguais
367
+ fig.update_yaxes(scaleanchor="x", scaleratio=1)
368
+
369
+ # Título
338
370
  roundedDissonanceValue = round(df.dissonance.sum(), dissonanceDecimalPoint)
339
371
  fig.update_layout(
340
- title=f'<b>Chord Dyads Sethares Dissonance Heatmap</b><br><i>Chord Dissonance={str(roundedDissonanceValue)}</i>', title_x=0.5)
372
+ title=f'<b>Chord Dyads Sethares Dissonance Heatmap</b><br><i>Chord Dissonance={roundedDissonanceValue}</i>',
373
+ title_x=0.5
374
+ )
341
375
 
342
376
  return fig, dfFiltered
@@ -42,7 +42,7 @@ def plotScoreSetharesDissonance(score: mc.Score, plotType: str = 'line', lineSha
42
42
  >>> ml.plotScoreSetharesDissonance(myScore, numPoints=15)
43
43
  >>> ml.plotScoreSetharesDissonance(myScore, measureStart=10, measureEnd=20)
44
44
  '''
45
- def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote: int = 6, useMinModel: bool = True, amplCallback: Callable[[list[float]], list[float]] | None = None, dissonanceThreshold: float = 0.1, dissonanceDecimalPoint: int = 2) -> tuple[plotly.graph_objs._figure.Figure, pd.DataFrame]:
45
+ def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote: int = 6, useMinModel: bool = True, amplCallback: Callable[[list[float]], list[float]] | None = None, dissonanceThreshold: float = 0.1, dissonanceDecimalPoint: int = 2, showValues: bool = False, valuesDecimalPlaces: int = 2) -> tuple[plotly.graph_objs._figure.Figure, pd.DataFrame]:
46
46
  '''Plot chord dyads Sethares dissonance heatmap
47
47
 
48
48
  Args:
@@ -55,6 +55,8 @@ def plotChordDyadsSetharesDissonanceHeatmap(chord: mc.Chord, numPartialsPerNote:
55
55
  amplCallback: Custom user function callback to generate the amplitude of each spectrum partial
56
56
  dissonanceThreshold (float): Dissonance threshold to skip small dissonance values
57
57
  dissonanceDecimalPoint (int): Round chord dissonance value in the plot title
58
+ showValues (bool): If True, show numerical values inside heatmap cells
59
+ valuesDecimalPlaces (int): Number of decimal places to display in cell values
58
60
 
59
61
  Returns:
60
62
  A list: [Plotly Figure, The plot data as a Pandas Dataframe]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maialib
3
- Version: 1.9.2
3
+ Version: 1.9.4
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
@@ -28,12 +28,13 @@ Requires-Dist: nbformat
28
28
 
29
29
  ![Maialib CI/CD](https://github.com/nyckmaia/maialib/actions/workflows/wheels.yml/badge.svg)
30
30
 
31
- This library is a multiplatform set of musical tools that enable musical score analisys and composition in a easy and fast way. <br>
32
- The project **core** was wrote in `C++17`, but it also has a `Python` wrapper that allows a greater number of people (ie musicians not trained in IT) to also have in their hands the same power and musical tools available in `maialib`.
31
+ This library is a multiplatform set of musical tools that enable musical score analysis and composition in an easy and fast way. <br>
32
+ The project **maiacore** was written in `C++17`, but it also has a `Python` wrapper that allows a greater number of people (i.e. musicians not trained in IT) to also have in their hands the same power and musical tools available in `maialib`.<br><br>
33
+ **IMPORTANT: The maialib Python package includes all maiacore classes and functions and some additional other pure python functions. This website covers the maiacore-only classes and functions documentation, which are also present inside the maialib python package.<br>We hope to add documentation of functions written in Python to this site in the future, so that we can have complete documentation of maialib.**
33
34
 
34
35
  ## Advantages
35
36
 
36
- - Easy to use to musicians and musical researchers
37
+ - Easy to use to by musicians and musical researchers
37
38
  - High computer perfomance and fast calculations
38
39
  - Read and write musical scores (MusicXML file format)
39
40
 
@@ -43,7 +44,7 @@ The project **core** was wrote in `C++17`, but it also has a `Python` wrapper th
43
44
  pip install maialib
44
45
  ```
45
46
 
46
- Or, if you have a older `maialib` version installed on your system, please get the latest version running: `pip install maialib --upgrade`
47
+ Or, if you have an older `maialib` version installed on your system, please get the latest version running: `pip install maialib --upgrade`
47
48
 
48
49
  ## Get Started
49
50
 
@@ -74,16 +75,23 @@ You can easily export your music files to these file formats above from score ed
74
75
  - Finale
75
76
  - Others
76
77
 
77
- Many `MusicXML` files are avaliable for free in the internet for download.
78
+ Many `MusicXML` files are avaliable for free in the Internet for download.
78
79
 
79
80
  ### 2) What can I do if I don't have a `*.xml` file of my target music?
80
81
 
81
- - First, make shure and look at different websites and online repositories trying to find the `*.xml` file
82
- - You can find on the internet the desired MIDI file and import it in a score editor (like MuseScore, Sibelius, Finale, etc.) and then export the `MusicXML` file from it
83
- - You can use scan the sheet music paper and get a PDF version of it, so:
84
- - You can use a OMR software to try to convert the PDF file into a `*.xml` file
85
- - You can pay for other people to type manually note-by-note the PDF into a musical software (link MuseScore, Sibelius, Finale, etc.)
86
- - You can type manually note-by-note the music paper into a musical software (link MuseScore, Sibelius, Finale, etc.)
82
+ - First, make sure, and look at different websites and online repositories trying to find the `*.xml` (or `*.musicxml` or `*.mxl`) file.
83
+ - After that, you can try these 4 options below:
84
+ - Find on the internet the desired MIDI file and import it in a score editor (like MuseScore, Sibelius, Finale, etc.) and then export the `MusicXML` file from it
85
+ - Scan the sheet music paper and get a PDF version of it, and after that, use a OMR software to try to convert the PDF file into a `*.xml` file:
86
+ - [MuseScore Import - Experimental](https://musescore.com/import)
87
+ - [ACE Studio PDF to MusicXML Converter](https://acestudio.ai/pdf-to-musicxml/)
88
+ - [Sibelius PhotoScore](https://www.avid.com/photoscore-and-notateme-lite)
89
+ - [ScanScore](https://scan-score.com/en/)
90
+ - [SmartScore 64 NE](https://www.musitek.com/)
91
+ - [Melogen AI](https://melogenai.com/)
92
+ - [PDFtoMusic](https://www.myriad-online.com/en/products/pdftomusic.htm)
93
+ - Pay for other people to type manually note-by-note the PDF into a musical software (link MuseScore, Sibelius, Finale, etc.)
94
+ - Type manually note-by-note the music paper into a musical software (link MuseScore, Sibelius, Finale, etc.)
87
95
 
88
96
  ## Documentation (in development)
89
97
 
@@ -96,7 +104,7 @@ This project have 2 documentation levels. One for each user type:
96
104
 
97
105
  You can explore `maialib` features looking at `python-tutorial` folder ([link here](https://github.com/nyckmaia/maialib/tree/main/python-tutorial)). <br>
98
106
  There you will learn how to use and mix `maialib` classes and functions to reach your musical goals
99
- If you are starting, please check these 3 basic `maialib` Python tutorials:
107
+ If you are starting out, please check these 3 basic `maialib` Python tutorials:
100
108
 
101
109
  - [Create Notes and Chords](https://github.com/nyckmaia/maialib/blob/main/python-tutorial/create_notes_chords.ipynb)
102
110
  - [Create a Score](https://github.com/nyckmaia/maialib/blob/main/python-tutorial/create_score.ipynb)
@@ -109,7 +117,7 @@ If you are starting, please check these 3 basic `maialib` Python tutorials:
109
117
  ## VS Code Users
110
118
 
111
119
  - You can write your Python scripts using `*.py` or `*.ipynb` file extensions.
112
- - If you decide to use `*.ipynb` extension, make shure to install `nbformat` Python package to enable visualize maialib graphs on VS Code editor.
120
+ - If you decide to use `*.ipynb` extension, make sure to install `nbformat` Python package to enable visualize maialib graphs on VS Code editor.
113
121
  To do that: `pip install nbformat --upgrade`
114
122
 
115
123
  ---
@@ -182,7 +190,7 @@ Nycholas Maia - nyckmaia@gmail.com
182
190
  ## Contributing
183
191
 
184
192
  - Fork this project
185
- - Make your custumizations and improvments
193
+ - Make your custumizations and improvements
186
194
  - Please, send me a pull request
187
195
 
188
196
  ## License
@@ -1,8 +1,8 @@
1
- maialib-1.9.2.dist-info/RECORD,,
2
- maialib-1.9.2.dist-info/WHEEL,sha256=cBy-JNWg3y6KmLE-K2kxS_UNVKfvgmw6eBcsGF4eLP4,113
3
- maialib-1.9.2.dist-info/top_level.txt,sha256=sZWQaa-Up2ba00WpAxBhOLKM6qQYTpUKJMXgSE0Nc48,17
4
- maialib-1.9.2.dist-info/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
5
- maialib-1.9.2.dist-info/METADATA,sha256=sUAWbVDCxKBgGMd1rWm4Xe2l1h5J6lWJAf8J9Vw1Bc8,7051
1
+ maialib-1.9.4.dist-info/RECORD,,
2
+ maialib-1.9.4.dist-info/WHEEL,sha256=cBy-JNWg3y6KmLE-K2kxS_UNVKfvgmw6eBcsGF4eLP4,113
3
+ maialib-1.9.4.dist-info/top_level.txt,sha256=sZWQaa-Up2ba00WpAxBhOLKM6qQYTpUKJMXgSE0Nc48,17
4
+ maialib-1.9.4.dist-info/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
5
+ maialib-1.9.4.dist-info/METADATA,sha256=na23GjO9h3WRrQ4DlDDc9klrMiIkmL940cE8esl05TY,7990
6
6
  maialib/__init__.py,sha256=qiIEL1ZDvpDK0bkGUdZRib3bG973EtKQDFYPFfvJKQA,122
7
7
  maialib/setup.py,sha256=1Cbv0DfEUNK1EQHb64-1B0rwbRrsTSnJBY8fVn8gtbU,2168
8
8
  maialib/xml-scores-examples/Mahler_Symphony_8_Finale.mxl,sha256=F2-QBKNYjBv_sWT-z4LWi1rX84-P3msxtl-g6joA2FQ,229034
@@ -14,13 +14,13 @@ maialib/xml-scores-examples/Strauss_Also_Sprach_Zarathustra.mxl,sha256=nOQra05RH
14
14
  maialib/xml-scores-examples/Bach_Cello_Suite_1.mxl,sha256=0XGNlcW8o0W7kkeG8j2V_M4eggdOnrxvvvCkpf6x_z4,29622
15
15
  maialib/maiacore/__init__.pyi,sha256=cJfflEKHJ6BPUTlDQt95xZmi2N3zwHJkHEXy27fBd5c,1282
16
16
  maialib/maiacore/__init__.py,sha256=IW7E0LuzAttsn0b37SEthCA0LKuzSgkepSpq8DWExYQ,77
17
- maialib/maiacore/maiacore.pyi,sha256=v93jv2Ou7tTPs1-rsBaAEyfrYbXsEPewy9txJek3mt4,48398
18
- maialib/maiacore/maiacore.cpython-38-darwin.so,sha256=OxX1-M7Rd5Po_oLzfc_ZkhxM0TefxbBHfxje1N86XOY,8222704
17
+ maialib/maiacore/maiacore.pyi,sha256=nQkrQ-uQjpoYY275mnJGtqP42rLvGLasBFPtylYN3tM,48416
18
+ maialib/maiacore/maiacore.cpython-38-darwin.so,sha256=ZynzZz1Q8CAw_Pxt7D21mna4aQXMXdgkd6xl2k_Tb74,8222704
19
19
  maialib/maiapy/other.pyi,sha256=jEmAc-MDc3iMA2-5hp41RLgNrfBQRMvq-sF2_pexhbo,2163
20
20
  maialib/maiapy/__init__.pyi,sha256=L8YtZYJMw_9TrdejcKs2c5xTbu5WMRwlHhKz6Qzulf8,77
21
21
  maialib/maiapy/__init__.py,sha256=L8YtZYJMw_9TrdejcKs2c5xTbu5WMRwlHhKz6Qzulf8,77
22
22
  maialib/maiapy/other.py,sha256=4LjETHcpDpNRjSYIbMW_9CuRZTymuoAzog_L3CkYDA0,4345
23
- maialib/maiapy/sethares_dissonance.py,sha256=M1g9IchSEXREPxez5wsSX14Y1yyuAxXbdmXJNLrO00s,12969
23
+ maialib/maiapy/sethares_dissonance.py,sha256=4PZEx_K5DLFOuDuq6ElKM0N97BjDT3XFX47lXeto-iU,13741
24
24
  maialib/maiapy/plots.pyi,sha256=nRNUQ9h9kjJHTdbQt4eXv933MOx7TIztIg-inThglB4,3620
25
25
  maialib/maiapy/plots.py,sha256=sg6W2OjzZNl8vEVy91URn1nFhfrlRHzXoBkvd4hoZXo,23680
26
- maialib/maiapy/sethares_dissonance.pyi,sha256=O8D_cYRPCE1K5Zw54ckg3I5frULcBGgs_di_bTOpuBU,3609
26
+ maialib/maiapy/sethares_dissonance.pyi,sha256=T9rHlpeIao3gEelFJGa8690Tsd1DPzGmToMF_YJ3cNg,3828