At the 1974 International Congress, I. M. Singer proposed that eta invariants and hence spectral flow should be thought of as the integral of a one form. In the intervening years this idea has lead to many interesting developments in the study of both eta invariants and spectral flow. Using ideas of [24] Singer's proposal was brought to an advanced level in [16] where a very general formula for spectral flow as the integral of a one form was produced in the framework of noncommutative geometry. This formula can be used for computing spectral flow in a general semifinite von Neumann algebra as described and reviewed in [5]. In the present paper we take the analytic approach to spectral flow much further by giving a large family of formulae for spectral flow between a pair of unbounded self-adjoint operators D and D + V with D having compact resolvent belonging to a general semifinite von Neumann algebra N and the perturbation V ∈ N . In noncommutative geometry terms we remove summability hypotheses. This level of generality is made possible by introducing a new idea from [3]. There it was observed that M. G. Krein's spectral shift function (in certain restricted cases with V trace class) computes spectral flow. The present paper extends Krein's theory to the setting of semifinite spectral triples where D has compact resolvent belonging to N and V is any bounded selfadjoint operator in N . We give a definition of the spectral shift function under these hypotheses and show that it computes spectral flow. This is made possible by the understanding discovered in the present paper of the interplay between spectral shift function theory and the analytic theory of spectral flow. It is this interplay that enables us to take Singer's idea much further to create a large class of one forms whose integrals calculate spectral flow. These advances depend critically on a new approach to the calculus of functions of non-commuting operators discovered in [3] which generalizes the double operator integral formalism of [8,9,10]. One surprising conclusion that follows from our results is that the Krein spectral shift function 1 2 is computed, in certain circumstances, by the Atiyah-Patodi-Singer index theorem [2].