The reason you can't find a function to extract decibel value in the libraries you have mentioned is simple: it cannot exist. A microphone converts the pressure waves of sound into voltage changes and records them as stream of bytes. In digital audio, amplitude is measured in decibels below full scale (dBFS). The maximum possible amplitude is 0 dBFS, which corresponds to the maximum absolute value of the data type that is used to store the data.
dBFS is related to the acoustic decibels, but the correspondence is not direct. You would need to know the characteristic of the microphone, e.g. frequency response, gain.
Once you have those, design a filter that applies A-weighting, which converts from the recorded dBFS to dBSPL(A) - sound pressure level measurement, relative to 20 μPa RMS air pressure, A-weighted.