munotes


Namemunotes JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/misya11p/munotes
SummaryHandle musical notes and their sounds in Python
upload_time2024-05-21 13:49:03
maintainerNone
docs_urlNone
authormisya11p
requires_python>=3.7
licenseMIT
keywords music note chord sound waveform
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 with durations at initialization.


```python
track = mn.Track([
    mn.Note("C4", duration=1),
    mn.Note("E4", duration=1),
    mn.Note("G4", duration=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
track = mn.Track([
    mn.Note("C4", duration=1),
    mn.Note("E4", duration=1),
    mn.Note("G4", duration=1)
])

chords = mn.Track([
    mn.Chord("C", duration=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)

- Fix a bug that `Rest` could not be put into `Track`.

### [1.1.0](https://pypi.org/project/munotes/1.1.0/) (2023-02-16)

- 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

### [2.0.0](https://pypi.org/project/munotes/2.0.0/) (2023-11-19)

- Add `Envelope` class
- Modify `sec` argument to `duration`
- Add default parameters for rendering that can be specified in initialization
    - `waveform`
    - `duration`
    - `unit`
    - `bpm`
    - `envelope`
    - `duty`
    - `width`
    - `amp`
- Remove function that change frequency of `A4` directly
- Modify input type of `Track` from `Tuple[Note, float]` to `List[Note]`
    - Note.duration is used to duration when rendering
- Remove `**kwargs` in `render()` method

### [2.0.1](https://pypi.org/project/munotes/2.0.1/) (2023-11-20)

- Fix `__add__` method of `Notes` class
- Fix a bug that `append()` method of `Notes` class does not work
- Modify `__repr__` method

### [2.0.2](https://pypi.org/project/munotes/2.0.2/) (2024-05-21, Latest)

- Fix a bug that chord names in `Track` and `Stream` are not update when transposed

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/misya11p/munotes",
    "name": "munotes",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "music note chord sound waveform",
    "author": "misya11p",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/df/82/2e537e0d09af17782f9a61be95103e3ce554012fba16ef34b50593dc76f3/munotes-2.0.2.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 with durations at initialization.\n\n\n```python\ntrack = mn.Track([\n    mn.Note(\"C4\", duration=1),\n    mn.Note(\"E4\", duration=1),\n    mn.Note(\"G4\", duration=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\ntrack = mn.Track([\n    mn.Note(\"C4\", duration=1),\n    mn.Note(\"E4\", duration=1),\n    mn.Note(\"G4\", duration=1)\n])\n\nchords = mn.Track([\n    mn.Chord(\"C\", duration=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\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\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\n- Fix 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)\n\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\n### [2.0.0](https://pypi.org/project/munotes/2.0.0/) (2023-11-19)\n\n- Add `Envelope` class\n- Modify `sec` argument to `duration`\n- Add default parameters for rendering that can be specified in initialization\n    - `waveform`\n    - `duration`\n    - `unit`\n    - `bpm`\n    - `envelope`\n    - `duty`\n    - `width`\n    - `amp`\n- Remove function that change frequency of `A4` directly\n- Modify input type of `Track` from `Tuple[Note, float]` to `List[Note]`\n    - Note.duration is used to duration when rendering\n- Remove `**kwargs` in `render()` method\n\n### [2.0.1](https://pypi.org/project/munotes/2.0.1/) (2023-11-20)\n\n- Fix `__add__` method of `Notes` class\n- Fix a bug that `append()` method of `Notes` class does not work\n- Modify `__repr__` method\n\n### [2.0.2](https://pypi.org/project/munotes/2.0.2/) (2024-05-21, Latest)\n\n- Fix a bug that chord names in `Track` and `Stream` are not update when transposed\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Handle musical notes and their sounds in Python",
    "version": "2.0.2",
    "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": "c3fefbdf801025024f09ccd0fc69ab34aa38972c9a0a8e83e921fb22a0ea2d72",
                "md5": "1fbd703fffe5b95193e65fea52ce7733",
                "sha256": "b63134d5fa6de347498fef3a222f4ddf4e259fd68c0d4618925305898d275514"
            },
            "downloads": -1,
            "filename": "munotes-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1fbd703fffe5b95193e65fea52ce7733",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17418,
            "upload_time": "2024-05-21T13:49:00",
            "upload_time_iso_8601": "2024-05-21T13:49:00.601469Z",
            "url": "https://files.pythonhosted.org/packages/c3/fe/fbdf801025024f09ccd0fc69ab34aa38972c9a0a8e83e921fb22a0ea2d72/munotes-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df822e537e0d09af17782f9a61be95103e3ce554012fba16ef34b50593dc76f3",
                "md5": "d226c8af2b40b875af573d1eae3908e6",
                "sha256": "6e4e2d2398471cd409704ac706d779e471aa96be98037789e0f2d981256619d4"
            },
            "downloads": -1,
            "filename": "munotes-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d226c8af2b40b875af573d1eae3908e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14465,
            "upload_time": "2024-05-21T13:49:03",
            "upload_time_iso_8601": "2024-05-21T13:49:03.031873Z",
            "url": "https://files.pythonhosted.org/packages/df/82/2e537e0d09af17782f9a61be95103e3ce554012fba16ef34b50593dc76f3/munotes-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-21 13:49:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "misya11p",
    "github_project": "munotes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "munotes"
}
        
Elapsed time: 0.28371s