whitlockjc / m8-js

JavaScript library for parsing Dirtywave M8 files, complete with a CLI for interacting with M8 files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QoL CLI request: Use flags to specifiy which song elements to dump

colonel-blimp opened this issue · comments

I still use a custom nim exe to diff m8 projects, because it's not feasible to view all the information with the m8 CLI command right now.

Instead of a command for individual project elements, like

  • m8 [song] view <filename>
  • m8 [song] table -t <number> <filename> (which requires knowing the table numbers)
  • m8 [song] instrument -i <number> <filename> (which requires knowing the instrument numbers)

It would be much easier to use m8 [song] <filename> to dump everything in the file, using flags to specify what to include ala"

m8 [song] --[no-]global-opts --[no-]chains --[no-]phrases --[no-]tables --[no-]instruments --[no-]scales --[no-]grooves <filename>

or possibly just:

m8 --all <filename> 

The only issue with something like this is that you won't be able to load whatever you dump if you dump only a subset. I would suggest using m8 export in conjunction with jq to manipulate which things you want or don't want. Here is an example where I prune out all chains, grooves, instruments, MIDI mappings, phrases, scales, steps and tables using ./bin/m8 export test/files/Songs/TESTING.m8s | jq 'del(.chains, .grooves, .instruments, .midiMappings, .phrases, .scales, .steps, .tables)':

{
  "fileMetadata": {
    "type": "Song",
    "version": {
      "majorVersion": 2,
      "minorVersion": 7,
      "patchVersion": 0
    }
  },
  "directory": "/Songs/",
  "effectsSettings": {
    "chorusSettings": {
      "modDepth": 1,
      "modFreq": 2,
      "reverbSend": 4,
      "width": 3
    },
    "delaySettings": {
      "feedback": 9,
      "filterHP": 5,
      "filterLP": 6,
      "reverbSend": 11,
      "timeL": 7,
      "timeR": 8,
      "width": 10
    },
    "reverbSettings": {
      "damping": 15,
      "filterHP": 12,
      "filterLP": 13,
      "modDepth": 16,
      "modFreq": 17,
      "size": 14,
      "width": 18
    }
  },
  "key": 0,
  "midiSettings": {
    "controlMapChannel": 17,
    "receiveSync": true,
    "receiveTransport": 1,
    "receiveTransportStr": "PATTERN",
    "recordNoteChannel": 5,
    "recordNoteDelayKillCommands": 3,
    "recordNoteDelayKillCommandsStr": "BOTH",
    "recordNoteVelocity": true,
    "sendSync": false,
    "sendTransport": 2,
    "sendTransportStr": "SONG",
    "songRowCueChannel": 5,
    "trackInputChannel": [
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8
    ],
    "trackInputInstrument": [
      8,
      7,
      6,
      5,
      4,
      3,
      2,
      1
    ],
    "trackInputMode": 2,
    "trackInputModeStr": "POLY",
    "trackInputProgramChange": false
  },
  "mixerSettings": {
    "analogInputChorus": [
      7,
      8
    ],
    "analogInputDelay": [
      10,
      11
    ],
    "analogInputReverb": [
      13,
      14
    ],
    "analogInputVolume": [
      4,
      5
    ],
    "chorusVolume": 1,
    "delayVolume": 2,
    "djFilter": 3,
    "djFilterPeak": 4,
    "masterLimit": 2,
    "masterVolume": 1,
    "reverbVolume": 3,
    "trackVolume": [
      8,
      7,
      6,
      5,
      4,
      3,
      2,
      1
    ],
    "usbInputChorus": 9,
    "usbInputDelay": 12,
    "usbInputReverb": 15,
    "usbInputVolume": 6
  },
  "name": "TESTING",
  "quantize": 1,
  "tempo": 128,
  "transpose": 1
}

I'm not against adding new features, but I think if the idea is to export only chunks for specialized purposes, we can utilize existing tooling to make this much easier. Thoughts?

Looks like my system's m8-js installation was 0.1.0, before there was an export command. 😮‍💨

I agree that this solution is better. Thanks!