Task-specific focal dystonia is a task-specific movement disorder which manifests itself as a loss of voluntary motor control in extensively trained movements. The condition is most frequent in musicians. Until today, the aetiology of focal hand dystonia is not completely understood, but there is growing evidence for an abnormal cortical processing of sensory information, as well as degraded representation of motor functions. It was demonstrated that in the somatosensory cortex the topographical location of sensory inputs from individual fingers is corrupted. Occasionally, a change in sensory information of the hand may at least temporarily improve the condition. This phenomenon is called sensory trick. In this paper, we propose a model of encoding of sensory stimuli which could explain the task specificity of cortical representations of the fingers or other effectors in the context of dystonia. In the framework of this model a sensory stimulus is encoded as a signal vector of higher dimension. A part of its components directly represents the sensory stimulus, while the remaining components describe the context. This model does not only account for the task specificity, but may also explain some characteristics of the retraining process in this disorder.