Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts the AKWF single-wave sample pack into the format required for the Expert Sleepers Disting Mk4
"""
Navigate to the root of the AKWF folder downloadable from http://www.adventurekid.se/AKRTfiles/AKWF/AKWF.zip
and run this script using the command ``python3 distingify.py``
"""
import os
def main():
folder_list = []
for folder in os.listdir():
if os.path.isdir(folder):
folder_list.append(folder)
print("{} is a directory".format(folder))
if folder.startswith("AKWF_"):
os.rename(folder, folder.replace("AKWF_", ""))
file_list = []
for file in os.listdir(folder):
if file.startswith("AdventureKidWaveforms"):
os.remove(os.path.join(folder, file))
if file.endswith(".wav"):
file_list.append(file)
if file.endswith(".wav") and file.startswith("AKWF_"):
print("Renaming {} to {}".format(file, file.replace("AKWF_", "")))
os.rename(os.path.join(folder, file), os.path.join(folder, file.replace("AKWF_", "")))
with open(os.path.join(folder, "playlist.txt"), "w") as textfile:
textfile.write("disting playlist v1\n")
for file_name in sorted(file_list):
textfile.write(file_name + '\n')
with open("playlist-wavetable.txt", "w") as textfile:
textfile.write("disting playlist v1\n")
for folder_name in sorted(folder_list):
textfile.write(folder_name + '\n')
if __name__ == '__main__':
main()
@karlsander

This comment has been minimized.

Copy link

commented Aug 23, 2018

I came across this script googling and had to make a little change to get it to work. Maybe useful for someone else.
When the folder is renamed in line 14, also assign the new name to the folder variable because its used again in 25.

if folder.startswith("AKWF_"):
    os.rename(folder, folder.replace("AKWF_", ""))
    folder = folder.replace("AKWF_", "")
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.