midi-clip


Namemidi-clip JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/kyaryunha/midi-clip
SummaryA python package for midi clip.
upload_time2023-06-05 02:30:23
maintainer
docs_urlNone
authorkyaryunha
requires_python
licenseISC
keywords midi midi mir music audio sound midi-clip python python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # midi-clip
[![PyPI](https://img.shields.io/pypi/v/midi-clip.svg)](https://pypi.python.org/pypi/midi-clip)

A python package for midi clip (and midi duration) based on mido. ([github](https://github.com/kyaryunha/midi-clip))

Author: Hyun Shin ([kyaryunha](https://github.com/kyaryunha))

### Introduce

This library considers a lot of things for detailing midi clips: followings:

- Supports both multi-track MIDI
- Supports both tempo track & non-tempo track
- Consider set_tempo, time_signature, controllers that appear before start time or note_on that were not closed
- Consider empty space before the midi
- All note_on and note_off pairs are validate. (Number of note_on and note_off is the same, and all note_on are closed by note_off)
- ... 

### Usage
```
pip install midi-clip
```

```python
import mido
import midi_clip
# load midi use mido
mid = mido.MidiFile('resources/hosu.mid')
# clip midi
output_mid = midi_clip.midi_clip(mid, 5., 15.)
# you can get total duration(second) of midi
duration = midi_clip.midi_duration(output_mid)
# if you see by print
print(output_mid, duration)
# if you save midi clip
output_mid.save('output.mid')
```

### Result

Result of clip "A Town With An Ocean View" MIDI from 0 to 30 seconds and from 5 to 15 seconds.

<table>
<tr>
<td></td>
<td>0s-30s</td>
<td>5s-15s</td>
</tr>
<tr>
<td>Piano Roll</td>
<td><img src="https://raw.githubusercontent.com/kyaryunha/midi-clip/main/example/ocean_0_30.png" /></td>
<td><img src="https://raw.githubusercontent.com/kyaryunha/midi-clip/main/example/ocean_5_15.png" /></td>
</tr>
<tr>
<td>Audio</td>
<td>https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_0_30.wav</td>
<td>https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_5_15.wav</td>
</tr>
</table>

** Used GarageBand to obtain piano roll images and Cubase to obtain audio.
GarageBand and Cubase fill in the measure regardless of the actual end of track time in the MIDI, resulting in slightly longer audio. MIDI file's time clip is precisely.

** Data used for result was allowed by an anonymous artist.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kyaryunha/midi-clip",
    "name": "midi-clip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "midi MIDI mir music audio sound midi-clip python python3",
    "author": "kyaryunha",
    "author_email": "kyaryunha@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/50/cb/05310d01d32877bf505efdead6c60174d7457520d4fe2d0a88bd50e4d42f/midi-clip-0.10.tar.gz",
    "platform": null,
    "description": "# midi-clip\n[![PyPI](https://img.shields.io/pypi/v/midi-clip.svg)](https://pypi.python.org/pypi/midi-clip)\n\nA python package for midi clip (and midi duration) based on mido. ([github](https://github.com/kyaryunha/midi-clip))\n\nAuthor: Hyun Shin ([kyaryunha](https://github.com/kyaryunha))\n\n### Introduce\n\nThis library considers a lot of things for detailing midi clips: followings:\n\n- Supports both multi-track MIDI\n- Supports both tempo track & non-tempo track\n- Consider set_tempo, time_signature, controllers that appear before start time or note_on that were not closed\n- Consider empty space before the midi\n- All note_on and note_off pairs are validate. (Number of note_on and note_off is the same, and all note_on are closed by note_off)\n- ... \n\n### Usage\n```\npip install midi-clip\n```\n\n```python\nimport mido\nimport midi_clip\n# load midi use mido\nmid = mido.MidiFile('resources/hosu.mid')\n# clip midi\noutput_mid = midi_clip.midi_clip(mid, 5., 15.)\n# you can get total duration(second) of midi\nduration = midi_clip.midi_duration(output_mid)\n# if you see by print\nprint(output_mid, duration)\n# if you save midi clip\noutput_mid.save('output.mid')\n```\n\n### Result\n\nResult of clip \"A Town With An Ocean View\" MIDI from 0 to 30 seconds and from 5 to 15 seconds.\n\n<table>\n<tr>\n<td></td>\n<td>0s-30s</td>\n<td>5s-15s</td>\n</tr>\n<tr>\n<td>Piano Roll</td>\n<td><img src=\"https://raw.githubusercontent.com/kyaryunha/midi-clip/main/example/ocean_0_30.png\" /></td>\n<td><img src=\"https://raw.githubusercontent.com/kyaryunha/midi-clip/main/example/ocean_5_15.png\" /></td>\n</tr>\n<tr>\n<td>Audio</td>\n<td>https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_0_30.wav</td>\n<td>https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_5_15.wav</td>\n</tr>\n</table>\n\n** Used GarageBand to obtain piano roll images and Cubase to obtain audio.\nGarageBand and Cubase fill in the measure regardless of the actual end of track time in the MIDI, resulting in slightly longer audio. MIDI file's time clip is precisely.\n\n** Data used for result was allowed by an anonymous artist.\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "A python package for midi clip.",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/kyaryunha/midi-clip"
    },
    "split_keywords": [
        "midi",
        "midi",
        "mir",
        "music",
        "audio",
        "sound",
        "midi-clip",
        "python",
        "python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb9bdb91abe13585917630eed6587991e78fc3143e00a9283796087523574c09",
                "md5": "f4d25b6420dd78730452348aaa5bd30b",
                "sha256": "30816dcdf684d36be9be9029fe7eb7bfd8c760ce2967654daf842946cc23ee71"
            },
            "downloads": -1,
            "filename": "midi_clip-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f4d25b6420dd78730452348aaa5bd30b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7417,
            "upload_time": "2023-06-05T02:30:21",
            "upload_time_iso_8601": "2023-06-05T02:30:21.543880Z",
            "url": "https://files.pythonhosted.org/packages/fb/9b/db91abe13585917630eed6587991e78fc3143e00a9283796087523574c09/midi_clip-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50cb05310d01d32877bf505efdead6c60174d7457520d4fe2d0a88bd50e4d42f",
                "md5": "36fb48e0570015acfc45ad92d8dc4740",
                "sha256": "6c6b7aa10c5fd9d7462ee9d0dd03980636c99e89f8dc3e91bf66fb8580259512"
            },
            "downloads": -1,
            "filename": "midi-clip-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "36fb48e0570015acfc45ad92d8dc4740",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7338,
            "upload_time": "2023-06-05T02:30:23",
            "upload_time_iso_8601": "2023-06-05T02:30:23.429766Z",
            "url": "https://files.pythonhosted.org/packages/50/cb/05310d01d32877bf505efdead6c60174d7457520d4fe2d0a88bd50e4d42f/midi-clip-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-05 02:30:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kyaryunha",
    "github_project": "midi-clip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "midi-clip"
}
        
Elapsed time: 0.07537s