What Are Miranda Rights?
A Way To Remember Is That Miranda Equals Custody Plus Interrogation.
A court determines whether or not you were in custody for the purposes of Miranda by asking whether or not your freedom was restrained in a significant way. There's not a bright-line rule here, and this is a case-by-case analysis.
It ultimately comes down to whether a reasonable person would have felt free to leave or not.
Now, Being In Custody Alone Is Not Enough To Trigger Miranda.
For example, let's say you get picked up on a murder warrant. The officer picks you up, puts you in the back of the car, takes you to the police station. On the way to the police station, on your own, you say, "Yeah, I was there, but the guy was alive when I left."
That does not trigger Miranda, because the statement you made was not triggered by the police asking you anything.
In order for Miranda to apply, you have to be in custody, and you have to be subject to interrogation.
Miranda Rights on Wikipedia article.