Fetching details from the dictionary...

soliloquy; monologue; speaking to oneself
彼女は独り言を言いながら作業をしていた。
She was working while talking to herself.
独り言が多いと言われることがよくあるんだ。
I'm often told that I talk to myself a lot.
考え事をしていると独り言が出てしまう癖がある。
I have a habit of talking to myself when I'm thinking.