I'm not on the Spectrum, although lots of traits.
I talk to myself all the time, although I do try not to do it in front of other people. I'm aware that I'm doing it more now in public places. like parks, and sometimes people have walked round a corner and caught me talking to myself. I just stop and walk quickly on. If my hair was longer then I suppose they might think I had one of those mobile phones that sit on your ear.
When I talk to myself, it's as if I'm talking to someone else, and I talk through problems I'm having, or particular situations. It helps me to work things out if I can hear it being said, rather than just thought.
I don't think it's a particularly AS thing either. Lots of people do it, and for different reasons. Many people who have bereaved, for example, will talk aloud to the person who is dead. Again, it seems to be that it helps them work through problems, or to talk about something that has happened. They know that the other person isn't there, but it helps them.
I used to share the drive to work with a colleague who is very NT, and one day he referred very specifically to a conversation we'd apparently had the day before. He was surprised when I reminded him I hadn't been at work the day before, and told me that he'd had a conversation with me even though I wasn't there! 