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, 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
[<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:
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.
Create a file myfirsttrack.py with the following content:
#!/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:
chmod +x myfirsttrack.py
./myfirsttrack.py
# or
python3 myfirsttrack.py
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
After modifications, this way a newly built wheel can be checked and installed:
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
- PO-20 Arcade key signatures for chords
Drum patterns
- Pocket Operations
- 10 Popular Drum Patterns Every Producer Should Know
- Making Reggae & Dub music (2) Stepper beat
- Dub Reggae Drum Beat Backing Track 150 bpm
- The Basics Of Reggae Drumming
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?
- Communicating between SuperCollider and Python
- https://pypi.org/project/sc3/ / https://github.com/smrg-lm/sc3
- https://pypi.org/project/supercollider/ https://github.com/ideoforms/python-supercollider
- supriya
- TOML
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
Similar projects
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
Metadata
Release files for pocketrockit 0.0.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pocketrockit-0.0.31.tar.gz | 25.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pocketrockit-0.0.31-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.6 kB
Release files / pocketrockit-0.0.31.tar.gz
| Download URL | pocketrockit-0.0.31.tar.gz |
|---|---|
| Size | 25.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
358a39390258e8a0815b70cbdd84fdabfc01f4d41413d941ed8ed7b827d5c606
|
|
BLAKE2b-256 checksum How to use checksums |
9fd47cfd1e8f3c4f1562e6babe27ec848ad1df28328ff58de7a4cc1a32c44df5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/6.4.13-200.fc38.x86_64
|
Release files / pocketrockit-0.0.31-py3-none-any.whl
| Download URL | pocketrockit-0.0.31-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5189b936414ffc9e07e8c67c9490db98f413f21dc2b4b91eecc0432a5028e65f
|
|
BLAKE2b-256 checksum How to use checksums |
7f346b801cf56f6faf685bfa4c3f83913785af4a1dac9d3f42eedb1498f80ef4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/6.4.13-200.fc38.x86_64
|
Security for pocketrockit 0.0.31
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.