Git Product home page Git Product logo

mpclivexplore-libs's Introduction

__ __| |           |  /_) |     ___|             |           |
  |   __ \   _ \  ' /  | |  / |      _ \ __ \   |      _` | __ \   __|
  |   | | |  __/  . \  |   <  |   |  __/ |   |  |     (   | |   |\__ \
 _|  _| |_|\___| _|\_\_|_|\_\\____|\___|_|  _| _____|\__,_|_.__/ ____/

MPCLiveXplore-libs

Special libraries and code for MPC and Force devices NB : You need SSH images uopdate to use these libraries.

For detailed documentation, check the wiki.

TKGL_MIDIMAPPER

This LD_PRELOAD library allows you to reconfigure the keys inaccessible in midi learn like PLAY START, STOP on the MPC, or LAUNCH, MATRIX, MIXER on the Force for example. A plugin system allows to load the configuration designed for the midi device you are using.

---------------------------------------------------------
  TKGL_MIDIMAPPER Version : BETA2
  (c) The KikGen Labs.
  https://github.com/TheKikGen/MPC-LiveXplore
  ---------------------------------------------------------
  MPC args : --tkplg=./tmm-plugins/tmm-IamForce-KIKPADMK3.so --tkhelp

  --tkplg specified. File ./tmm-plugins/tmm-IamForce-KIKPADMK3.so will be used for midi mapping

  --tkhelp                       : Show this help
  --tkclient=<client name regex> : Alsa sequencer client name regex used to find the midi controller client.
                                 : Use aconnect -l to find your controller port. 
  --tkport=<port>                : Alsa client sequencer port. Use aconnect -l to find your controller port.
  --tkplg=<plugin file name>     : Use plugin <file name> to transform & route midi events
  --tkdump                       : Dump original raw midi flow
  --tkdumpP                      : Dump raw midi flow after transformation

Example : # LD_PRELOAD=./tkgl_midimapper.so MPC --tkclient=".*MyControllerName.*" --tkport=1 --tkplg=./tmm-plugins/tmm-IamForce2LPMK3.so

To create your own plugin, you need to use C language, used for performance reasons. You need an ARM toolchain and a C compiler (this will be the subject of a later post). For example, I created a plugin for my A800 master keyboard to launch scenes 1 to 8 from pads 1 to 8, and mapped the play, stop, rec keys to the PLAY, STOP ALL, REC keys of my Force. It's very nice to be able to control the workflow from my master keyboard.

IamForce2 is also fully written as a plugin of midimapper. Currently, the following IamForce2 plugins are available (beta versions) :

  • Iamforce-APCKEY25MK2 Iamforce2 for the Akai APC Key 25 Mini Mk2
  • Iamforce-APCMINIMK2 Iamforce2 for the Akai APC Mini Mk2
  • Iamforce-KIKPADMK3 Iamforce2 for the Kikgen Kikpad LMPK3 emaulation
  • Iamforce-LPMK3 IamForce2 for the Novation Launchpad mini MK3
  • Iamforce-LPX Iamforce for the Novation Launchpad X
  • Iamforce-NONE Iamforce in standalone mode no controller mapping)

See detailed documentation in the WIKI (TBD).

NB: you need ssh access to your MPC.

TKGL_ANYCTRL TKGL_ANYCTRL_LT (deprecated)

These 2 "low-level" libraries allows you to set up any controller as a control surface to drive the MPC standalone application.

NB: you need ssh access to your MPC.

When pressing buttons (START,STOP, MAIN, SHIFT, qlinks, pads, etc...), the hardware MPC/Force surface controller sends a corresponding note on / note off or a cc midi msg. By a simple midi message mapping in your own controller, it is possible now to simulate "buttons" press, and get more shortut like those of the MPC X (track mute, pad mixer, solo, mute, etc...) or to add more pads or qlinks.

How is it done ?

# amidi -l
Dir Device    Name
IO  hw:1,0,0  MPC Public
IO  hw:1,0,1  MPC Private
IO  hw:1,0,2  MPC MIDI Port A
IO  hw:1,0,3  MPC MIDI Port B
IO  hw:2,0,0  Midi Out
IO  hw:2,0,1  Midi Out
IO  hw:2,0,2  Midi Out
IO  hw:2,0,3  Midi Out

The "PRIVATE" and "PUBLIC" ports used by the MPC application to send or capture messages from the MPC controller are replaced by a 3 rawmidi virtual seq ports (usually #134-135-136). These virtual ports are reconnected to the physical ports of the controller with an alsa connection, similar to the "aconnect" command line ALSA utility, before the sending of SYSEX controller identification sequences. These virtual ports can be then used to connect any other controller in addition to the standard hardware.
Note that,as a side effect, midi running status are inhibited.

So , now, you can add "buttons" allowing direct access to the different screens of the MPC application, as the MPC X or ONE do.
You can even consider making a dedicated DIY usb controller (check my other Kikpad project) to add buttons or qlinks (like SOLO or MUTE buttons on the MPC Live for example).

Note : MPC users can use the "global mapping" approach to get the same result. The Force is not with us, and doesn't have (yet) this controller mode.

Quick setup

Copy the tkgl_anyctrl.so library on a usb stick of a smartcard.
tkgl_anyctrl_lt.so is exactly the same, but will map only private port. It is enough for simple button mapping.

The "ANYCTRL_NAME" environment varaible can contains a regex pattern matching the name of the midi controller + port you want to use to simulate a MPC controller. You can use a "aconnect -l" command to get your controller exact ports names.
To avoid crashes due to potential infinite midi loops, the first midi port of your controller will be disabled within the MPC application, so you will not see it anymore in midi devices setting.

If that variable is not defined, the application will start as usual, but will still use virtual ports in place of hardware ports. You can retrieve the name of your midi controller with a "aconnect -l | grep client" command. If you do this in an ssh session manually, don't forget to stop the MPC application with a "systemctl stop inmusic-mpc" command.

The LT version doesn't not remap the "Public" port, if you don't need specific MPC sysex.

Example (after a fresh boot) :

# systemctl stop inmusic-mpc"

# aconnect -l | grep client
client 0: 'System' [type=kernel]
client 20: 'MPC Live Controller' [type=kernel,card=1]
client 24: 'KIKPAD' [type=kernel,card=2]
client 130: 'Virtual MIDI Output 1 Input' [type=user,pid=265]
client 131: 'Virtual MIDI Output 2 Input' [type=user,pid=265]
client 132: 'Virtual MIDI Input 1 Output' [type=user,pid=265]
client 133: 'Virtual MIDI Input 2 Output' [type=user,pid=265]

# export ANYCTRL_NAME="KIKPAD";LD_PRELOAD=/media/tkgl/mpcroot/root/preload_libs/tkgl_anyctrl.so /usr/bin/MPC
------------------------------------
TKGL_ANYCTRL V1.0 by the KikGen Labs
------------------------------------
(tkgl_anyctrl) MPC card id hw:1 found
(tkgl_anyctrl) MPC Private port is hw:1,0,1
(tkgl_anyctrl) MPC Public port is hw:1,0,0
(tkgl_anyctrl) MPC seq client is 20
(tkgl_anyctrl) KIKPAD connect port is 24:0
(tkgl_anyctrl) Virtual private input port 134 created.
(tkgl_anyctrl) Virtual private output port 135 created.
(tkgl_anyctrl) Virtual public output port 136 created.
(tkgl_anyctrl) connection 20:1 to 134:0 successfull
(tkgl_anyctrl) connection 135:0 to 20:1 successfull
(tkgl_anyctrl) connection 136:0 to 20:0 successfull
(tkgl_anyctrl) connection 24:0 to 134:0 successfull
(tkgl_anyctrl) connection 135:0 to 24:0 successfull
(tkgl_anyctrl) connection 136:0 to 24:0 successfull
MPC 2.8.1
failed to change state
failed to switch mux to internal
(tkgl_anyctrl) Port creation disabled for first port of : KIKPAD MIDI IN
(tkgl_anyctrl) Port creation disabled for : Client-135 Virtual RawMIDI
(tkgl_anyctrl) Port creation disabled for : Client-136 Virtual RawMIDI
(tkgl_anyctrl) Port creation disabled for : Client-134 Virtual RawMIDI
(tkgl_anyctrl) hw:1,0,1 substitution by virtual rawmidi successfull
(tkgl_anyctrl) hw:1,0,1 substitution by virtual rawmidi successfull
(tkgl_anyctrl) hw:1,0,0 substitution by virtual rawmidi successfull
**** Audio 44100Hz; 2-in; 6-out; 128sample buffer
**** Warning: inefficient input path: hardware=2 filter=4
**** Warning: inefficient output path: hardware=6 filter=8
MPC Live detected
ButtonStates reply from firmware: {0,0,0,0}

Make

You need to setup a 2.30 glibc (version used by the MPC app) to avoid incompatibility issues and undefined symbols when using LD_PRELOAD. The best option is to build a chroot system dedicated for that (it is what I do). If working on a Linux platform (recommended) you will usually cross compile with "arm-linux-gnueabihf-gcc tkgl_anyctrl.c -o tkgl_anyctrl.so -shared -fPIC -ldl"

You can also use the "tkgl_anyctrl" module of the tkgl_bootstrap (under construction).

TKGL_CTRLDUMP

This "low-level" library allows you to spy the traffic between the MPC application and the Akai controller.

# LD_PRELOAD=/media/tkgl/mpcroot/root/preload_libs/tkgl_ctrldump.so /usr/bin/MPC
MPC 2.9.0
--------------------------------------
TKGL_CTRLDUMP V1.0 by the KikGen Labs
--------------------------------------
(tkgl_ctrldump) MPC card id hw:1 found
(tkgl_ctrldump) MPC Private port is hw:1,0,1
(tkgl_ctrldump) MPC Public port is hw:1,0,0
(tkgl_ctrldump) snd_rawmidi_open name hw:1,0,1 mode 2
(tkgl_ctrldump) snd_rawmidi_open name hw:1,0,1 mode 3
(tkgl_ctrldump) snd_rawmidi_open name hw:1,0,0 mode 3
**** Audio 44100Hz; 2-in; 6-out; 128sample buffer
**** Warning: inefficient input path: hardware=2 filter=4
**** Warning: inefficient output path: hardware=6 filter=8
MPC      --> hw:1,0,0 = F0 7E 00 06 01 F7                                | .~....

hw:1,0,1 --> MPC      = F0 7E 00 06 02 47 3B 00 19 00 01 01              | .~...G;.....


MPC      --> hw:1,0,0 = F0 47 7F 3B 62 00 01 65 F7 F0 47 7F 3B 64 00 03  | .G.;b..e..G.;d..
                        00 01 01 F7 F0 47 7F 3B 64 00 03 01 01 01 F7 F0  | .....G.;d.......
                        47 7F 3B 64 00 03 02 00 00 F7 F0 47 7F 3B 64 00  | G.;d.......G.;d.
                        03 03 00 00 F7 F0 47 7F 3B 63 00 03 00 00 00 F7  | ......G.;c......
                        F0 47 7F 3B 63 00 03 01 00 00 F7 F0 47 7F 3B 41  | .G.;c.......G.;A
                        00 00 F7 F0 7E 00 06 01 F7                       | ....~....

hw:1,0,1 --> MPC      = F0 47 7F 3B 64 00 03 00 01 01 F7 F0 47 7F 3B 64  | .G.;d.......G.;d
                        00 03 01 01 01 F7 F0 47 7F 3B 64 00 03 02 00 00  | .......G.;d.....
                        F7 F0 47 7F 3B 64 00 03 03 00 0A F7              | ..G.;d......

hw:1,0,1 --> MPC      = F0 47 7F 3B 41 00 13 00 00 00 00 00 00 00 00 00  | .G.;A...........
                        00 00 00 00 00 00 00 00 00 00 F7                 | ...........

TKGL_MPCMAPPER

(DEPRECATED - USE TKGL_MIDIMAPPER INSTEAD)

This "low-level" library allows you to hijack the MPC/Force application to add your own midi mapping to input and output midi messages. This library is used for the new version of IamForce, as mpcmapper allows to hack MPCs or Force

You can use the following options on the LD_PRELOAD command line : --tgkl_help : Show this help
--tkgl_ctrlname= : Use external controller containing
--tkgl_iamX : Emulate MPC X on your current hardware
--tkgl_iamLive : Emulate MPC Live on your current hardware
--tkgl_iamForce : Emulate Force on your current hardware
--tkgl_iamOne : Emulate MPC One on your current hardware
--tkgl_iamLive2 : Emulate MPC Live Mk II on your current hardware
--tkgl_virtualport= : Create end user virtual port that will be visible within the MPC application
--tkgl_mididump : Dump original raw midi flow (similar to TKGL_CTRLDUMP)
--tkgl_mididumpPost : Dump raw midi flow after transformation used to dump midi message after transformation
--tkgl_configfile= : Use configuration file notably to map current harware buttons to specific emulated device funtion

TKGL_IAMFORCE

A first derivative POC based on the anyctrl library allowed hardware identity spoofing. I used that to run the Force MPC application on an MPC Live connected to a 8x8 pads controlleur.

The new IamForce project is based on tkgl_midimapper. See detailed documentation in the wiki (TBD).

mpclivexplore-libs's People

Contributors

thekikgen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mpclivexplore-libs's Issues

mpc-live2 - iamforce hangs at force screen

Hi I have updated 2.11.8 to 2.11.10.
I am now trying the iamforce after installing the 2.11.8 ssh image.

When booting with the iamforce bootloader card in I get the force logo and the kikgen animation flashes up many times however i dont ever get to a booted force.

Any tips?

Launch pad Pro MK3 doesn´t works

Just tryed with a launchpad Pro MK3 using LPPROMK3 sentence in doer_list and doesn´t works, Launchpad Pro MK3 is not detected.

It seems there is a driver for LP PRO MK3 in bootstrap modules with the name LPPROMK3 which I used.

With my LP Mini MK3 it works perfect using LPMK3 and driver is loaded and working perfectly.

Is there somenthing I´m missing for have LP PRO MK3 working? maybe somenthing to configure in Launch Pad?

I think extra buttons in Pro MK3 could be great and more close to real Force.

Thanks

Midimapper issue on MPC Live

Gennadiy Boychenko
Here is the deepest I got. I couldn't make it work
[tkgl INFO ] MPC args : --tkplg=./tmm-demoForceNextSeq.so --tkport=24:0
[tkgl INFO ]
[tkgl INFO ] --tkplg specified. File ./tmm-demoForceNextSeq.so will be used for midi mapping
[tkgl INFO ] --tkport specified. Midi Seq port (24:0) will be captured
[tkgl INFO ] Product code : ACV8 (MPC Live)
[tkgl ***FATAL] ./tmm-demoForceNextSeq.so midipapper library loading error or not found

Iamforce2 .

Hi. How to make it work? Is there a tutorial of some kind?

I need to port my button configuration from *.conf file, so surface would work the same + external midi ctrl of things like scene launch , crossfade etc.

How to reassign MPC surface buttons and external macros?

Hi! I found that Iamforce2 works wonderfully. It takes up 20 - 25% less memory than before! It's a breaktrhough. Pads are now much more useful with its new modes etc. What I'm missing is the ability to customize UI for my liking and use. I found that in IamForce2.c inside tmm-plugins folder contains all the data I need to change, including Macro assignment and enumaration. I've edited functions I wanted, but what should I do with edited file? I tried compiling it with linux GCC to .so and renaming to tkgl_midimapper.so , but just got crash. Any clues how make it work and customize layout?

tkgl_mod_install.sh chown did not work

if it should chown recursively then
chown root:root $TKGL_BIN/*
did not work for me. i changed it to
chown root:root $TKGL_BIN -R

#!/bin/sh
#
# __ __| |           |  /_) |     ___|             |           |
#    |   __ \   _ \  ' /  | |  / |      _ \ __ \   |      _` | __ \   __|
#    |   | | |  __/  . \  |   <  |   |  __/ |   |  |     (   | |   |\__ \
#   _|  _| |_|\___| _|\_\_|_|\_\\____|\___|_|  _| _____|\__,_|_.__/ ____/
#
# BOOTSTRAP INSTALL script for MPC device.
# install      : setup some directories and permissions on the filesystem

SCRIPT_NAME=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_NAME")
source "$SCRIPT_DIR/../../scripts/tkgl_path"

# creates all the directories again because empty dirs can be missing

echo "*** The KiGenLabs bootstrap install script"
echo "Directories creation..."
mkdir -p $TKGL_SCRIPT
mkdir -p $TKGL_BIN
mkdir -p $TKGL_CONF
mkdir -p $TKGL_LOGS
mkdir -p $TKGL_LIB

echo "*** $0 module">>$TKGL_LOG

echo "Changing permission and ownership in /bin /scripts..."

if [ -d "$TKGL_BIN" ]
then
  chown root:root $TKGL_BIN -R
  chmod 755 $TKGL_BIN -R
fi

if [ -d "$TKGL_SCRIPT" ]
then
  chown root:root $TKGL_SCRIPT -R
  chmod 755 $TKGL_SCRIPT -R
fi

if [ -d "$TKGL_LIB" ]
then
  chown root:root $TKGL_LIB -R
  chmod 755 $TKGL_LIB -R
fi

ls $TKGL_ROOT>>$TKGL_LOG
ls -l $TKGL_BIN>>$TKGL_LOG
ls -l $TKGL_SCRIPT>>$TKGL_LOG

echo "*** Done !"
echo "*** Please check $TKGL_LOG"

`

How to mute pad without mute button?

On Force, when You push Mute and select PAD it will silence it, for example eilence kick, and let other sounds playing. How to do it on IAmForce2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.