rhythmic_segments


Namerhythmic_segments JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryResearch code for basic Rhythmic Segment Analysis.
upload_time2025-10-15 09:03:43
maintainerNone
docs_urlNone
authorBas Cornelissen
requires_python<3.14,>=3.11
licenseNone
keywords rhythm segments music analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![CI](https://github.com/bacor/rhythmic-segments/actions/workflows/ci.yaml/badge.svg)](https://github.com/bacor/rhythmic-segments/actions/workflows/ci.yaml)
[![docs](https://github.com/bacor/rhythmic-segments/actions/workflows/docs.yaml/badge.svg)](https://github.com/bacor/rhythmic-segments/actions/workflows/docs.yaml)


# Rhythmic Segments

This project provides some basic code to simplify **Rhythmic Segment Analysis** in Python. 
A rhythmic segment analysis (RSA) analyzes every fixed-length segment of a sequence of time intervals: the short groups you obtain by sliding a window across the data. Each segment has a *duration* and a *pattern*. The pattern captures the relative durations of a segment’s intervals, either as a normalized vector or as a ratio. For example, the segment (2, 4, 4) has the pattern (.2, .4, .4) or 1 : 2 : 2; both descriptions are interchangeable. Thinking of patterns as normalized vectors shows that all patterns of a given length live on a simplex: a line for length 2, a triangle for length 3, and so on. The goal is to study rhythmic material by analysing how its segments are distributed of that simplex.

Computing patterns is as simple as normalising the segment, and so you can absolutely do a rhythmic segment analysis without using this package. This package however provides some utilities that make things easier: the RhythmicSegments class allows you to conveniently store large numbers of segments and handle associated metadata.

[For more details, have a look at the docs.](https://bacor.github.io/rhythmic-segments)



## Installation

The package has been tested with Python 3.11 and 3.12.
You can install the package using pip:

```sh
pip install rhythmic-segments
```

## Getting started

```python
from rhythmic_segments import RhythmicSegments

intervals = [1, 2, 3, 4, 5, 6, 7, 8, 9]
rs = RhythmicSegments.from_intervals(intervals, length=3)
rs.segments
# array([[1., 2., 3.], [2., 3., 4.], [3., 4., 5.], ... ])
```

## License

The code is distributed under an MIT license.

## Contributing

Feel free to contribute via GitHub: https://github.com/bacor/rhythmic-segments

## Citation

A paper describing the idea in more details is currently in preparation. Until a formal reference is available, please cite the repository:

```bibtex
@misc{cornelissen_rhythmic_segments,
  author = {Bas Cornelissen},
  title = {rhythmic_segments},
  howpublished = {\url{https://github.com/bascornelissen/rhythmic-segments}},
  year = {2025},
  note = {Version 0.1.3}
}


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rhythmic_segments",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.11",
    "maintainer_email": null,
    "keywords": "rhythm, segments, music, analysis",
    "author": "Bas Cornelissen",
    "author_email": "mail@bascornelissen.nl",
    "download_url": "https://files.pythonhosted.org/packages/19/37/fca1bea4a4e25d84e2f3bf09d06215c33ffc94dc9f241dad773d00497397/rhythmic_segments-0.1.7.tar.gz",
    "platform": null,
    "description": "[![CI](https://github.com/bacor/rhythmic-segments/actions/workflows/ci.yaml/badge.svg)](https://github.com/bacor/rhythmic-segments/actions/workflows/ci.yaml)\n[![docs](https://github.com/bacor/rhythmic-segments/actions/workflows/docs.yaml/badge.svg)](https://github.com/bacor/rhythmic-segments/actions/workflows/docs.yaml)\n\n\n# Rhythmic Segments\n\nThis project provides some basic code to simplify **Rhythmic Segment Analysis** in Python. \nA rhythmic segment analysis (RSA) analyzes every fixed-length segment of a sequence of time intervals: the short groups you obtain by sliding a window across the data. Each segment has a *duration* and a *pattern*. The pattern captures the relative durations of a segment\u2019s intervals, either as a normalized vector or as a ratio. For example, the segment (2, 4, 4) has the pattern (.2, .4, .4) or 1 : 2 : 2; both descriptions are interchangeable. Thinking of patterns as normalized vectors shows that all patterns of a given length live on a simplex: a line for length 2, a triangle for length 3, and so on. The goal is to study rhythmic material by analysing how its segments are distributed of that simplex.\n\nComputing patterns is as simple as normalising the segment, and so you can absolutely do a rhythmic segment analysis without using this package. This package however provides some utilities that make things easier: the RhythmicSegments class allows you to conveniently store large numbers of segments and handle associated metadata.\n\n[For more details, have a look at the docs.](https://bacor.github.io/rhythmic-segments)\n\n\n\n## Installation\n\nThe package has been tested with Python 3.11 and 3.12.\nYou can install the package using pip:\n\n```sh\npip install rhythmic-segments\n```\n\n## Getting started\n\n```python\nfrom rhythmic_segments import RhythmicSegments\n\nintervals = [1, 2, 3, 4, 5, 6, 7, 8, 9]\nrs = RhythmicSegments.from_intervals(intervals, length=3)\nrs.segments\n# array([[1., 2., 3.], [2., 3., 4.], [3., 4., 5.], ... ])\n```\n\n## License\n\nThe code is distributed under an MIT license.\n\n## Contributing\n\nFeel free to contribute via GitHub: https://github.com/bacor/rhythmic-segments\n\n## Citation\n\nA paper describing the idea in more details is currently in preparation. Until a formal reference is available, please cite the repository:\n\n```bibtex\n@misc{cornelissen_rhythmic_segments,\n  author = {Bas Cornelissen},\n  title = {rhythmic_segments},\n  howpublished = {\\url{https://github.com/bascornelissen/rhythmic-segments}},\n  year = {2025},\n  note = {Version 0.1.3}\n}\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Research code for basic Rhythmic Segment Analysis.",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "rhythm",
        " segments",
        " music",
        " analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0c54f3644139576146e1a3dface846c4bbbeec507146909b4123b7b2118c571",
                "md5": "14926b607046980f51eed677f781b9bd",
                "sha256": "e052ba9af698b59d3134799beda614864ea511b44b28f6c36d809ef0dc54c4b2"
            },
            "downloads": -1,
            "filename": "rhythmic_segments-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14926b607046980f51eed677f781b9bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.11",
            "size": 13595,
            "upload_time": "2025-10-15T09:03:42",
            "upload_time_iso_8601": "2025-10-15T09:03:42.501573Z",
            "url": "https://files.pythonhosted.org/packages/a0/c5/4f3644139576146e1a3dface846c4bbbeec507146909b4123b7b2118c571/rhythmic_segments-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1937fca1bea4a4e25d84e2f3bf09d06215c33ffc94dc9f241dad773d00497397",
                "md5": "9a093b9342f3f4bc36d21d643ad9f600",
                "sha256": "c6677b1f655782641ecf6247a7973462b5c0071f355e4fab4390e87b3bf305ef"
            },
            "downloads": -1,
            "filename": "rhythmic_segments-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "9a093b9342f3f4bc36d21d643ad9f600",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.11",
            "size": 13360,
            "upload_time": "2025-10-15T09:03:43",
            "upload_time_iso_8601": "2025-10-15T09:03:43.354534Z",
            "url": "https://files.pythonhosted.org/packages/19/37/fca1bea4a4e25d84e2f3bf09d06215c33ffc94dc9f241dad773d00497397/rhythmic_segments-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-15 09:03:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "rhythmic_segments"
}
        
Elapsed time: 1.05756s