function xscale = main(N0, b, r, scale, audio)

% Function for time-scallling audio signal.

% Ns: number of frequency samples in the first spectral subband (without those in the transition bands).
% b: paramater for the CC-DST to control the frequency spacing between the subbands (b>1).
% r: paramater for the CC-DST to set the roll-off factor of the filters.
% scale: scalling factor (scale>1 for speeding up the audio, scale<1 for slowing down the audio).
% xscale: time-scaled audio signal.
% audio: name of the audio sound (should be in the same directory).

% example: main(128, 1.06, 0.8, 0.3, 'audio.wav')

[ x, f ] = audioread(audio); 

N_scale = round(length(x)/scale) - mod(round(length(x)/scale),2); % new number of samples
 
[ S ] = CCDST(x, N0, b, r);
[ S_scale ] = ScaleTransform(S, scale); % scaled CC-DST
[ ~, ~, ~, ~, ~, Trans_Band, ~ ] = CCDST(zeros(1, N_scale), max(2, round(N0/scale)), b, r);
[ xscale ] = ICCDST2( S_scale, Trans_Band, N_scale );

  sound(real(xscale), f)
 
end