Completed writeMusicIndex() method.