Open groowyCZ opened 4 years ago
I haven't worked on this really, for like 14 years. I tried to run it the other day and got an error, so there may be other problems, even with python2. It used to work ok, but I'm really not sure, at this point. The underlying sf2 lib (external, from Learjeff) might be the real challenge, as it has really terrible indentation (I tried to auto-format it, and it failed) and Kafkaesque control-flow, so it was incredibly hard for me to follow. I tried to fix the error I found, but couldn't work out what exactly what was the issue, and couldn't find another working sf2-writing lib.
I have limited time for working on it, so I'm not sure how realistic it is for me to get around to it. I will happily accept PRs though, if you want to give porting a shot. Generally, porting python 2 code to 3 is just a matter of changing a few built-in imports and syntax in a few places.
as a sidenote, you can get around version-problems really easily with docker:
docker run -v `pwd`:/code -w /code -it --rm python:2.7.9 ./hydroToSf2
I just tried it, and obviously it will need other audio-tools:
docker run -v `pwd`:/code -w /code -it --rm python:2.7.9 bash
# now you are inside docker container
apt update
apt install flac sox
./hydroToSf2 Boss_DR-110.h2drumkit
This worked, but then I got the error I was talking about:
Layer: 1 loV: 0 hiV: 127 atten(cB): 0 6
Copying sample data:......
Traceback (most recent call last):
File "./hydroToSf2", line 243, in <module>
main(sys.argv)
File "./hydroToSf2", line 238, in main
hydrogenToSf(drumkitDir,sf2,stereo,tempDir)
File "./hydroToSf2", line 168, in hydrogenToSf
sf.writeFromKmap()
File "/code/jMksf.py", line 851, in writeFromKmap
self.riffLen += self.writePdta()
File "/code/jMksf.py", line 837, in writePdta
dlen += self.writeIgen()
File "/code/jMksf.py", line 713, in writeIgen
), self.outf)
File "/code/jtype.py", line 188, in writeval
slen += field.type.writeval(val[ix], outf)
File "/code/jtype.py", line 33, in writeval
outf.write(struct.pack(self.fmt, val))
struct.error: ushort format requires 0 <= number <= USHRT_MAX
I made #3 to track that.
Hi, I just want to as you if you're going to port this code to python3 because this is exactly what I need but python2 has its lifetime at the end.