예제 #1
0
def get_wav_from_pcm(input_filename):
    input_filename = helper.getCaseInsensitivePath(input_filename)

    prefix = ""
    if helper.is_wsl():
        prefix = "./"
    elif os.name != "nt":
        prefix = "wine "

    wav_filename = os.path.splitext(input_filename)[0] + ".wav"

    cmd = "{}vgmstream_cli.exe -q -o \"{}\" \"{}\"".format(
        prefix, helper.get_windows_path(wav_filename),
        helper.get_windows_path(input_filename))
    subprocess.call(cmd, shell=True)

    return wav_filename
예제 #2
0
def get_wav_from_xa(input_filename):
    input_filename = helper.getCaseInsensitivePath(input_filename)

    prefix = ""
    if helper.is_wsl():
        prefix = "./"
    elif os.name != "nt":
        prefix = "wine "

    cmd = "{}xa.exe -d \"{}\"".format(prefix,
                                      helper.get_windows_path(input_filename))
    subprocess.call(cmd, shell=True)

    temp_filename = os.path.splitext(input_filename)[0] + ".wav"
    tmpfile.add_temp_file(temp_filename)

    return temp_filename
예제 #3
0
def decode_data(data, rate, channels, bits):
    input_filename = tmpfile.mkstemp()
    output_filename = tmpfile.mkstemp()

    with open(input_filename, "wb") as f:
        f.write(data)

    prefix = ""
    if helper.is_wsl():
        prefix = "./"
    elif os.name != "nt":
        prefix = "wine "

    cmd = "{}adpcmwavetool.exe d \"{}\" \"{}\" {}".format(prefix, helper.get_windows_path(input_filename), helper.get_windows_path(output_filename), channels)
    subprocess.call(cmd, shell=True)

    with open(output_filename, "rb") as f:
        data = bytearray(f.read())

    return data