How to use the command "vgmstream_cli" (with examples)
The “vgmstream_cli” command is a versatile tool for playing and converting audio formats commonly used in video games. It allows you to decode audio files and convert them into the WAV format. Additionally, you can extract metadata from audio files without decoding them. This article will provide several use cases of the “vgmstream_cli” command along with their respective examples.
Use case 1: Decode an adc
file to wav
Code:
vgmstream_cli path/to/input.adc -o path/to/output.wav
Motivation:
By using this command, you can decode an audio file in the adc
format and convert it into the wav
format. This can be useful when you need to play the audio in a more common format or perform further processing on it.
Explanation:
path/to/input.adc
is the path to the inputadc
file that you want to decode.-o path/to/output.wav
specifies the output file name and location. By default, the output file is namedinput.wav
in the current directory.
Example Output:
The “vgmstream_cli” command will decode the adc
file located at path/to/input.adc
and create a wav
file named output.wav
at the specified path.
Use case 2: Print metadata without decoding the audio
Code:
vgmstream_cli path/to/input.adc -m
Motivation: This use case is helpful when you don’t need to decode the audio but want to extract metadata information from the file. It provides insight into various properties of the audio file without the need for actual audio decoding.
Explanation:
path/to/input.adc
is the path to the inputadc
file for which you want to extract metadata.-m
flag instructs the command to only print the metadata information without decoding the audio.
Example Output:
When executed, the command will print the metadata information of the adc
file located at path/to/input.adc
. This may include details such as the audio codec, sample rate, channel layout, and duration.
Use case 3: Decode an audio file without loops
Code:
vgmstream_cli path/to/input.adc -o path/to/output.wav -i
Motivation: This use case is useful when you want to decode an audio file without including any loops. By excluding loops, you can obtain a shortened version of the audio file or remove any repetitive sections.
Explanation:
path/to/input.adc
is the path to the inputadc
file that you want to decode.-o path/to/output.wav
specifies the output file name and location. By default, the output file is namedinput.wav
in the current directory.-i
flag disables loops during audio decoding.
Example Output:
Upon execution, the command will decode the adc
file located at path/to/input.adc
without loops and produce a wav
file named output.wav
at the specified path.
Use case 4: Decode with loops and apply delay and fadeout
Code:
vgmstream_cli path/to/input.adc -o path/to/output.wav -l 3.0 -f 5.0 -d 3.0
Motivation: This use case is beneficial when you want to decode an audio file, including loops, but also add a delay and fadeout effect to the audio playback. These additional effects can enhance the user experience or provide a customized audio output.
Explanation:
path/to/input.adc
is the path to the inputadc
file that you want to decode.-o path/to/output.wav
specifies the output file name and location. By default, the output file is namedinput.wav
in the current directory.-l 3.0
sets the number of loops to 3.0, indicating that the audio should loop three times during playback.-f 5.0
specifies a 5-second fadeout effect at the end of the audio.-d 3.0
adds a 3-second delay before the audio playback starts.
Example Output:
The command will decode the adc
file located at path/to/input.adc
, apply three loops during playback, introduce a 3-second delay before playback starts, and conclude with a 5-second fadeout effect. The resulting output will be a wav
file named output.wav
at the specified path.
Use case 5: Convert multiple files to bgm_(original name).wav
Code:
vgmstream_cli -o path/to/bgm_?f.wav path/to/file1.adc path/to/file2.adc
Motivation:
This use case is convenient when you need to convert multiple audio files to the wav
format, apply a common naming pattern, and store the resulting files in a specific location. The -o
option, along with the pattern ?f.wav
, allows for customized output file names.
Explanation:
-o path/to/bgm_?f.wav
specifies the output file name and location pattern. In this example,?f.wav
will be replaced with the original file name followed by.wav
. The resulting files will be named with a prefix “bgm_” and stored at the specified location.path/to/file1.adc
andpath/to/file2.adc
are the paths to the inputadc
files that you want to convert.
Example Output:
Upon execution, the command will convert the adc
files located at path/to/file1.adc
and path/to/file2.adc
into wav
format. The resulting wav
files will be named as bgm_file1.wav
and bgm_file2.wav
and stored at the specified output location.
Use case 6: Play the file looping endlessly
Code:
vgmstream_cli path/to/input.adc -pec | aplay --format cd --channels 1 --rate 44100
Motivation: This use case is useful when you want to play an audio file in a continuous loop. It can be handy for testing and debugging purposes or when you want to create a background audio loop.
Explanation:
path/to/input.adc
is the path to the inputadc
file that you want to play endlessly.-pec
flag enables endless loop playback of the audio file.aplay --format cd --channels 1 --rate 44100
is a command that pipes the output from “vgmstream_cli” to theaplay
command-line audio player. Theaplay
command is instructed to use CD quality format (16-bit, stereo, 44.1 kHz) for playback.
Example Output:
The command will play the adc
file located at path/to/input.adc
in a continuous loop. The audio will be played using the aplay
command-line player with CD-quality formatting. This allows for seamless, endless playback of the audio file.