I want to normalize the sine wave so that the amplitude is between 1 and -1.
fs = 48000;N = 100000 ;t = linspace(0,10,N); % seconds
period = 1;amplitude = t;y = (amplitude .* sin(2 * pi * t / period)); %sine wave
MaxNoise = 4 ;Noise = linspace(MaxNoise,0,N) .* randn(1,N) ; % increasing noise
%z = flip(Noise); % decreasing noise
x = Noise + y ;plot(t, x, 'b-', t, y, 'r-') ;[frameval,k] = tonalframes(x, fs, 0.1);figure;plot(k,frameval);xlabel('Time--->');ylabel('Tonality--->');title('Tonality Vs Time');
Best Answer