Author Topic: Am I writing IT files correctly?  (Read 2134 times)

Offline uyjulian

  • Shy artist
  • Posts: 3
  • Operating System: Mac OS X with Wine
Am I writing IT files correctly?
« on: March 17, 2015, 23:46:07 »
https://github.com/uyjulian/spc2it/blob/master/it.c#L335
I'm not sure of any tools to verify IT files output... ITTECH.TXT is confusing to me...

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Am I writing IT files correctly?
« Reply #1 on: March 17, 2015, 23:58:10 »
Well, that is a very broad question, especially given that there is no canonical way of saving IT files. If you save the file and it loads as intended in any IT player, you can be mostly sure that the file is written correctly. Do you have any specific problems with opening your saved IT files?
ITTECH.TXT is incomplete but I find it very well-written. You probably just need to stop interpreting things into it. For example:
Code: [Select]
"// Channels are 1 based (Channels start at 1, not 0, ITTECH.TXT is WRONG) !!!"No, you just misinterpreted this line:
Code: [Select]
Channel = (channelvariable-1) & 63              ; Channel is 0 based.The variable Channel is 0-based. It is obtained from the variable channelvariable by subtracting one.

Some things are not documented in ITTECH.TXT, but I have documented them in the OpenMPT Wiki. Especially the stuff about storing (or not storing) the Edit History correctly is interesting. It seems like you are trying to copy OpenSPC's way of writing the IT header, which might be okay because the libraries and trackers that actually care about identifying which program was used to create a file know how to detect OpenSPC already, but it would be cleaner to register a Tracker ID in the wiki.


Also, I do hope this code won't bring in another wave of people believing that SPC must be some kind of magical module format and clearly OpenMPT should be able to open it...
« Last Edit: March 18, 2015, 00:01:21 by Saga Musix »
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline uyjulian

  • Shy artist
  • Posts: 3
  • Operating System: Mac OS X with Wine
Re: Am I writing IT files correctly?
« Reply #2 on: March 18, 2015, 00:43:30 »
Well, that is a very broad question, especially given that there is no canonical way of saving IT files. If you save the file and it loads as intended in any IT player, you can be mostly sure that the file is written correctly. Do you have any specific problems with opening your saved IT files?
ITTECH.TXT is incomplete but I find it very well-written. You probably just need to stop interpreting things into it. For example:
Code: [Select]
"// Channels are 1 based (Channels start at 1, not 0, ITTECH.TXT is WRONG) !!!"No, you just misinterpreted this line:
Code: [Select]
Channel = (channelvariable-1) & 63              ; Channel is 0 based.The variable Channel is 0-based. It is obtained from the variable channelvariable by subtracting one.

Some things are not documented in ITTECH.TXT, but I have documented them in the OpenMPT Wiki. Especially the stuff about storing (or not storing) the Edit History correctly is interesting. It seems like you are trying to copy OpenSPC's way of writing the IT header, which might be okay because the libraries and trackers that actually care about identifying which program was used to create a file know how to detect OpenSPC already, but it would be cleaner to register a Tracker ID in the wiki.


Also, I do hope this code won't bring in another wave of people believing that SPC must be some kind of magical module format and clearly OpenMPT should be able to open it...

Line 24 and 25...
https://github.com/uyjulian/spc2it/blob/master/it.h

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,108
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Am I writing IT files correctly?
« Reply #3 on: March 18, 2015, 00:54:02 »
Impulse Tracker will have issues with files exceeding its originally specified ranges, however most other players have no problems with the following:
- 256 rows per pattern or more (OpenMPT and I think XMPlay cap this at 1024)
- 240 distinct patterns (could in theory be 254, but is less for historical reasons, I guess)
- 200 samples (could again be 255, but this is probably another historical limit)
For your SPC conversion, you could probably save a lot of patterns by varying the ticks per row (Axx effect) depending on the number of events. Alternatively, use the SEx or S6x effects for repeating a row or adding ticks respectively.
Also, it might be possible to use 2 ticks per row instead of 1 tick at the cost of some possible minor precision loss, by using volume and tempo slides (D0x decreases volume on all ticks but the first, Dx0 increases it, Fxx with xx < E0 increases pitch on all ticks but the first, Exx decreases).
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline uyjulian

  • Shy artist
  • Posts: 3
  • Operating System: Mac OS X with Wine
Re: Am I writing IT files correctly?
« Reply #4 on: March 18, 2015, 00:56:14 »
Impulse Tracker will have issues with files exceeding its originally specified ranges, however most other players have no problems with the following:
- 256 rows per pattern or more (OpenMPT and I think XMPlay cap this at 1024)
- 240 distinct patterns (could in theory be 254, but is less for historical reasons, I guess)
- 200 samples (could again be 255, but this is probably another historical limit)
For your SPC conversion, you could probably save a lot of patterns by varying the ticks per row (Axx effect) depending on the number of events. Alternatively, use the SEx or S6x effects for repeating a row or adding ticks respectively.
Also, it might be possible to use 2 ticks per row instead of 1 tick at the cost of some possible minor precision loss, by using volume and tempo slides (D0x decreases volume on all ticks but the first, Dx0 increases it, Fxx with xx < E0 increases pitch on all ticks but the first, Exx decreases).
Thanks, I'll keep that in mind when I'm rewriting my code to be more modular.
« Last Edit: March 18, 2015, 01:02:53 by uyjulian »