# munotes
*musical-notes*
[![PyPI version](https://badge.fury.io/py/munotes.svg)](https://badge.fury.io/py/munotes)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/munotes?style=plastic)
<br>
This library is for handling notes and chords in Python.
- [PyPI](https://pypi.org/project/munotes/)
- [API Reference](https://misya11p.github.io/munotes/)
## General Usage
### Note
Note class. Handling note.
This class is used by inputting the note name and octave height, or MIDI note number at initialization.
```python
import munotes as mn
note = mn.Note("A4")
print(note) # A4
note = mn.Note(69)
print(note) # A4
```
- `transpose()`
Transpose the note.
```python
note.transpose(2)
print(note) # B4
```
- `render()`
Get the waveform of the note.
```python
import matplotlib.pyplot as plt
y = note.render('sin')
plt.plot(y[:200])
```
![image](docs/images/sin.jpg)
`squere` and `sawtooth` are also sapported.
```python
y = note.render('squere')
plt.plot(y[:200])
```
![image](docs/images/square.jpg)
```python
y = note.render('sawtooth')
plt.plot(y[:200])
```
![image](docs/images/sawtooth.jpg)
Arbitrary waveforms are also supported.
```python
y = note.render(lambda t: np.sin(t) + np.sin(2*t))
plt.plot(y[:200])
```
![image](docs/images/sin2.jpg)
- `play()`
Get IPython.display.Audio object.
![image](docs/images/play.jpg)
### Notes
Notes class. Handling multiple notes.
This class is used by inputting the notes at initialization.
```python
notes = mn.Notes("C4", "E4", "G4")
print(notes) # C4 E4 G4
```
Methods are the same as `Note`. Ex: `transpose()`, `render()`, `play()`.
### Chord
Chord class. Handling chord.
This class generates a Notes object by inputting a chord name at initialization.
```python
from munotes import Chord
chord = Chord("A#m7")
print(chord) # A#m7
print(chord.names) # ['A#', 'C#', 'F', 'G#']
```
Methods are the same as `Note` (and `Notes`).
Transpose is also supported by `transpose()`
```python
chord.transpose(3)
print(chord) # C#m7
print(chord.names) # ['C#', 'E', 'G#', 'B']
```
### Track
Track class. Handling multiple Notes as a sequence.
This class is used by inputting the notes and durations at initialization.
```python
track = mn.Track([
("C4", 1),
("E4", 1),
("G4", 1)
])
```
Methods are the same as other classes.
But in methods that handling waveform (`render()`, `play()`, etc), generate the waveform as sequence of notes (like: C -> E -> G).
### Stream
Stream class. Handling multiple tracks.
This class is used by inputting the tracks at initialization.
```python
melody = mn.Track([
("C4", 1),
("D4", 1),
("E4", 1)
])
chords = mn.Track([
(mn.Chord("C"), 3),
])
stream = mn.Stream([melody, chords])
```
Methods are the same as other classes.
## Version History
### [0.1.0](https://pypi.org/project/munotes/0.1.0/) (2022-11-12, Beta-release)
- Add `Note` class
- Add `Chord` class
### [1.0.0](https://pypi.org/project/munotes/1.0.0/) (2023-02-09)
- Add `Notes` class
- Add `Track` class
- Add `Stream` class
- Add `Rest` class
- Add `sin()`, `square()`, `sawtooth()` methods
- Add `play()` method
- Add `render()` method
### [1.0.1](https://pypi.org/project/munotes/1.0.1/) (2023-02-12)
- Fixed a bug that `Rest` could not be put into `Track`.
### [1.1.0](https://pypi.org/project/munotes/1.1.0/) (2023-02-16, Latest)
- Waveform parameters can be specified. Ex: `note.sawtooth(width=0.5)`
- Support for inputting octave with note names. Ex: `note = mn.Note("A4")`
- All supported chords can be seen in `mn.chord_names`.
- Arbitrary chords can be added.
Raw data
{
"_id": null,
"home_page": "https://github.com/misya11p/munotes",
"name": "munotes",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "music note chord sound waveform",
"author": "misya11p",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/4c/4e/dd1690c702bfd2747901f56c868e8ebffc44a7ff23d95cc30d183cea6ca5/munotes-2.0.0.tar.gz",
"platform": null,
"description": "# munotes\n\n*musical-notes*\n\n[![PyPI version](https://badge.fury.io/py/munotes.svg)](https://badge.fury.io/py/munotes)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/munotes?style=plastic)\n\n<br>\n\nThis library is for handling notes and chords in Python.\n\n- [PyPI](https://pypi.org/project/munotes/)\n- [API Reference](https://misya11p.github.io/munotes/)\n\n## General Usage\n\n### Note\n\nNote class. Handling note.\n\nThis class is used by inputting the note name and octave height, or MIDI note number at initialization.\n\n```python\nimport munotes as mn\n\nnote = mn.Note(\"A4\")\nprint(note) # A4\n\nnote = mn.Note(69)\nprint(note) # A4\n```\n\n- `transpose()`\n\nTranspose the note.\n\n```python\nnote.transpose(2)\nprint(note) # B4\n\n```\n\n\n- `render()`\n\nGet the waveform of the note.\n\n```python\nimport matplotlib.pyplot as plt\ny = note.render('sin')\nplt.plot(y[:200])\n```\n\n![image](docs/images/sin.jpg)\n\n`squere` and `sawtooth` are also sapported.\n\n```python\ny = note.render('squere')\nplt.plot(y[:200])\n```\n![image](docs/images/square.jpg)\n\n```python\ny = note.render('sawtooth')\nplt.plot(y[:200])\n```\n![image](docs/images/sawtooth.jpg)\n\nArbitrary waveforms are also supported.\n\n```python\ny = note.render(lambda t: np.sin(t) + np.sin(2*t))\nplt.plot(y[:200])\n```\n![image](docs/images/sin2.jpg)\n\n\n- `play()`\n\nGet IPython.display.Audio object.\n\n![image](docs/images/play.jpg)\n\n\n### Notes\n\nNotes class. Handling multiple notes.\n\nThis class is used by inputting the notes at initialization.\n\n```python\nnotes = mn.Notes(\"C4\", \"E4\", \"G4\")\nprint(notes) # C4 E4 G4\n\n```\n\nMethods are the same as `Note`. Ex: `transpose()`, `render()`, `play()`.\n\n\n\n### Chord\n\nChord class. Handling chord.\n\nThis class generates a Notes object by inputting a chord name at initialization.\n\n```python\nfrom munotes import Chord\nchord = Chord(\"A#m7\")\nprint(chord) # A#m7\nprint(chord.names) # ['A#', 'C#', 'F', 'G#']\n```\n\nMethods are the same as `Note` (and `Notes`). \nTranspose is also supported by `transpose()`\n\n```python\nchord.transpose(3)\nprint(chord) # C#m7\nprint(chord.names) # ['C#', 'E', 'G#', 'B']\n```\n\n\n### Track\n\nTrack class. Handling multiple Notes as a sequence.\n\nThis class is used by inputting the notes and durations at initialization.\n\n\n```python\ntrack = mn.Track([\n (\"C4\", 1),\n (\"E4\", 1),\n (\"G4\", 1)\n])\n```\n\nMethods are the same as other classes. \nBut in methods that handling waveform (`render()`, `play()`, etc), generate the waveform as sequence of notes (like: C -> E -> G).\n\n\n### Stream\n\nStream class. Handling multiple tracks.\n\nThis class is used by inputting the tracks at initialization.\n\n```python\nmelody = mn.Track([\n (\"C4\", 1),\n (\"D4\", 1),\n (\"E4\", 1)\n])\n\nchords = mn.Track([\n (mn.Chord(\"C\"), 3),\n])\n\nstream = mn.Stream([melody, chords])\n```\n\nMethods are the same as other classes.\n\n## Version History\n\n### [0.1.0](https://pypi.org/project/munotes/0.1.0/) (2022-11-12, Beta-release)\n- Add `Note` class\n- Add `Chord` class\n\n### [1.0.0](https://pypi.org/project/munotes/1.0.0/) (2023-02-09)\n- Add `Notes` class\n- Add `Track` class\n- Add `Stream` class\n- Add `Rest` class\n- Add `sin()`, `square()`, `sawtooth()` methods\n- Add `play()` method\n- Add `render()` method\n\n### [1.0.1](https://pypi.org/project/munotes/1.0.1/) (2023-02-12)\n- Fixed a bug that `Rest` could not be put into `Track`.\n\n### [1.1.0](https://pypi.org/project/munotes/1.1.0/) (2023-02-16, Latest)\n- Waveform parameters can be specified. Ex: `note.sawtooth(width=0.5)`\n- Support for inputting octave with note names. Ex: `note = mn.Note(\"A4\")`\n- All supported chords can be seen in `mn.chord_names`.\n- Arbitrary chords can be added.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Handle musical notes and their sounds in Python",
"version": "2.0.0",
"project_urls": {
"API Reference": "https://misya11p.github.io/munotes/",
"Homepage": "https://github.com/misya11p/munotes",
"Source": "https://github.com/misya11p/munotes"
},
"split_keywords": [
"music",
"note",
"chord",
"sound",
"waveform"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "407e115a93944fb4bfbc565c6673537bd301b8c526fcf2d91d11264ffa57a698",
"md5": "ba50f9d54b688ee4164afd8c8c496386",
"sha256": "b346ef681ce56bcecdfb106759a5693ec2dc34a2546b9b5b93216e638ca467de"
},
"downloads": -1,
"filename": "munotes-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba50f9d54b688ee4164afd8c8c496386",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16953,
"upload_time": "2023-11-18T15:52:07",
"upload_time_iso_8601": "2023-11-18T15:52:07.007058Z",
"url": "https://files.pythonhosted.org/packages/40/7e/115a93944fb4bfbc565c6673537bd301b8c526fcf2d91d11264ffa57a698/munotes-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c4edd1690c702bfd2747901f56c868e8ebffc44a7ff23d95cc30d183cea6ca5",
"md5": "fab768c76fe56cb5da1ec67b364dc768",
"sha256": "1d3bf92ad65c017678853350edbd7aa8df9251bdc09da8ad3e1565dd157f18d9"
},
"downloads": -1,
"filename": "munotes-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "fab768c76fe56cb5da1ec67b364dc768",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 13791,
"upload_time": "2023-11-18T15:52:08",
"upload_time_iso_8601": "2023-11-18T15:52:08.719051Z",
"url": "https://files.pythonhosted.org/packages/4c/4e/dd1690c702bfd2747901f56c868e8ebffc44a7ff23d95cc30d183cea6ca5/munotes-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-18 15:52:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "misya11p",
"github_project": "munotes",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "munotes"
}