For full context, see here: https://www.docdroid.net/5vuuiCe/img-20170821-0002-new.pdf
The sentence in question (line 5): 井上さんは神戸で客が歌うのに合わせて演奏をするしごとをしていた。 My attempt at translation: "Mr. Inoue had a job in Kobe where he did musical performances matching what the customers sang."
客が歌うのに is of special interest here. As I translated, I think that の is like こと here and it literally nominalizes the verbal phrase 客が歌う into " 'the customer sing' thing". However, I might be wrong, and here is why I think so. I could also imagine the phrase being 歌う客に合わせて...: "...job where he did musical perfomances matching the singing customer." Ultimately, both phrases mean the same, but they are still different from a grammatical perspective. Since I don't feel very sure about my interpretation, I wanted to ask for confirmation.
In case my first interpretation should be correct, would the second construction I thought up be grammatical?