misaim / ebl-reading Goto Github PK
View Code? Open in Web Editor NEWPython code to read E-MU Emulator X-3 EBL files and convert them to WAV
Python code to read E-MU Emulator X-3 EBL files and convert them to WAV
Currently output file verification is reasonably strict:
re.sub('[^0-9a-zA-Z\.,:%\-_#]+', '', ebl_file['header_3']['filename'])
We should add a new flag and a secondary regex which allows some chars through for OS's where it doesn't matter - i.e Mac OS X and Linux both allow !, ? and ' ' chars in filenames, although windows doesn't.
Could also look at replacing some strings. '/w' is used for shorthand "with", / is used for time sig's and could be "slash" or a dash.
Filename conversion sucks right now. I manually replace every character that I've found which is illegal on my platform (mac) and linux.
Ideally we only replace chars outside of A-Z, a-z, and 0-9.
Some exceptions are
Should log them maybe.
Testing is... Lackluster. I'd like to have a stack of home-made EBL files with known WAV outputs that we can compare to.
EBL reading sucks presently. mono-support branch kind of improves it, but we still have problems with some headers.
I think they are smaller (or bigger... depends on audio start) than the majority of the dataset. Currently, header files are mostly assumed to be the correct size, while we do check for channel size and read the appropriate amount of bytes - this is improved on mono-support branch.
Probably we should be checking a bunch of headers (automatically) for consistency and spot patterns - like header 3 length in bytes is encoded in header 2, and the data channel sizes are encoded weirdly.
As per @jackbucinskas suggestion, we should swap to better performance monitoring i.e
start_time = time.perf_counter()
for i in range(10):
print(i)
end_time = time.perf_counter()
execution_time = end_time - start_time
print(f"The execution time is: {execution_time}")
In main.py we have these lines (Roughly 199 in latest version):
wav_data = b""
for i in range(0, channel_size, 2):
wav_data += channel_1_data[i : i + 2]
wav_data += channel_2_data[i : i + 2]
This combines two continuous sets of bytes into one like a zipper, 2 bytes at a time.
I haven't profiled it, but large files (>1mb) tend to take a while, with this as the only hold up I can see. I know it's slow - it's doing a copy every time!
When running conversions with -p (Preserve Filename) flag, the resulting output has the originals filename (with suffix as .wav).
The metadata-encoded Emulator X-3 filename is lost. Suggestions:
Change handling of input files/folders
https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve
From @jackbucinskas
i personally don't like so many embedded if and for loops, it makes it hard for someone to pick up the code in the future
i would suggest moving the if / for loop into a separate function with a descriptive function name
He's right, it's a bit of a mess. I was several beers deep. Needs to be re-worked.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.