Skip to content
TheKikGen edited this page Nov 30, 2023 · 45 revisions

Welcome to the MPCLiveXplore-libs wiki!

IamForce2 User Manual:

iamforce video

IamForce allows your MPC to become a Force. IamForce2 is an entirely rewritten version of the first version, and now supports several midi devices with a plugin system. A new standalone mode is also available if you haven't any external controller.

IamForce2 does not update your MPC, but prepares and launches an isolated environment for the Force software ONLY from the external SD card. If you remove the card, you will find your MPC as usual at the next boot. However, you must update your MPC to a recent ssh firmware, being provided at the root of the card, so you can update directly from the MPC user interface. If you own a MPC Live mk1 or mk2, IamForce2 can be used unplugged, on battery.

Installation

Pre-requisite :

  • to have a sd card or a usb key of at least 4Go .
  • Knowing the IP address of your MPC (see preferences)

Steps :

  1. Download the latest sdcard img of the bootstrap here
  2. Flash the image on your sd card. NB : this one will be entirely erased. I recommend the use of a tool like Etcher, which will avoid you to make mistakes.
  3. Once the image is flashed, start your MPC without inserting the card for the moment
  4. For Iamforce2 to run correctly, you must have the latest MPC firmware. Once your MPC has started, insert the card, and update the firmware with the latest version of the tkgl ssh image present on the sdcard (unless you have already done so) by choosing update from USB. After a successful uodate, it is recommended to delete the update image from the sdcard to save space.
  5. Your MPC will restart, and you should see a "The KikGen Labs" logo appear quickly. You now have an SSH connection. By default the bootstrap will only display the logo. We need to tell it that we also want to run IamForce2. To do this, you will have to modify the launch script, to add the corresponding module.
    Open a command line on your computer, and type the following commands (be careful to type the space before "iamforce2"):
ssh root@(your MPC ip address) 'echo TKGL_DOER=\"playlogo iamforce2@APCMINIMK2\">>/media/TKGL_BOOTSTRAP/tkgl_bootstrap_[ProjectData]/doer_list'
ssh root@(your MPC ip address) reboot

Eventually, delete the tkgl ssh update image file with the following command :

ssh root@(your MPC ip address) rm /media/TKGL_BOOTSTRAP/mpc-*.tkglssh-update.img

Your MPC will reboot, and Iamforce2 should start !
Note that you can change "APCMINIMK2" by "NONE" if you are not using any controller, or by any other driver ID, e.g. LPMK3 for example, for the Launchpad Mini MK3.

If you have some trouble, you can display the content of the doer_list file with :

ssh root@(your MPC ip address) 'cat /media/TKGL_BOOTSTRAP/tkgl_bootstrap_[ProjectData]/doer_list'

If you are a Windows user, I really recommend to use WinSCP SSH utility to browse and explore your MPC directories easily, like you do with the file explorer. On other systems, like Linux, Thunar is able to browse the MPC at "sftp://root@(MPC ip address)".

Updating an existing bootstrap installation

It is not necessary to download again the smarcard image file. The bootstrap can be updated directly from the Github repository with the following command line. Save all your current work before launching that script as the MPC application will be stopped, and the system will reboot at the end of the procedure. Your doer_list file will be preserved.

Current version :

ssh root@(mpc IP) "/media/TKGL_BOOTSTRAP/tkgl_bootstrap_[ProjectData]/scripts/tkgl_update"

Old version (before 19th of November, 2023) :

ssh root@(your mpc ip) "sh /media/TKGL_BOOTSTRAP/tkgl_bootstrap_[ProjectData]/modules/mod_bootstrap_update/tkgl_mod_bootstrap_update.sh force"

Midi controllers implementations :

Driver Ids :

  • NONE : IamForce2 whithout any controller
  • APCMINIMK2 : Akai APC Mini mk2 controller
  • APCKEY25MK2 : Akai APC Key 25 mk2 controller
  • LPMK3 : Novation Launchpad mini mk3 controller
  • LPX : Novation Launchpad X controller
  • LPPROMK3 : Novation Launchpad Pro Mk3 controller
  • LPMK2 : Novation Launchpad Mk2 controller
  • KIKPADMK3 : The KikGen Labs KIKPAD (Smartpad) LPMK3 emulation

IamForce Midi Control Change list

You can control some of the Force functions and special macros with Control Change commands from any midi controller connected to your MPC. To do that, you need to send a specific CC#/parameter value event and route it to the channel 16 of the "TKGL Midi_(controller name)" midi out port. When the CC parameter value is :

  • 0 : that will send an "off" event (ex : button released)
  • 1 : that will send on/off events (ex : button pressed and released)
  • 127 : that will send a "on" event (ex : button pressed)
CC# on channel 16 Allowed parameters Function
0 on, off, on-off PLAY
1 on, off, on-off REC
2 on, off, on-off STOP
3 on, off, on-off TAP
4 any value > 0 Next sequence macro
5 any value > 0 Previous sequence macro
6 any value > 0 First sequence macro
7 any value > 0 Last sequence macro
8 on, off, on-off ARP
9 on, off, on-off UNDO

IamForce2 developper Manual:

A special rootfs image based on Armbian Bullseye 21.0 is available here. Unzip the rootfs image, and copy it to an sd card. A script to mount the image (tkgl_startdev) is included within the zip file.

Step by step :

  1. Unzip the image. You will get 2 files : the TKDEV rootfs image and the launch script.
  2. boot your MPC/Force, without any sdcard in, and wait for the usual welcome screen (nb : you need SSH access on your device)
  3. Format a SDCARD with at less 8Gb of capacity (FAT32 or EXT4 are ok). Use TKDEV as label when formating.
  4. Copy the TKDEV image and the tkgl_startdev script on the root directory of your sdcard (FAT32 works).
  5. Cleanly remove the sdcard from your computer and insert the sdcard in your MPC
  6. login with ssh on your MPC, then cd to the root of your sd card : cd /media/TKDEV
  7. Launch the tkgl_startdev script : (./tkgl_startdev) .

You may need to edit the script to map your context (sdcard label for example. Check the TKGL_PATH and ROOTFS variables). Here is the last version of the launch script, including utility functions :

#!/bin/sh

###############################################################################
# TheKiGen labs - MPC DEV CHROOT
###############################################################################

#=============================================================================

# Environment


SCRIPT_NAME=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_NAME")

TKGL_PATH=$SCRIPT_DIR
ROOTFS_IMG="$1"
MPC_ROOT=$TKGL_PATH/mpcdev
MPC_PID=$(pidof MPC)

#=============================================================================
# Helpers

start_mpc()
{
    # Start MPC if previously stopped by the script
    [ "x$MPC_PID" != "x" ] && systemctl start inmusic-mpc
}

stop_mpc()
{
    # Stop MPC if running
    [ "x$MPC_PID" != "x" ] && systemctl stop inmusic-mpc
    sleep 2

    # In case MPC did not shut down correctly when asked to do so,
    # pretend it did, but removing the file that claims MPC crashed.
    # This is what is officially known as a Terrible Kludge.
    rm "/media/az01-internal/Settings/MPC/MPC.crashinfo"
    rm "/media/az01-internal/Settings/MPC/MPC.running"
}

abort()
{
    echo
    echo "Aborting: $1"

    # Start MPC.
    start_mpc

    exit 1
}

find_midi_device()
{
    for path in '/dev/snd/by-path/platform-ff500000.usb-usb-0:1.5:1.0' \
        '/dev/snd/by-path/platform-ff500000.usb-usb-0:1.6:1.0' \
        '/dev/snd/by-path/platform-ff540000.usb-usb-0:1:1.0'
    do
        device=$(readlink -f "$path") || continue
        card=${device#/dev/snd/controlC}
        if test -e "/dev/snd/midiC${card}D0"
        then
            printf "hw:%d,0,1" "$card"
            return 0
        fi
    done

    return 1
}

start_dfu_util()
{
    # find midi port
    MIDIPORT=$(find_midi_device) || abort "Failed to find MIDI device"

    # start dfu update mode by playing sysex midi file
    amidi --port "${MIDIPORT}" --send /usr/share/Akai/SME0/Firmware/${PLATFORM_UPPER}/SysEx/DfuUpdate${PLATFORM_UPPER}.syx || abort "Could not enter in dfu update mode"
    sleep 2
}

stop_dfu_util()
{
    # find dfu serial
    DFUSERIAL=$(dfu-util -l | sed -ne '/0x08000000/ s/^.*serial="\([^"]*\)".*$/\1/p')

    rm /tmp/dummy.bin
    dfu-util -a 0 -S ${DFUSERIAL} -s 0x08000000:leave -U /tmp/dummy.bin || abort "Could not exit of dfu update mode"
}

# Mount MPC file systems for the chroot

mount_all()
{
 
  echo "Mounting $ROOTFS_IMG $MPC_ROOT.." 
  mkdir -p $MPC_ROOT/hroot
  mount $ROOTFS_IMG $MPC_ROOT
  
  mountpoint -- "$MPC_ROOT/hroot"        ||  mount --bind   /        $MPC_ROOT/hroot
  mountpoint -- "$MPC_ROOT/media"        ||  mount --rbind   /media   $MPC_ROOT/media
  mountpoint -- "$MPC_ROOT/dev"          ||  mount --bind   /dev     $MPC_ROOT/dev
  mountpoint -- "$MPC_ROOT/run"          ||  mount --bind   /run     $MPC_ROOT/run
  mountpoint -- "$MPC_ROOT/tmp"          ||  mount --bind   /tmp     $MPC_ROOT/tmp
  mountpoint -- "$MPC_ROOT/proc"         ||  mount -t proc  /proc    $MPC_ROOT/proc
  mountpoint -- "$MPC_ROOT/sys"          ||  mount -t sysfs /sys     $MPC_ROOT/sys

}


unmount_all()
{
  mountpoint  -- "$MPC_ROOT/sys"   && umount $MPC_ROOT/sys
  mountpoint  -- "$MPC_ROOT/proc"  && umount $MPC_ROOT/proc
  mountpoint  -- "$MPC_ROOT/tmp"   && umount $MPC_ROOT/tmp
  mountpoint  -- "$MPC_ROOT/run"   && umount $MPC_ROOT/run
  mountpoint  -- "$MPC_ROOT/dev"   && umount $MPC_ROOT/dev
  mountpoint  --  $MPC_ROOT/media  && umount -R $MPC_ROOT/media
  #mountpoint  --  $MPC_ROOT/media && umount -R $MPC_ROOT/root/htroot/media
  mountpoint  -- "$MPC_ROOT/hroot" && umount $MPC_ROOT/hroot
  umount $MPC_ROOT
}


resize_mpcimg()
{
  # resize MPC img to 4G
  e2fsck -f $MPC_IMG
  resize2fs $MPC_IMG 4096M
}

check_rootfsimg() {
	e2fsck -f $MPC_IMG
}

chroot_mpc()
{

  cd $TKGL_PATH
  chroot $MPC_ROOT  login -f root

}

#=============================================================================


if [ "$1" == "" ] ; then
        echo "Usage : tkgl_start <image name>"
        exit 0
fi

# Initialize a clean tkgl environnement
stop_mpc
mount_all

# clean strips files

rm /media/tkdev/mpcdev/var/tmp/filmstrips/*

chroot_mpc
unmount_all

Below is an example of the "chrooted" Armbian Bullseye from the Inmusic Linux on a MPC Live :


root@mpc-live:/media/tkdev# ./tkgl_startdev ./TKDEV-2108-rootfs-bullseye_5.10.60.img
Mounting ./TKDEV-2108-rootfs-bullseye_5.10.60.img /media/tkdev/mpcdev..
/media/tkdev/mpcdev/hroot is not a mountpoint
/media/tkdev/mpcdev/media is not a mountpoint
/media/tkdev/mpcdev/dev is not a mountpoint
/media/tkdev/mpcdev/run is not a mountpoint
/media/tkdev/mpcdev/tmp is not a mountpoint
/media/tkdev/mpcdev/proc is not a mountpoint
/media/tkdev/mpcdev/sys is not a mountpoint
rm: can't remove '/media/tkdev/mpcdev/var/tmp/filmstrips/*': No such file or directory
 _____ _            _  ___ _     ____              _          _
|_   _| |__   ___  | |/ (_) | __/ ___| ___ _ __   | |    __ _| |__  ___
  | | | '_ \ / _ \ | ' /| | |/ / |  _ / _ \ '_ \  | |   / _` | '_ \/ __|
  | | | | | |  __/ | . \| |   <| |_| |  __/ | | | | |__| (_| | |_) \__ \
  |_| |_| |_|\___| |_|\_\_|_|\_\\____|\___|_| |_| |_____\__,_|_.__/|___/

Welcome to Armbian 21.08.1 Bullseye with Linux 5.15.89-inmusic-2023-01-18-rt56

System load:   2%             Up time:       9:20
Memory usage:  3% of 1.97G    IP:        192.168.x.xx
Usage of /:    30% of 7.8G
storage/:      24% of 466G    storage temp:  41°C

Last login: Wed Nov 22 21:03:59 UTC 2023 on UNKNOWN
root@mpc-live:~#

You will find a make script named "mk" in the root/MPCLiveXplore-libs/src directory.
To build mysource.c , just enter "./mk mysource". You can use "nano" as a local editor. Or with FileZilla or WinSCP, and open the file via SSH, with Visual Code or any other. You can install any Linux tool you need with the apt-get install command as usual. It is possible to run MPC binaries within this environnement. 3 are provided in the /root (your home) directory (2 for MPC and one MPCFxx for Force).