Short: Trims SEGA Genesis gym music files Author: Shay Green, Morphos port by Fabrizio "Lanch" Bartoloni Uploader: lanch tiscali it (Fabrizio Bartoloni) Type: misc/emu Version: 0.1 Architecture: ppc-morphos trim_gym 0.1 ------------ Trim_gym trims SEGA Genesis gym music files. It can perform four actions: remove frames from beginning, merge frames at beginning, set loop point, trim frames from end. I wrote it to clean up some SEGA Genesis gym music recordings. Basic operation --------------- trim_gym [-r n] [-m n] [-l n] [-t n] filename [output filename] If output filename isn't specified, modify the file in-place. Compressed files aren't supported (decompress them before trimming them). The options specify the actions to perform. All points in the file are specified as an offset in 1/60 second frames, where offset 0 is the beginning of the file and offset n is the end of a file that has n frames total. -r offset remove frame data up to offset -m offset merge frame data up to offset -l offset set loop start to offset -t offset trim all frames after offset Offsets refer to the unmodified file; they are properly adjusted internally when an action shortens the file. For example -r 1 -l 10 removes the first frame and sets the loop point to 9 in the resulting file (which is the same point that 10 referred to before the removal). The merge action removes PCM setting commands, since a player may choke on the accumulation of them, and merge will only be used on silence anyway. Trimming song files ------------------- Use a GYM player and output to a PCM sound file. Open it in a sound editor and set the time unit to 1/60 second frames (735 samples each at 44.1 kHz sampling rate). The player may add extra silence at the beginning, so you may want to subtract a few frames from the offsets you specify for remove and merge (it won't really matter for the loop and trim points). Use the remove option only when the song has some unwanted sound at the beginning. Remove as little as possible from the song, since seemingly silent sections might contain important sound chip commands for the song. Use the merge option to remove silence from the beginning. Leave at least a frame of silence after the merge before the song starts, since sometimes sound chip commands need a frame to settle. If the merge offset is set right at the beginning of the frame where sound starts, it may affect the sound. Setting the loop is a little involved. Set the loop point past what you really need, so that the sound chip will be in the correct state. If the loop point is set as early as possible, the first time the song plays the sound chip might be in a different state than after it loops. If the point is set further, the original song data will have already started looping before the player jumps back to the loop point, ensuring the sound chip is in the same state. To set the loop point, find where the song repeats then go further several notes. Choose a point one frame before a note starts, preferably one that has low volume before it. Set the trim point here, then find the corresponding point early in the song and set the loop point there. This ensures that the sound chip is in a similar state when the player loops, and that any differences will be of low volume and masked by the new note that starts. After changing a file, verify that it came out right. Misc ---- With the included test.gym file, trim_gym -r 1 -m 2 -l 2 -t 3 test.gym test.gym.out should generate test.gym.out which matches test.gym.out.correct trim_gym Copyright (c) 2004 Shay Green. trim_gym is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. trim_gym is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with trim_gym; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- Shay Green P.S.: If you like this software please help Spot/UpRough, thanks! .___________________________________________________________. | | | A M I G A O S 4 . 0 C O M P I L E B Y | ._______ .______. | | ____/________________________________________| |__ . ._|____._ | ._ | ._ | _/______. | |/ | |/ | |/ | |/ | | | _________| | | |_________________|______|spt/up |_______________|_______________| . . | | | I am in a shitty economical situation, so if you feel | | that what I do is worth anything, use paypal to donate | | to my email addy, spotATtriadDOTse, thanx! | | | | Spot / Up Rough 2006 | |___________________________________________________________|