CheekSquisher, a XM optimizer
BotB Academy Bulletins
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #156956 :: 2022.05.29 7:35am ::
  
  Luigi64, nitrofurano and Spring liēkd this
highest optimization ratio of tools ive tried so far

download:
https://cdn.discordapp.com/attachments/949744433069424713/980478758450520064/CheekSquisher_v1.0b3.py

xm as parameter
 
 
Level 8 Mixist
DeClEcToR
   
 
post #157461 :: 2022.06.14 8:33am ::
  
  ViLXDRYAD liēkd this
Link broken
 
 
 
 
Level 32 Chipist
kleeder
 
 
 
post #157477 :: 2022.06.14 5:43pm ::
  
  Collidy, ItsDuv, Yung Gotenks, Viraxor, xterm, radian, nitrofurano, puke7, tennisers and ViLXDRYAD liēkd this
from boobiesqueezing to cheeksquishing, that escalated quickly
 
 
Level 24 Mixist
Minerscale
 
 
 
post #157512 :: 2022.06.16 6:57am ::
Python was a horrifying language choice for this project. It's really neat too! Beautiful title.
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #157513 :: 2022.06.16 7:16am ::
  
  Minerscale liēkd this
was a proof of concept, nice to prototype in: maybe someone implements the algorithm in other language if they want; i meant to add some extra batch options on it but the project has been there sleeping in my hdd for years it seems, anyone utmost welcome to do what they want with it without mention/credit

thanks for the feedback Minerscale! <3
 
 
Level 24 Mixist
Minerscale
 
 
 
post #157522 :: 2022.06.17 8:16am ::
  
  Luigi64 liēkd this
It's not really the speed or efficiency that makes python a terrifying choice it's the byte level manipulation of files, python does it's absolute best to make it a pain in the ass to read files on the byte level ahhahahaha. C in comparison will just do it for you. With python you need a god damn library to even start!
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #157527 :: 2022.06.17 9:14am ::
It's not really the speed or efficiency that makes python a terrifying choice
the downside of interpreted languages, in contrast with their machine code counterpart :3 🐉

C in comparison will just do it for you. With python you need a god damn library to even start!
C also requires a standard library to read a file 😳 the
char *fgets( char *buf, int n, FILE *fp );
and
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
comes from it :3
 
 
Level 32 Chipist
kleeder
 
 
 
post #157528 :: 2022.06.17 9:24am ::
  
  nitrofurano liēkd this
i dont see the issue with needing a library, if its doing the job for you and probably even gives u more functionality on how to parse the file.
why re-doing something if someone else already did it for you?

with python, you can pretty much focus on the algorithm and efficiency without the need of managing the whole memory on ur own all the time etc etc
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #157533 :: 2022.06.17 1:20pm ::
the library is needed to make programs portable; it takes care of interfacing with operating system kernel API; using the C standard library more or less guarantees the code keeps system-agnostic where possible, and takes care of correctly interfacing with operating systems kernel that exposes corresponding API for I/O tasks
 
 
Level 9 Criticist
liveheaven
 
 
post #158273 :: 2022.07.14 5:48am ::
What version of Python do I need? When I try opening it on Windows, a box pop up for a split second and does nothing. Command prompt doesn't help either.
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #158276 :: 2022.07.14 9:29am ::
i have tested it with Python 3.x; if you have .py files in Windows set to open with a Python 3.x interpreter, you can drag and drop one XM file to CheekSquisher_v1.0b3.py: you can set it, by right clicking the .py file > Properties > clicking the Change... button in the Opens with: field > selecting the Python 3.x interpreter executable

if you want to use command prompt, a setup is to have your Python 3.x interpreter folder in the PATH environment variable (the Python installer has an option that does that), and in a folder, for example, where CheekSquisher_v1.0b3.py along a XM file, in this example named Untitled.xm is, typing a command like this do:

python CheekSquisher_v1.0b3.py Untitled.xm


the interpreter executable may have other name, maybe like python3 for example, you can check what it is in the folder it is intalled in

heres a full example session for reference, in Cygwin; a Command prompt equivalent would be:


python -V
D:
cd py
dir
python CheekSquisher_v1.0b3.py Untitled.xm


you are utmost welcome to ask anything, follow up question and otherwise
 
 
Level 9 Criticist
liveheaven
 
 
post #158308 :: 2022.07.16 4:49am :: edit 2022.07.16 4:51am ::
Still doesn't work. I have a feeling this might be because I tried installing two versions of Python at one point in my computer's life.
Here's what I get in command prompt when running the script on its own:

Traceback (most recent call last):
File "C:\Users\xxxxx\Downloads\cheeksquisher.py", line 3, in <module>
with open(sys.argv[1], 'r+b') as input_file:
IndexError: list index out of range

Edit: Turns out it partially works when inputting a file, but it still throws an error later.

Traceback (most recent call last):
File "C:\Users\xxxxx\Downloads\cheeksquisher.py", line 58, in <module>
print('\n Optimizing instrument number {:02x}'.format(instrument_loop + 1) + ', labeled as: "' + bytes(xm_file[0x3c + optimized_general_header_length + total_pattern_data_length + total_instrument_data_length + 0x04:0x3c + optimized_general_header_length + total_pattern_data_length + total_instrument_data_length + 0x04 + 0x16]).decode("ascii") + '"...')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 0: ordinal not in range(128)
 
 
Level 23 Pedagogist
ViLXDRYAD
 
 
 
post #158311 :: 2022.07.16 8:35am ::
i am unaware about why those errors happens; a setup that works for me and doesnt need installing anything, is downloading the latest version of python here, the file named Windows embeddable package (64-bit)
https://www.python.org/downloads/release/python-3105/

extracting it, putting both CheekSquisher_v1.0b3.py and the XM you want to optimize in, and right click the folder while holding shift and selecting "Open command window here", and typing the executing the next command

python CheekSquisher_v1.0b3.py some.xm

your xm file instead of some.xm

does that works for you, liveheaven?
 
 
Level 9 Criticist
liveheaven
 
 
post #163234 :: 2022.11.20 2:38am ::
really late reply, but yes it does work!

By the way if you're still working on it, might I suggest an option to wipe all instrument and sample names? Could help in cases where every single byte counts.
 
 
Level 12 Playa
VirtualMan
 
 
post #163497 :: 2022.11.27 1:30pm ::
If XM is anything like IT, those instrument names aren't going anywhere.

Cool project.
 
 
Level 23 Mixist
02FD
 
 
 
post #194277 :: 2024.07.29 12:05pm ::
heyo
does anyone have this? discord attachments are no longer permanent so it got deleted...
 
 
Level 29 Chipist
arceus413
 
 
 
post #194290 :: 2024.07.29 8:07pm ::
if you send the link as a discord message it'll fix it iirc
 
 
Level 25 Chipist
DefenseMechanism
 
 
 
post #194305 :: 2024.07.30 5:59am ::
the gist is still available
 
 

LOGIN or REGISTER to add your own comments!