Created
March 13, 2018 11:37
-
-
Save willu47/58a84464bb2169d36cf6f4487a84426a to your computer and use it in GitHub Desktop.
Converts the AKWF single-wave sample pack into the format required for the Expert Sleepers Disting Mk4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.