If it makes the noise when you are pedalling, but not when in the workstand, it might be nothing to do with the chain/cassette. Are the bearings in the cassette carrier or hub getting very worn? Do you have loose spokes?
And given your last comment, are you absolutely sure the noise is from the rear end, and not the chain touching the front mech cage? Again, slight give in the components when pedalling can distort the line slightly.