%% This script runs the function World Around.

%Listener Instructions: Run the script. If you are in a somewhat noisy
%environment wait 15 seconds while the function makes a recording of your
%surroundings. If you are in a quiet environment make some interesting
%noises or speak clearly for at least a portion of the 15 second recording.
%Pausing between words shows off the quiet compensation setting. Listen to
%the music created using the sounds of the world around you, and some
%composed music.  

quiet_compensation=1; %Can be set at 1,2 or 3. All settings do well in
%moderate to loud environments. Setting 1 is my favorite.
%1) Repeats louder frames of the ambient_recording. This setting best
%compensates for environments that jump between very quiet and moderate
%volumes, for example a conversation in a quiet room.
%2) Compresses the ambient_recording. This setting is best suited for a
%consistent low din, such as outdoor noise like an occupied suburban park.
%3) Does not compensate for quiet environments. If there is little sound in
%the ambient_recording there will be little sound in the synthised_signal.
%This is the least robust setting.

input_type=1; % Can be set at 1 or 2. 1) for a MIDI file, 2) for a .wav file 
%(both file types are provided for demonstration)

%If you would like to use your own input files as music they can be changed
%within the World Around function. Please change the input_type and time_in
%appropriately. 

time_in=82687; % This value synchronizes the two signals, so they 
%play at the right times relative to each other. If you want your signals
%to begin at the same time set this variable to 0. 82687 is the correct
%value for the files provided.

[whirld_around]= World_Around(input_type, quiet_compensation, time_in);

%Thorough documentation is provided within the functions: world_around,
%spectral_splice, and spectral_splice_repeat. The function rough_compressor
%is only slightly modified from Zolzer. The functions in the MatlabMIDI
%folder are implemented so the function can use Midi files as an input
%signal. They were written by Ken Schuteand used with his permission. 

