Be honest with her.
Tell her exactly why you were recording her, that you simply wanted to find out why the relationship has failed and what you did wrong to see if you could repair it.
Don't put any blame on her, apologise for doing it and say it will never happen again. Give her any recordings you may have or let her delete them. Then ask her why she wants a divorce, and you want to know no matter how brutal it is, even if she is seeing another man.
Tell her exactly why you were recording her, that you simply wanted to find out why the relationship has failed and what you did wrong to see if you could repair it.
Don't put any blame on her, apologise for doing it and say it will never happen again. Give her any recordings you may have or let her delete them. Then ask her why she wants a divorce, and you want to know no matter how brutal it is, even if she is seeing another man.