Sha256: 019f20f0804f73f901dd24de8c2251ca1d12418c954e30c087e430073f574ccd

Contents?: true

Size: 892 Bytes

Versions: 7

Compression:

Stored size: 892 Bytes

Contents

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

FNAME=${1:-}

if [[ $FNAME == "" ]]; then
  echo "Usage: extract_midi_monitor_sample.sh <save_file.mmon>"
  exit 1
fi

plutil -convert xml1 $FNAME

xpath $FNAME "//dict/data" 2>/dev/null |
  grep -v -E '(^<data>)|(</data>$)' |
  base64 -D |
  plutil -convert xml1 - -o - > ${FNAME%.mmon}.tmp

# Not sure we're guaranteed to get the same number of elements every time,
# so the `5` below may be brittle!
xpath ${FNAME%.mmon}.tmp "//dict/array/dict[5]/data" 2>/dev/null |
  grep -v -E '(^<data>)|(</data>$)' |
  base64 -D > ${FNAME%.mmon}.1.raw

xpath ${FNAME%.mmon}.tmp "//dict/array/dict[9]/data" 2>/dev/null |
  grep -v -E '(^<data>)|(</data>$)' |
  base64 -D > ${FNAME%.mmon}.2.raw

xpath ${FNAME%.mmon}.tmp "//dict/array/dict[11]/data" 2>/dev/null |
  grep -v -E '(^<data>)|(</data>$)' |
  base64 -D > ${FNAME%.mmon}.3.raw

rm ${FNAME%.mmon}.tmp

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
surface_master-0.6.0 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.5.1 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.5.0 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.4.1 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.4.0 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.2.1 debug_tools/extract_midi_monitor_sample.sh
surface_master-0.2.0 debug_tools/extract_midi_monitor_sample.sh