Tone quality is improved at the time of playing back sound data having a
loop part.A sound data encoding apparatus encodes sound data in groups of
a plurality of consecutive blocks. In the case where the sound start
position is equal to the loop start position, encoding is performed using
samples of sound data (for example, sound data just before the loop end)
relating to the sound data at the sound start position from the viewpoint
of music. In the case where the sound end position is equal to the loop
end position, encoding is performed using samples of sound data (for
example, sound data just after the loop start) relating to the sound data
at the sound end position from the viewpoint of music.