pocketrockit


Namepocketrockit JSON
Version 0.0.31 PyPI version JSON
download
home_pagehttps://projects.om-office.de/frans/pocketrockit.git
SummaryLive music coding inspired by Sonic Pi
upload_time2023-09-23 11:40:58
maintainer
docs_urlNone
authorFrans Fürst
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # POCKETROCKIT - A rocket in your pocket that rocks!

Original project page: https://projects.om-office.de/frans/pocketrockit.git

Write a music track in Python and play it while you write it (as you might know it from
[Sonic Pi](https://sonic-pi.net/), but written in Python (`sonic.py` was not available on PyPi, though)).

Write melodies, create rythm patterns, define endless simultaneously playing instruments, all in
a .. well .. simple Python syntax.


## Installation

```sh
[<PYTHON> -m] pip[3] install [--upgrade] pocketrockit
```


## Usage

Workflow is not quite mature yet, so here is the short version for now.

Create and enter a separate folder and provide required SoundFont files (configurable later,
hard-coded for now).

Pocketrockt expects two SoundFont files: `instrumental.sf2` and `drums.sf2`. You can download and
move/rename any file that works for you, and you can also just create symlinks (this is what I do).

This is just an example:

```sh
mkdir mytracks
cd mytracks
ln -s /usr/share/soundfonts/FluidR3_GM.sf2 instrumental.sf2
wget https://musical-artifacts.com/artifacts/2744/JV_1080_Drums.sf2
ln -s JV_1080_Drums.sf2 drums.sf2
```
The file `FluidR3_GM.sf2` was shipped with FluidSynth for me, and I got `JV_1080_Drums.sf2` from
[here](https://musical-artifacts.com/artifacts/2744).


Create a file `myfirsttrack.py` with the following content:

```python
#!/usr/bin/env python3

from pocketrockit import Env, midiseq, player, track

@track
def my_first_track(env: Env):

    @player
    def metronome():
        yield from midiseq("x x x x", channel=128, note=37)

    @player
    def melody1():
        yield from midiseq(
            "| .                .                 .                (II I)      "
            "| (II  VI<)        (IV< VI< . II<)   .                (II I)      "
            "| (II  VI<)        (IV< VI< . II<)   .                (II III)    "
            "| (IV  . III IV)   (. IV . II)       (III . II III)   (. III . I) "
            ,
            key="A5", channel=13)
```

Now - keeping the editor open for later use - execute this file. You can either make it executable
and run it directly or you run `python3` instead:

```sh
chmod +x myfirsttrack.py
./myfirsttrack.py

# or

python3 myfirsttrack.py
```


## Development & Contribution

```sh
pip3 install -U poetry pre-commit
git clone --recurse-submodules https://projects.om-office.de/frans/pocketrockit.git
cd pocketrockit
pre-commit install
# if you need a specific version of Python inside your dev environment
poetry env use ~/.pyenv/versions/3.10.4/bin/python3
poetry install
```

After modifications, this way a newly built wheel can be checked and installed:

```sh
poetry build
poetry run twine check dist/pocketrockit-0.0.25-py3-none-any.whl
python3 -m pip install --user --upgrade dist/pocketrockit-0.0.25-py3-none-any.whl
```


## Stuff to read / Sources

### SoundFonts

* https://musescore.org/en/handbook/3/soundfonts-and-sfz-files
* https://www.producersbuzz.com/category/downloads/download-free-soundfonts-sf2/
* https://archive.org/details/500-soundfonts-full-gm-sets
* https://ia802502.us.archive.org/view_archive.php?archive=/27/items/500-soundfonts-full-gm-sets/500_Soundfonts_Full_GM_Sets.zip
* https://musical-artifacts.com/artifacts?formats=sf2&tags=soundfont

flatpak install flathub com.polyphone_soundfonts.polyphone
flatpak run com.polyphone_soundfonts.polyphone instrumental.sf2


### Music stuff

* https://pianoscales.org/major.html
* https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies
* https://onlinesequencer.net/181312
* https://github.com/Rainbow-Dreamer
* https://github.com/Rainbow-Dreamer/musicpy-daw
* https://sound.stackexchange.com/
* [librosa](https://librosa.org/doc/latest/advanced.html)
* [PO-20 Arcade key signatures for chords](https://pocketoperations.com/pocket-operator-cheatsheets.html#po-20-arcade-key-signatures-for-chords)

#### Drum patterns

* [Pocket Operations](https://shittyrecording.studio/)
* [10 Popular Drum Patterns Every Producer Should Know](https://www.youtube.com/watch?v=c7ffMObdxro)
* [Making Reggae & Dub music (2) Stepper beat](https://www.youtube.com/watch?v=o-qHwO8wE0c)
* [Dub Reggae Drum Beat Backing Track 150 bpm](https://www.youtube.com/watch?v=RCKn3TReYKM)
* [The Basics Of Reggae Drumming](https://www.youtube.com/watch?v=mxUHE5XC_mI)


### Tech stuff

* https://stackoverflow.com/questions/20023545/running-pyfluidsynth-pyaudio-demo-many-problems-with-alsa-and-jack
* https://www.ladspa.org/
* [How can I record audio output from command line in Linux?](https://superuser.com/questions/1570333/how-can-i-record-audio-output-from-command-line-in-linux)
* [Communicating between SuperCollider and Python](https://capital-g.github.io/musikinformatik-sose2021/00_basics/osc_communication.html)
* https://pypi.org/project/sc3/ / https://github.com/smrg-lm/sc3
* https://pypi.org/project/supercollider/ https://github.com/ideoforms/python-supercollider
* [supriya](https://github.com/josiah-wolf-oberholtzer/supriya)
* [TOML](https://toml.io/en/)


## Notation

* https://sneslab.net/wiki/Music_Macro_Language
* https://objectcomputing.com/resources/publications/sett/january-2008-writing-music-in-java-two-approaches
* https://mascii.org/
* https://www.mobilefish.com/tutorials/rtttl/rtttl_quickguide_specification.html
* https://pypi.org/project/musicpy/
* [Kodou](https://kodou.readthedocs.io/en/latest/)


## Similar projects

* https://foxdot.org/ / https://github.com/Qirky/FoxDot


## Troubles

* https://stackoverflow.com/questions/47247814/pygame-midi-init-function-errors

* Missing `/usr/local/share/alsa/alsa.conf`
```
ALSA lib conf.c:4555:(snd_config_update_r) Cannot access file /usr/local/share/alsa/alsa.conf
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
```

```
sudo mkdir /usr/local/share/alsa
sudo ln -s /usr/share/alsa/alsa.conf /usr/local/share/alsa/alsa.conf
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://projects.om-office.de/frans/pocketrockit.git",
    "name": "pocketrockit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Frans F\u00fcrst",
    "author_email": "frans.fuerst+gitlab@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9f/d4/7cfd1e8f3c4f1562e6babe27ec848ad1df28328ff58de7a4cc1a32c44df5/pocketrockit-0.0.31.tar.gz",
    "platform": null,
    "description": "# POCKETROCKIT - A rocket in your pocket that rocks!\n\nOriginal project page: https://projects.om-office.de/frans/pocketrockit.git\n\nWrite a music track in Python and play it while you write it (as you might know it from\n[Sonic Pi](https://sonic-pi.net/), but written in Python (`sonic.py` was not available on PyPi, though)).\n\nWrite melodies, create rythm patterns, define endless simultaneously playing instruments, all in\na .. well .. simple Python syntax.\n\n\n## Installation\n\n```sh\n[<PYTHON> -m] pip[3] install [--upgrade] pocketrockit\n```\n\n\n## Usage\n\nWorkflow is not quite mature yet, so here is the short version for now.\n\nCreate and enter a separate folder and provide required SoundFont files (configurable later,\nhard-coded for now).\n\nPocketrockt expects two SoundFont files: `instrumental.sf2` and `drums.sf2`. You can download and\nmove/rename any file that works for you, and you can also just create symlinks (this is what I do).\n\nThis is just an example:\n\n```sh\nmkdir mytracks\ncd mytracks\nln -s /usr/share/soundfonts/FluidR3_GM.sf2 instrumental.sf2\nwget https://musical-artifacts.com/artifacts/2744/JV_1080_Drums.sf2\nln -s JV_1080_Drums.sf2 drums.sf2\n```\nThe file `FluidR3_GM.sf2` was shipped with FluidSynth for me, and I got `JV_1080_Drums.sf2` from\n[here](https://musical-artifacts.com/artifacts/2744).\n\n\nCreate a file `myfirsttrack.py` with the following content:\n\n```python\n#!/usr/bin/env python3\n\nfrom pocketrockit import Env, midiseq, player, track\n\n@track\ndef my_first_track(env: Env):\n\n    @player\n    def metronome():\n        yield from midiseq(\"x x x x\", channel=128, note=37)\n\n    @player\n    def melody1():\n        yield from midiseq(\n            \"| .                .                 .                (II I)      \"\n            \"| (II  VI<)        (IV< VI< . II<)   .                (II I)      \"\n            \"| (II  VI<)        (IV< VI< . II<)   .                (II III)    \"\n            \"| (IV  . III IV)   (. IV . II)       (III . II III)   (. III . I) \"\n            ,\n            key=\"A5\", channel=13)\n```\n\nNow - keeping the editor open for later use - execute this file. You can either make it executable\nand run it directly or you run `python3` instead:\n\n```sh\nchmod +x myfirsttrack.py\n./myfirsttrack.py\n\n# or\n\npython3 myfirsttrack.py\n```\n\n\n## Development & Contribution\n\n```sh\npip3 install -U poetry pre-commit\ngit clone --recurse-submodules https://projects.om-office.de/frans/pocketrockit.git\ncd pocketrockit\npre-commit install\n# if you need a specific version of Python inside your dev environment\npoetry env use ~/.pyenv/versions/3.10.4/bin/python3\npoetry install\n```\n\nAfter modifications, this way a newly built wheel can be checked and installed:\n\n```sh\npoetry build\npoetry run twine check dist/pocketrockit-0.0.25-py3-none-any.whl\npython3 -m pip install --user --upgrade dist/pocketrockit-0.0.25-py3-none-any.whl\n```\n\n\n## Stuff to read / Sources\n\n### SoundFonts\n\n* https://musescore.org/en/handbook/3/soundfonts-and-sfz-files\n* https://www.producersbuzz.com/category/downloads/download-free-soundfonts-sf2/\n* https://archive.org/details/500-soundfonts-full-gm-sets\n* https://ia802502.us.archive.org/view_archive.php?archive=/27/items/500-soundfonts-full-gm-sets/500_Soundfonts_Full_GM_Sets.zip\n* https://musical-artifacts.com/artifacts?formats=sf2&tags=soundfont\n\nflatpak install flathub com.polyphone_soundfonts.polyphone\nflatpak run com.polyphone_soundfonts.polyphone instrumental.sf2\n\n\n### Music stuff\n\n* https://pianoscales.org/major.html\n* https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies\n* https://onlinesequencer.net/181312\n* https://github.com/Rainbow-Dreamer\n* https://github.com/Rainbow-Dreamer/musicpy-daw\n* https://sound.stackexchange.com/\n* [librosa](https://librosa.org/doc/latest/advanced.html)\n* [PO-20 Arcade key signatures for chords](https://pocketoperations.com/pocket-operator-cheatsheets.html#po-20-arcade-key-signatures-for-chords)\n\n#### Drum patterns\n\n* [Pocket Operations](https://shittyrecording.studio/)\n* [10 Popular Drum Patterns Every Producer Should Know](https://www.youtube.com/watch?v=c7ffMObdxro)\n* [Making Reggae & Dub music (2) Stepper beat](https://www.youtube.com/watch?v=o-qHwO8wE0c)\n* [Dub Reggae Drum Beat Backing Track 150 bpm](https://www.youtube.com/watch?v=RCKn3TReYKM)\n* [The Basics Of Reggae Drumming](https://www.youtube.com/watch?v=mxUHE5XC_mI)\n\n\n### Tech stuff\n\n* https://stackoverflow.com/questions/20023545/running-pyfluidsynth-pyaudio-demo-many-problems-with-alsa-and-jack\n* https://www.ladspa.org/\n* [How can I record audio output from command line in Linux?](https://superuser.com/questions/1570333/how-can-i-record-audio-output-from-command-line-in-linux)\n* [Communicating between SuperCollider and Python](https://capital-g.github.io/musikinformatik-sose2021/00_basics/osc_communication.html)\n* https://pypi.org/project/sc3/ / https://github.com/smrg-lm/sc3\n* https://pypi.org/project/supercollider/ https://github.com/ideoforms/python-supercollider\n* [supriya](https://github.com/josiah-wolf-oberholtzer/supriya)\n* [TOML](https://toml.io/en/)\n\n\n## Notation\n\n* https://sneslab.net/wiki/Music_Macro_Language\n* https://objectcomputing.com/resources/publications/sett/january-2008-writing-music-in-java-two-approaches\n* https://mascii.org/\n* https://www.mobilefish.com/tutorials/rtttl/rtttl_quickguide_specification.html\n* https://pypi.org/project/musicpy/\n* [Kodou](https://kodou.readthedocs.io/en/latest/)\n\n\n## Similar projects\n\n* https://foxdot.org/ / https://github.com/Qirky/FoxDot\n\n\n## Troubles\n\n* https://stackoverflow.com/questions/47247814/pygame-midi-init-function-errors\n\n* Missing `/usr/local/share/alsa/alsa.conf`\n```\nALSA lib conf.c:4555:(snd_config_update_r) Cannot access file /usr/local/share/alsa/alsa.conf\nALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default\n```\n\n```\nsudo mkdir /usr/local/share/alsa\nsudo ln -s /usr/share/alsa/alsa.conf /usr/local/share/alsa/alsa.conf\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Live music coding inspired by Sonic Pi",
    "version": "0.0.31",
    "project_urls": {
        "Homepage": "https://projects.om-office.de/frans/pocketrockit.git",
        "Repository": "https://projects.om-office.de/frans/pocketrockit.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f346b801cf56f6faf685bfa4c3f83913785af4a1dac9d3f42eedb1498f80ef4",
                "md5": "d89e836a3123dfa3f1a1b1b6b671ac89",
                "sha256": "5189b936414ffc9e07e8c67c9490db98f413f21dc2b4b91eecc0432a5028e65f"
            },
            "downloads": -1,
            "filename": "pocketrockit-0.0.31-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d89e836a3123dfa3f1a1b1b6b671ac89",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 25928,
            "upload_time": "2023-09-23T11:40:56",
            "upload_time_iso_8601": "2023-09-23T11:40:56.592434Z",
            "url": "https://files.pythonhosted.org/packages/7f/34/6b801cf56f6faf685bfa4c3f83913785af4a1dac9d3f42eedb1498f80ef4/pocketrockit-0.0.31-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9fd47cfd1e8f3c4f1562e6babe27ec848ad1df28328ff58de7a4cc1a32c44df5",
                "md5": "68ee8bab0c690d247b7462ff360a1c25",
                "sha256": "358a39390258e8a0815b70cbdd84fdabfc01f4d41413d941ed8ed7b827d5c606"
            },
            "downloads": -1,
            "filename": "pocketrockit-0.0.31.tar.gz",
            "has_sig": false,
            "md5_digest": "68ee8bab0c690d247b7462ff360a1c25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 25635,
            "upload_time": "2023-09-23T11:40:58",
            "upload_time_iso_8601": "2023-09-23T11:40:58.465808Z",
            "url": "https://files.pythonhosted.org/packages/9f/d4/7cfd1e8f3c4f1562e6babe27ec848ad1df28328ff58de7a4cc1a32c44df5/pocketrockit-0.0.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-23 11:40:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pocketrockit"
}
        
Elapsed time: 0.12703s