Scripts for dealing with e2 pattern files

Discussion relating to the Korg Electribe products.

Moderators: Sharp, X-Trade, Pepperpotty, karmathanever

Post Reply
russellclarke
Junior Member
Posts: 59
Joined: Fri Jun 07, 2019 12:18 pm

Scripts for dealing with e2 pattern files

Post by russellclarke »

Some python scripts for converting e2 pattern files. Should work for e2s with little editing.

https://github.com/synthsofts/e2
  • e2all2pat.py - Converts allpat file to a directory of e2pat files.

    e2pat2syx.py - Converts a pattern file in e2pat format to a pattern file in sysex format.

    e2syx2pat.py - Converts a pattern file in sysex format to pattern file in e2pat format.

    e2seqrot.py - Rotates sequence of specified part by specified number of steps. Takes e2pat as input.

    e2pat2all.py - Create allpatterns from a single pattern.

    e2ev.py - Split event recording by pattern, create stems, mute parts, extract and replace patterns.
Last edited by russellclarke on Thu Jul 18, 2019 7:28 pm, edited 2 times in total.
TheDoctor
Full Member
Posts: 162
Joined: Thu Mar 28, 2019 11:31 am

Re: Scripts for dealing with e2 pattern files

Post by TheDoctor »

russellclarke wrote:Some python scripts for converting e2 pattern files. Should work for e2s with little editing.

https://github.com/synthsofts/e2
  • e2all2pat.py - Converts allpat file to a directory of e2pat files.

    e2pat2syx.py - Converts a pattern file in e2pat format to a pattern file in sysex format.

    e2syx2pat.py - Converts a pattern file in sysex format to pattern file in e2pat format.

    e2seqrot.py - Rotates sequence of specified part by specified number of steps. Takes e2pat as input.
I'm sorry if I sound stupid but can you explain me how it works? I don't have experience with python script
russellclarke
Junior Member
Posts: 59
Joined: Fri Jun 07, 2019 12:18 pm

Post by russellclarke »

I've only tested these scripts on a GNU/Linux system with an e2.

Install Python 3
https://realpython.com/installing-python/

Download zip file of the scripts
https://stackoverflow.com/a/6466993

Extract the zip file.

Open a terminal and change directory to the folder with the scripts in.


Run a script with the --help flag to see a list of options and required arguments, for example:

Code: Select all

python e2all2pat.py  --help

To split an allpat file into a directory of pattern files, the easiest way is to put the allpat file in the same folder as the scripts and run:

Code: Select all

python e2all2pat.py
This should create a folder named split_allpat which contains 250 patterns.


To convert a pattern from e2pat format to syx format, put the pattern file in the same folder as the script and run:

Code: Select all

python e2pat2syx.py filename.e2pat
This will create a sysex file which will dump the pattern to the current pattern on the e2. Save the pattern on the e2 by pressing write twice.


You can create a sysex file which will dump a pattern to a specific pattern number and automatically save by passing the -p flag with a number, for example:

Code: Select all

python e2pat2syx.py -p 64 filename.e2pat
This will create a sysex file that will save the pattern to slot 64 on the e2.


Converting a pattern in syx format to a e2pat format is similar.

Code: Select all

python e2syx2pat.py filename.syx

To rotate the sequence of part 9 by 4 steps, run:

Code: Select all

python e2seqrot.py -p 9 -r 4 -i filename.e2pat
This will overwrite the pattern file with a new version.

Use the -o flag to specify a new output file and keep the original intact. For example:

Code: Select all

python e2seqrot.py -p 9 -r 4 -i filename.e2pat -o rotated.e2pat

These scripts are the early stages of a larger project which is currently on hold. They're not very user friendly yet, so ask if you need further help. They may need minor edits to work on windows and for e2s files.
Last edited by russellclarke on Sat Jun 08, 2019 3:54 pm, edited 1 time in total.
TheDoctor
Full Member
Posts: 162
Joined: Thu Mar 28, 2019 11:31 am

Post by TheDoctor »

russellclarke wrote:I've only tested these scripts on a GNU/Linux system with an e2.

Install Python 3
https://realpython.com/installing-python/

Download zip file of the scripts
https://stackoverflow.com/a/6466993

Extract the zip file.

Open a terminal and change directory to the folder with the scripts in.


Run a script with the --help flag to see a list of options and required arguments, for example:

Code: Select all

python e2all2pat.py  --help

To split an allpat file into a directory of pattern files, the easiest way is to put the allpat file in the same folder as the scripts and run:

Code: Select all

python e2all2pat.py
This should create a folder named split_allpat which contains 250 patterns.


To convert a pattern from e2pat format to syx format, put the pattern file in the same folder as the script and run:

Code: Select all

python e2pat2syx.py filename.e2pat
This will create a sysex file which will dump the pattern to the current pattern on the e2. Save the pattern on the e2 by pressing write twice.


You can create a sysex file which will dump a pattern to a specific pattern number and automatically save by passing the -p flag with a number, for example:

Code: Select all

python e2pat2syx.py -p 64 filename.e2pat
This will create a sysex file that will save the pattern to slot 64 on the e2.


These scripts are the early stages of a larger project which is currently on hold. They're not very user friendly yet, so ask if you need further help. They may need minor edits to work on windows and for e2s files.
Thanks man,I really appreciate it
Poumtschak
Senior Member
Posts: 295
Joined: Sat Jan 06, 2007 11:20 pm
Location: GMT+1

Re: Scripts for dealing with e2 pattern files

Post by Poumtschak »

russellclarke wrote:Some python scripts for converting e2 pattern files. Should work for e2s with little editing.
Very cool, thanks!
The hard pattern decoding work being already done in Max4Live, that could be the foundation of an universal pattern editor in Python.
http://www.maxforlive.com/library/devic ... ern-editor
http://www.maxforlive.com/library/devic ... be-control
TheDoctor wrote:I'm sorry if I sound stupid but can you explain me how it works? I don't have experience with python script
You can also use Thonny, which is a great no brainer Python editor and environment for Windows, Mac and Linux. More user friendly.

https://thonny.org/
My electribe2 lousy patterns and stuff | KORG gear: NTS-1, nanoKEY2, electribe2/2S, WS/SR, WS/EX (on storage)
russellclarke
Junior Member
Posts: 59
Joined: Fri Jun 07, 2019 12:18 pm

Post by russellclarke »

pierluigi added e2pat2all.py.

This adds a script to take an input "Init" pattern file (e.g. 001_Init.e2pat) and use to initialize an entire .e2sallpatterns file. This simplifies the creation of default starting point for different projects.

Workflow:
  • Create the desired settings for the reference Init pattern on the E2S

    Export the individual pattern using the DATA UTILITY menu

    Pass the new pattern file using the -i flag, e.g.

    Code: Select all

    python e2pat2all.py -i 001_Init.e2pat
    Optionally pass a .e2allpatterns file (a default is provided) to maintain preferred global settings

    Load the generated allpatterns file (merged_allpat/electribe_sampler_allpattern.e2sallpat) in the E2S using the DATA UTILITY menu option
russellclarke
Junior Member
Posts: 59
Joined: Fri Jun 07, 2019 12:18 pm

Post by russellclarke »

Added e2ev.py - Split event recording by pattern, create stems, mute parts, extract and replace patterns.


Print info on patterns found in file.e2ev:

Code: Select all

python e2ev.py file.e2ev -i

Split a multi pattern event recording into multiple single pattern event recordings:

Code: Select all

python e2ev.py file.e2ev -s

Create a stem event recording consisting of parts 1, 5 and 16 named 'drums':

Code: Select all

python e2ev.py file.e2ev -c 0 4 15 -n drums
This will create file_drums_stem.e2ev



Mute channel 16 of the event recording:

Code: Select all

python e2ev.py file.e2ev -m 15
This will overwrite the original file.e2ev



Extract all patterns files found in file.e2ev:

Code: Select all

python e2ev.py file.e2ev -e
Patterns will be saved as file_pat_x.e2pat



Replace the second pattern of file.e2ev with pattern.e2pat:

Code: Select all

python e2ev.py file.e2ev -r 1 -p pattern.e2pat

More information on event recording file format:
https://pastebin.com/EFdkK2eq
Post Reply

Return to “Korg Electribe”