I have studied the proof of the theorem of Torelli (Andreotti's proof) where the centerpiece is the definition of branch locus of a morphism to projective space.

My question is:

Let $f: X \longrightarrow Y$ be a morphism from a projective variety $X$ to projective space Y.

How to define the branch locus of $f$?

Where can I find this definition? In general I find only for the case where $X$ and $Y$ are Riemann surfaces. But what interests me is the case above.

I have searched the classic books of algebraic geometry, but I do not find the definition, a reference (to read about this definition) would be of much help

Recently I found a definition for branch locus in Vakil, Ravi, "Foundations of Algebraic Geometry", Lecture Notes. However, it is defined for a $f: X \longrightarrow Y$ morphism of schemes. My knowledge of algebraic geometry does not let me know if this generalizes the case in which I am interested:$f: X \longrightarrow Y$ be a morphism. If true, then I could proceed with the branch locus definition found in Vakil notes.

Thank you!