View Single Post
  #125  
Old 2005-04-26, 04:58 PM
uhclem
 
Re: Trader's Little Helper

Quote:
Originally Posted by symon
And, while we're on the subject of fixing SBEs.. what is the difference between the different ways of fixing the SBEs - Forwards, backwards, etc. -? The default seems to be backwards. Does it matter?
The default is indeed backwards. Here's how this all works:

A sector consists of 588 samples. Let's suppose you have a track in the middle of a set somewhere (TrackX) that has an SBE of 500 samples, i.e. the last sector of the track contains only 500 samples instead of the required 588. Assume that all other tracks are sector-aligned.

If you set shntool to backward fix (the default), shntool will move the track break backwards, that means it will cut those 500 samples off the end of the file and append them to the beginning of the next file, TrackX+1. The samples move forward, but the track break has moved backwards because now TrackX ends and TrackX+1 begins 500 samples sooner.

Because 500 samples have been added to the beginning of TrackX+1, shntool will have to cut 500 off the end of that file and move them to the beginning of the next, TrackX+2. This goes on all the way down the chain until the end. The last track would then have 500 samples too many. Shntool simply pads the end with 88 samples of silence, thus giving a complete sector of 588 samples at the end.

If you set shntool to forward fix, shntool will do the opposite. It will cut 88 samples off the front of TrackX+1 and stick those 88 samples on to the end of TrackX. This will make the last sector on TrackX 588 samples (500+88), thus fixed. The samples are moved back, but the track break is moved forward because now TrackX ends and TrackX+1 begins 88 samples later.

Because 88 samples are now missing from TrackX+1, shntool cuts 88 samples from the beginning of TrackX+2 and appends them to the end of TrackX+1. But now TrackX+2 is 88 samples short, so shntool keeps on going track after track till it reaches the end. The last track then ends up 88 samples too short, so shntool pads the end of it with 88 samples of silence.

If you set shntool to round fix, shntool looks at the number of samples in the last sector of TrackX and decides whether to shift forward or back depending on size. The idea is to move as little data as possible. If the last sector contains fewer than 294 samples (i.e. 1/2 of 588) then shntool will cut off those samples and move them to the front of TrackX+1. If, on the other hand, the last sector of TrackX contains more than 294 samples, it will cut off however many samples it needs from the front of TrackX+1 and move them to the end of TrackX so that the last sector of TrackX becomes 588 samples. In the case of our 500 sample last sector, shntool would perform a forward shift and move 88 samples from the beginning of TrackX+1 to the end of TrackX. When shntool goes on to fix TrackX+1 it performs the same thing. The idea is to never move more than 294 samples from the end/beginning of one track to the next. If your set has multiple SBEs, shntool can end up moving some track breaks forward, and some track breaks backward all in the same set. I don't know what happens if a sector has exactly 294 samples, but obviously it moves those samples one way or the other.

Does it matter which you use? Not really. I use 'round' because the author of shntool claims this is a bit less work for shntool. I like round because it results in the least amount of movement of a track break. If you aren't fussy use backward (the default). I think backward is the default for the reason Five gave, i.e. to avoid moving the track break into the music of the next track.
Reply With Quote Reply with Nested Quotes