Ansuman said:
If I am not wrong the potentiometers use variable resistors to change the electrical current going to a speaker, when the resistivity is more the volume is less, i may tend to be wrong, i have just passed 9th and am working on a project to adjust volume in the earphones...
If the speaker is in series with the potentiometer (pot) then that is so, but you can also put the pot in a voltage divider with the speaker in parallel.
Note: "resistivity" is a material property, it is possible for two resistors to have the same resistance and different resistivities (they will have different dimensions).
Ansuman said:
that is how a potentiometer works, right ? i am not sure though
A pot is usually a continuous band of constant resistivity with a contact point. The distance between the sliding contact and one end of the band determines the resistance.
Digital circuits don't do continuous stuff ... the volume has to correspond to a digital number.
You could imagine a series of resistors R connected by switches so that position 0 connects to the next resistor and position 1 connects to the speakers input rail. The other end of the speaker is grounded.
Lets say there are 4 resistors, then the state of the switches is represented by a 4-bit binary number.
0000 means R
tot=0
0001 means R
tot=R
but so does 0011, 0111, and 1111 (draw the circuit to see why)
0010 means R
tot=2R
0100 means R
tot=3R
1000 means R
tot=4R
... if you want more than 4 volume levels, then use more switches and resistors.
This is far too simple - there are lots of other ways of doing it and actual circuits will be more complicated as well as different between different devices. I'm intending it as an easy-to-understand example of the kind of thinking you need rather than an example of what actually happens in real life.
Be aware that the details of how a particular manufacturer's circuit works may be proprietary information - we can only talk, in general, about what sort of thing gets done.