Fetching details from the dictionary...

soliloquy; monologue; speaking to oneself
彼はよくひとり言を言いながら考え事をする。
He often talks to himself while thinking.
ひとり言が多い人は集中しているサインだそうだ。
People who talk to themselves a lot are apparently a sign of concentration.
電車の中でひとり言を言って周りを驚かせた。
I startled those around me by talking to myself on the train.