function [nos ir output esn] = stm()
%stm Testing script
%  Detailed explanation goes here


nTestSeqLength = 2400;
nSeqLength = 1500;
%output = sin((1:nSeqLength) / 4) / 2;
%output = output ;

output = melodyGenerator(1:nSeqLength);
output2 = sineGenerator(1:nSeqLength, 500, 20) / 4;
%output = sineGenerator(1:nSeqLength, 500, 20) / 2;
%output = modulatedSineGenerator(1:nSeqLength, 500, 13, 21) / 2;
output2 = output2 + 0.25;


%output = output - 0.3;

teacher = [output output2];

esn = create_esn(800, 1, 1.25, 0.908);

esn = scaling(esn, 2.0);


figure(1);
plot(teacher);

%figure(1);
%plot(1:50, ir(1:5, 1:50));

% train network
[nos ir esn] = train(teacher, esn);
figure(2);
plot(1:length(teacher), ir(1:10, 1:length(teacher)));

% test run


[nos2 ir esn] = runFNetwork(teacher(1:200), 300, esn);
[nos3 ir esn] = runFNetwork(teacher(1500:1700), 300, esn);
figure(3);
%wholeSeqLength = nSeqLength + nTestSeqLength;
plot(nos2); %1:wholeSeqLength, 
figure(4);
plot([nos2 nos3]);


%starting from another random state
%esn.x = rand(1, size(esn.x))' - 0.5;
%[nos ir esn] = runNetwork(100, esn);

%figure(2);
%plot(1:100, nos(1:100));


%plot(1:nSeqLength, output);

%[nos ir esn] = processInput(nSeqLength, esn);
%[nos ir esn] = train(output(1:300), esn);
%plot(1:nSeqLength - 50, nos);


%[nos2 ir esn] = processInput(200, esn);
%plot(1:nSeqLength + 150, [nos nos2]);




