Solved problem with the new generatevisiblespectrum func