Is it possible to control the microphone and speaker on a smartphone?

I’ve been looking into building apps for smartphones and have noticed that it’s possible for developers to control certain smartphone features such as phone vibration and the GPS feature. However, in the book that I’ve been looking at, “Build Mobile Websites and Apps for Smart Devices”, I don’t see any way to control the microphone and speaker of the cell phone. Is there any way to do this? Is it possible to read the signal that is coming in from the microphone, or produce audio that will come out of the phone’s speaker, or earpiece?

I’m new to building apps and am trying to find out whether or not this type of control is possible. If anyone knows whether or not this type of control can be accomplished, I’m interested in learning more about it. The book that I’ve been looking at, doesn’t seem to cover it.

Thanks for any and all input that anyone is willing to provide. I greatly appreciate your time and attention.