Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export-to-wav CLI utility. #372

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

trh-x
Copy link

@trh-x trh-x commented Dec 30, 2024

export-to-wav

This PR introduces a command-line utility called export-to-wav which can be used for scripting exports.

Multi-track

The utility includes the ability to export in multi-track mode. When doing so, WAVs which are silent will automatically be removed.

Usage

Usage: ./build/src/tools/export-to-wav/export-to-wav <input.xm> <output.wav> [options]
Options:
  --sample-rate <rate>  Sample rate in Hz (default: from settings or 44100)
  --volume <volume>     Mixer volume (default: from settings or 256)
  --shift <shift>       Mixer shift (default: from settings or 1)
  --resampler <type>    Resampler type (default: from settings or 4)
  --multi-track         Export each track to a separate WAV file

When using --multi-track, output files will be named:
  output_01.wav, output_02.wav, etc.
  (Silent tracks will be automatically removed)

Notes

A few other changes are included, some of which might be preferable to omit or merge separately:

  • Add trackerlib library to allow reusing code from the tracker in the CLI utility.
  • Switch C++ standard to C++11 (see Switch C++ standard to C++11 #328).
  • Add functionality to build.sh:
    • Allow a debug build to be built.
    • Allow DMG generation to be skipped on Mac.

@trh-x trh-x changed the title Trh/export to wav Add export-to-wav CLI utility. Dec 30, 2024
@trh-x trh-x force-pushed the trh/export-to-wav branch 3 times, most recently from efa05f5 to f715c25 Compare December 30, 2024 17:18
@trh-x trh-x force-pushed the trh/export-to-wav branch from 26747f6 to e2737e7 Compare December 30, 2024 19:32
@trh-x trh-x force-pushed the trh/export-to-wav branch from e2737e7 to 597893e Compare December 30, 2024 22:32
@trh-x trh-x force-pushed the trh/export-to-wav branch from 597893e to 8254e04 Compare December 30, 2024 22:37
@trh-x trh-x marked this pull request as ready for review January 1, 2025 03:37
@coderofsalvation
Copy link
Contributor

coderofsalvation commented Jan 10, 2025

Very cool!
Btw. have you seen: 31ba8a9

Which is basically:

image

image

I really like love the idea of having this available in a scriptable/batch way (for example to use in combination with faircamp)

questions:

  1. Could this be also added to the milkytracker binary (right now it just detects one arguments, and loads it as a module).
  2. should we rename trackerlib to commandlib or clilib or something to make it more specific

Reason: I've been thinking of a cli interface for milkytracker before, and I can think of more usecases (besides exporting). For example: we have some env-vars (MIDI_IN and SCALE_NEAREST) but they are very hidden in the docs.

So WDYT about this:

$ milkytracker --help
Usage: milkytracker [options]
Options:
  --export <input.xm> <output.wav> [options]  export input to WAVs
  
      --sample-rate <rate>                              Sample rate in Hz (default: from settings or 44100)
      --volume <volume>                                Mixer volume (default: from settings or 256)
      --shift <shift>                                          Mixer shift (default: from settings or 1)
      --resampler <type>                                Resampler type (default: from settings or 4)
      --multi-track                                            Export each track to a separate WAV file

       When using --multi-track, output files will be named:
       output_01.wav, output_02.wav, etc.
        (Silent tracks will be automatically removed)

Then later --midi-in and --scale-nearest can be added as args, and who knows what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants