public static void main(String[] args){

		//check that the minimum number of command line arguments were entered
		if(args.length<5){
	        System.out.println("attack, decay, sustain amp, sustain time, release");
			System.out.println("Optional: Num_of_file, names of files");
	        System.exit(1);
	    }
		
			

		//parse all of the command line arguments to create the ADSREnvelope
		double attackTime = Double.parseDouble(args[0]);
		double decayTime = Double.parseDouble(args[1]);
		double sustainAmplitude = Double.parseDouble(args[2]);
		double sustainTime = Double.parseDouble(args[3]);
		double releaseTime = Double.parseDouble(args[4]);

		ADSREnvelope a = new ADSREnvelope(attackTime,
						            		  decayTime,
						           		  sustainAmplitude,
						            		  releaseTime,
		                            		  sustainTime);
		
		if(args.length == 5)
		{
			//Create a melody from the default text file
			Melody m = new Melody();

			//try to open the file and create the melody
			try{
				//m = m.createMelodyFromFile("Default.txt");
				//@@@@ TODO: old format!!! 
			}
			catch(Exception ex)
			{	
				System.out.println("An error occured in creating the melody from the file");
				ex.printStackTrace();
			}

			//Check that the melody and envelope are compatible
		    if(!m.checkCompatibility(a,m))
		       	throw new IllegalArgumentException("Melody and Envelope are incompatible");

			//play the melody
			m.play(a, m);
		}
		else{
			//get the number of files the user wants to play
			int numFiles = Integer.parseInt(args[5]);
			
			//check that the correct number of file names are present
			if(args.length != (6 + numFiles))
			{
				System.out.println("Error: " + numFiles + " File names were not entered");
				System.exit(2);
			}

			//try to create a melody from each file that was entered
			ArrayList<Melody> melody_list = new ArrayList<Melody>();
			Melody n = new Melody();
			try{
				for(int i = 6 ; i < args.length ; i++)
				{
					n = n.createMelodyFromFile(args[i]);
					melody_list.add(n);
				}
			}catch(Exception ex)
			{
				System.out.println("An error occured in creating the melody from the file here. Check that the file exists and is in the correct format");
				System.exit(3);
			}

			//concatenate the melodys and play them all
			Melody concatMelody = new Melody();
			for(Melody m: melody_list)
			{
				if(!m.checkCompatibility(a,m))
		       		throw new IllegalArgumentException("Melody and Envelope are incompatible");
				
				concatMelody.addAll(m);
			}
			concatMelody.play(a,concatMelody);

		}
	}