Skip to main content

pocketrockit

Project description

POCKETROCKIT - A rocket in your pocket that rocks!

Project page

Write a music track and play it while you write it. As you might know it from Sonic Pi, but in Python (sonic.py was not available on PyPi, though).

Usage

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

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

mkdir mytracks
cd mytracks
cp /usr/share/soundfonts/FluidR3_GM.sf2 .

Download Roland JV-1080 Drums (JV_1080_Drums.sf2) to that directory.

Create a file myfirsttrack.py with the following content:

#!/usr/bin/env python3

from pocketrockit.decorated import Env, midiseq, player, track

@track
def po20(env: Env):
    """A Pocket Operator PO-20 Arcade (well, not yet)"""

    env.bpm = 60
    key = "C3"

    @player
    def melody():
        yield from midiseq(
            " t6  t5  t6  t3 "
            " t1  t3  t0  .  "
            " .   .   .   .  "
            " .   .   .   .  ",
            key=key,
            channel=25,
        )

    @player
    def drums1():
        yield from midiseq(
            "x .  x  . "
            "x .  .  . "
            "x .  x  . "
            "x .  x  x ",
            channel=128,
            note=33,
        )

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:

chmod +x myfirsttrack.py
./myfirsttrack.py

# or

python3 myfirsttrack.py

Installation

[<PYTHON> -m] pip[3] install [-U] pocketrockit

Development & Contribution

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

Stuff to read / Sources

SoundFonts

Music theory

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pocketrockit-0.0.8.tar.gz (12.0 kB view hashes)

Uploaded Source

Built Distribution

pocketrockit-0.0.8-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page