/loopsong

Loop a song

Primary LanguageCThe UnlicenseUnlicense

loopsong

Loop a song

Features

loopsong is a simple program using Allegro 5 (https://liballeg.org/) to perform song looping. This program should accept any audio formats that Allegro supports for its audio stream API.

Input files use the following format:

# comment
song=/path/to/song.ogg
start=start_seconds
end=end_seconds

[alternate]
start=other_start_seconds
end=other_end_seconds

The song field corresponds to the file path to the audio file to loop. The start and end fields map to the beginning and end loop points for the audio, specified in seconds.

Alternate loop parameters for the same song can be specified using separate sections (i.e. [like this]) for each collection of parameters. Any parameters unspecified in the section are taken from the global parameters at top. The example above provides a single [alternate] section holding different start and end parameters, implicitly using the same song.

Build

This project uses the CMake build system, which one can obtain at https://cmake.org/download/.

After cloning the repository,

git clone https://github.com/codylico/loopsong.git

the user should make and enter a build directory,

mkdir build
cd build

then run CMake from that build directory.

cmake path/to/source/of/loopsong

CMake should generate an IDE project or set of build files. If using a Makefile-based build configuration, then run make.

make

The loopsong program should be built.

Usage

A typical invocation of loopsong looks like the following:

loopsong [options] (file.ini) (seconds)

The (file.ini) argument corresponds to the input file described earlier. The (seconds) argument specifies the amount of time for which to play and loop the song.

Optional arguments are:

  • -f (seconds): The loopsong program can fade out the song towards the end of playback. Set to zero for no fade out.
  • -k (seconds): Playback can start from the seek position given in seconds.
  • -a: If the loopsong program is stopped or put to sleep, setting this option will allow loopsong to reclaim most of the time it missed.
  • -d (section_name): Pull parameters from the [section_name] section in addition to the global parameters. The section-specific parameters have the final say.

Other arguments configure how loopsong adjusts the playback time.

  • -m: The default mode, middle, cuts the song off exactly after the amount of playback time specified. Using -m will likely result in ends of playback that sound abrupt or cut off unless the user employs the fading option (-f).
  • -s: The short mode aims to end with the actual end of the song, preferring to finish early rather than play a partial song.
  • -l: The long mode also aims to end with the actual end of the song. However, playback time may finish later to accomodate a proper conlusion to the song, rather than cut off playback midway through the song.

License

This project uses the Unlicense, which makes the source effectively public domain. Go to http://unlicense.org/ to learn more about the Unlicense.

Contributions to this project should likewise be provided under a public domain dedication.