Author Topic: IT2AGI sound converter script - some fixes  (Read 141219 times)

0 Members and 3 Guests are viewing this topic.

Offline Sinus

IT2AGI sound converter script - some fixes
« on: May 19, 2025, 03:33:59 PM »
While MIDI-to-AGI tools may be the weapon of choice for many of you, I'm an old school tracker musician, so the IT2AGI script I found on the SierraHelp pages was a godsend when I found myself tinkering with an AGI song. But, the tool lacked 4-channel output, and at times kept outputting nonsense when using multiple channels. Knowing some Perl, I went and fixed it. Here it is attached! Good luck tracking those songs :)

Update: the script is now hosted on GitHub. You'll find the newest version there.
« Last Edit: May 24, 2025, 07:34:14 PM by Sinus »



Offline Collector

Re: IT2AGI sound converter script - some fixes
« Reply #1 on: May 19, 2025, 03:56:12 PM »
Nice to see you made it here. When I get a chance, I'll make a Wiki entry for it.
KQII Remake Pic

Offline bokkers

Re: IT2AGI sound converter script - some fixes
« Reply #2 on: May 20, 2025, 02:34:06 PM »
Right on! Does it translate drums to sounds on the AGI noise channel?

Offline Sinus

Re: IT2AGI sound converter script - some fixes
« Reply #3 on: May 21, 2025, 03:13:01 PM »
Yup. On the fourth channel, every even/odd octave defines noise/pattern, and every 4th note pitch defines frequency. C1=C3=C5=E1=E3=G#1=G#3. Play C1 C#1 D1 D#1 C2 C#2 D2 D#2 for a full range of sounds.
Just to clarify: there are no "drums" in IT, it's not MIDI, in trackers you define instruments as you see fit. But for this script, instruments don't matter. First three channels of the IT files are voices, the fourth channel is noises.
« Last Edit: May 21, 2025, 05:23:50 PM by Sinus »

Offline bokkers

Re: IT2AGI sound converter script - some fixes
« Reply #4 on: May 22, 2025, 05:38:02 PM »
Thanks for the in-depth explanation! Not much experience with IT, but that is an amazing feature. I'm doing lots of MIDI to AGI conversions at the moment, and haven't found a way to convert drums / properly use the noise channel yet. Does anyone know how to do that?

Will try the IT to AGI thing. Thanks for your contribution to the toolbox!


Offline Sinus

Re: IT2AGI sound converter script - some fixes
« Reply #5 on: May 23, 2025, 07:26:26 AM »
The specs for the sound chip on SierraHelp proved to be rather clear to me.
Of the five-byte note entry in a SND resource file, first two bytes are duration as usual, then the third is a 00000000, the fourth is 11000NFF where N=0 for zzz and N=1 for shh and FF=00/01/10/11 for four frequencies, and then the fifth byte 1111xxxx for volume attenuation.
You can hear it in action in my rendition of the Wallflowers' Song for the KQ6AGI Demake here:

(The song ultimately didn't make it into the game, as Brandon decided not to mess with the project too much anymore, but it was fun to make anyway. :) )
« Last Edit: May 23, 2025, 08:53:57 AM by Sinus »

Offline doomlazer

Re: IT2AGI sound converter script - some fixes
« Reply #6 on: May 23, 2025, 09:21:12 PM »
Wow, that's a great demake version of that song. Surprised it got cut; sounds done to my ears.

Offline Sinus

Re: IT2AGI sound converter script - some fixes
« Reply #7 on: May 23, 2025, 11:19:48 PM »
Thank you! :)

As for the cut, with 18 years on the project, I'm not entirely surprised Brandon chose to leave it "as is" - I came from nowhere and offered to improve his PC-Speakery version of the song, entirely unsolicited. He did make a good point, too, that including my version would've required him to employ a separate timer to let the player regain control of Alex while the song is still playing, as it's too long to just force the player to sit and listen, and that on the default PC Speaker the song wouldn't've sounded so nice. I did prepare for that, the song did include some "squeezing" of extra notes into the first voice to imitate accompaniment, and AGI does let you check which sound hardware is in use, to conditionally play an appropriately crafted sound piece, dedicated to either speaker or Tandy, if needed. But, bygones. The song's here, everyone's happy. ^_^

Offline bokkers

Re: IT2AGI sound converter script - some fixes
« Reply #8 on: May 24, 2025, 03:59:50 PM »
Tried the script on a number of Mod files, but keep getting an "Invalid IT header" error. Any ideas what I'm doing wrong?

Offline Kawa

Re: IT2AGI sound converter script - some fixes
« Reply #9 on: May 24, 2025, 04:30:05 PM »
Tried the script on a number of Mod files
I think that's the problem exactly. I tried a bunch of IT files myself just now -- some work fine, some give overflow errors. But when I accidentally tried to convert the wrong end I got "invalid IT header", and so I did with an XM file just now.

Offline Sinus

Re: IT2AGI sound converter script - some fixes
« Reply #10 on: May 24, 2025, 04:42:50 PM »
The script works with .IT files, not just any tracker format. It could, quite reasonably, work with MODs (4 channels, baby!), if made to do so, but for the moment it supports .IT files alone.

Would there be interest in a MOD converter, I wonder? I suppose I could whip that up, given a bit of time...

Offline bokkers

Re: IT2AGI sound converter script - some fixes
« Reply #11 on: May 24, 2025, 04:54:12 PM »
Thanks for the quick reply!

Tried an IT file, and it works like a charm. Thanks!

Is there a way to convert MOD to IT files? (No luck with OpenMPT so far...)

Offline Kawa

Re: IT2AGI sound converter script - some fixes
« Reply #12 on: May 24, 2025, 05:04:25 PM »
That's funny. That's exactly what I use to convert MOD to IT. In fact, I literally just now converted a randomly-picked MOD to IT with OpenMPT in just four clicks, not changing a single setting on the way.

Offline Sinus

Re: IT2AGI sound converter script - some fixes
« Reply #13 on: May 24, 2025, 05:17:48 PM »
Is there a way to convert MOD to IT files? (No luck with OpenMPT so far...)
OpenMPT should give you no problem at all - but the workflow isn't obvious.
1. Open your MID/MOD/XM/S3M file
2. Change song type in the tracker's General tab (screenshot attached)
3. Save!

Offline bokkers

Re: IT2AGI sound converter script - some fixes
« Reply #14 on: May 24, 2025, 06:20:18 PM »
Thanks for the heads-up! That was a missing puzzle piece for me.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.044 seconds with 23 queries.