function [signal,fs] = get_timit_signal(len,fs,path)


if nargin < 2
    fs = 16000;
end

if nargin < 3
    path = '/u/drspeech/data/timit/train/';
    d = dir(path);
    d = d(3:end);
    r = ceil(rand*length(d));
    path = [path,d(r).name,'/'];
    d = dir(path);
    d = d(3:end);
    r = ceil(rand*length(d));
    path = [path,d(r).name,'/'];
    d = dir(path);
    a = zeros(1,length(d));
    for i = 1:length(d),
        if ~isempty(strfind(d(i).name,'.wav'))
            a(i) = 1;
        else
            a(i) = 0;
        end
    end
    d = d(a==1);
    r = ceil(rand*length(d));
    path = [path,d(r).name];
end

signal = loadsphere(path);
signal = signal(:);

if fs~=16000
    signal = resample(signal,fs,16000);
end

if ~isinf(len)
    N_samp = round(len*fs);
    num_copies = ceil(N_samp / length(signal));
    signal = repmat(signal,[num_copies 1]);
    signal = signal(1:N_samp);
end