Use ffmpeg library and then run the following command (see more here)
ffmpeg sample-rubbish.mp3 -i sample-rubbish.m4a -codec:a libmp3lame -qscale:a 1
Install ffmpeg if you haven't already. Then run this command:
ffprobe -i yourFile.wav -show_streams -select_streams a:0
You will see the output that includes much more than the number of channels. Look out for:
channels=1
channel_layout=mono