Stop Audio Clips from Repeating

Hey Guys,

I am building an audible altimeter with an MKRZero. I am having trouble figuring out what code to use to keep the audible alert from playing over itself while the device is still within the defined range(in this case 10,000 - 10,020 ft).

//parameters for cueing Clip 2 - 10,000 ft
if (a3.28084 > 10000 && a3.28084 < 10020){
Serial.println(“starting playback”);
AudioOutI2S.play(waveFile2);
}

What code can I add to have the wave file play once but the altimeter continue running?

Thanks in advance for your help!

sample_sample.ino (257 Bytes)

What code can I add to have the wave file play once but the altimeter continue running?

Only play the sound when the altitude enters the target range rather than when it is in the target range

See the StateChangeDetection example in the IDE. It uses digital input but the principle can be used for analogue inputs.

Thanks Helibob,

Do you have any other suggestions for learning it? I am brand new at this and struggling just bit to make sense of it.

Cheers,

corbinhand:
Thanks Helibob,

Do you have any other suggestions for learning it? I am brand new at this and struggling just bit to make sense of it.

Cheers,

I am not sure what you mean by "it"

It would be easier to provide help if you posted your whole program rather than just an isolated snippet. Follow the guidelines in read this before posting a programming question regarding the use of code tags

Thank you so much for the help, seriously struggling through this right now…

Here is the complete code:

#include <SFE_BMP180.h>
#include <Wire.h>
#include <SD.h>
#include <ArduinoSound.h>

// You will need to create an SFE_BMP180 object, here called "pressure":
SFE_BMP180 pressure;

// filename of wave file to play
const char filename[] = "Party_Te.WAV";
const char filename2[] = "10000_ft.WAV";
const char filename3[] = "7000__ft.WAV";
const char filename4[] = "5500__ft.WAV";
const char filename5[] = "3000__ft.WAV";
const char filename6[] = "1000__ft.WAV";
const char filename7[] = "500___ft.WAV";
const char filename8[] = "300___ft.WAV";

// variable representing the Wave File
SDWaveFile waveFile1;
SDWaveFile waveFile2;
SDWaveFile waveFile3;
SDWaveFile waveFile4;
SDWaveFile waveFile5;
SDWaveFile waveFile6;
SDWaveFile waveFile7;
SDWaveFile waveFile8;

double baseline; // baseline pressure

void setup()
{
  Serial.begin(9600);
     // while the serial stream is not open, do nothing:
   //while (!Serial) ; // disable to run without serial
  Serial.println("REBOOT");
  // setup the SD card, depending on your shield of breakout board
  // you may need to pass a pin number in begin for SS
  Serial.print("Initializing SD card...");
  if (!SD.begin()) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // create a SDWaveFile
  waveFile1 = SDWaveFile(filename);
  waveFile2 = SDWaveFile(filename2);
  waveFile3 = SDWaveFile(filename3);
  waveFile4 = SDWaveFile(filename4);
  waveFile5 = SDWaveFile(filename5);
  waveFile6 = SDWaveFile(filename6);
  waveFile7 = SDWaveFile(filename7);
  waveFile8 = SDWaveFile(filename8);

  // check if the WaveFile is valid
  if (!waveFile1) {
    Serial.println("wave file is invalid!");
    while (1); // do nothing
  }

  // print out some info. about the wave file
  Serial.print("Bits per sample = ");
  Serial.println(waveFile1.bitsPerSample());

  long channels = waveFile1.channels();
  Serial.print("Channels = ");
  Serial.println(channels);

  long sampleRate = waveFile1.sampleRate();
  Serial.print("Sample rate = ");
  Serial.print(sampleRate);
  Serial.println(" Hz");

  long duration = waveFile1.duration();
  Serial.print("Duration = ");
  Serial.print(duration);
  Serial.println(" seconds");

  // adjust the playback volume
  AudioOutI2S.volume(30);

  // check if the I2S output can play the wave file
  if (!AudioOutI2S.canPlay(waveFile1)) {
    Serial.println("unable to play wave file using I2S!");
    while (1); // do nothing
  }

  // start playback of party clip
  Serial.println("starting playback");
  AudioOutI2S.play(waveFile1);
  // Initialize the sensor (it is important to get calibration values stored on the device).
  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail (card disconnected?)\n\n");
    while(1); // Pause forever.
  }

  // Get the baseline pressure:
  
  baseline = getPressure();
  
  Serial.print("baseline pressure: ");
  Serial.print(baseline);
  Serial.println(" mb");  
  Serial.print("Pause for Boot Process...");  
  delay(3000);
}

void loop()
{
  double a,P;
  
  // Get a new pressure reading:

  P = getPressure();

  // Show the relative altitude difference between
  // the new reading and the baseline reading:

  a = pressure.altitude(P,baseline);
  
  Serial.print("relative altitude: ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a,1);
  Serial.print(" meters, ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a*3.28084,0);
  Serial.println(" feet");

                  //parameters for cueing Clip 2 - 10,000 ft
                  if (a*3.28084 > 10000 && a*3.28084 < 10020){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile2);
                          }
  
                   //parameters for cueing Clip 3 - 7,000 ft
                  if (a*3.28084 > 7000 && a*3.28084 < 7020){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile3);
                          }

                   //parameters for cueing Clip 4 - 5,500 ft
                  if (a*3.28084 > 5500 && a*3.28084 < 5520){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile4);
                          }
                          
                   //parameters for cueing Clip 5 - 3,000 ft
                  if (a*3.28084 > 3000 && a*3.28084 < 3020){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile5);
                          }
                   //parameters for cueing Clip 6 - 1,000 ft
                  if (a*3.28084 > 1000 && a*3.28084 < 1010){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile6);
                          }                         

                   //parameters for cueing Clip 7 - 500 ft
                  if (a*3.28084 > 500 && a*3.28084 < 510){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile7);
                          }  

                   //parameters for cueing Clip 8 - 300 ft
                  if (a*3.28084 >= 300 && a*3.28084 < 310){ 
                      Serial.println("starting playback");
                          AudioOutI2S.play(waveFile8);
                          }  
//



//
      delay(100); // Delay before taking another altitude reading 
}


double getPressure()
{
  char status;
  double T,P,p0,a;

  // You must first get a temperature measurement to perform a pressure reading.
  
  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:

    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Use '&T' to provide the address of T to the function.
    // Function returns 1 if successful, 0 if failure.

    status = pressure.getTemperature(T);
    if (status != 0)
    {
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(3);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Use '&P' to provide the address of P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P,T);
        if (status != 0)
        {
          return(P); 

        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");
 
}

cheers

This is the sort of thing that I had in mind (untested)

if (a * 3.28084 > 7000 && a * 3.28084 < 7020)
{
  currentFile = waveFile3;
}
else if (a * 3.28084 > 5500 && a * 3.28084 < 5520)
  currentFile = waveFile4;
}

//and so on

then after all ranges have been tested

if (currentFile != previousFile)  //play file if it is different from the last one played
{
  previousFile = currentFile;
  AudioOutI2S.play(currentFile);
}

You will, of course, need to declare the new variables

I've been screwing with this all day and I still get errors.... :o

Time for more education..

OK it all seems perfect to me, but I am getting a “no matching function to call error”. which doesn’t add up to me since it the same code from earlier in the sketch.

The error comes up on:

AudioOutI2S.play(currentFile);

Full sketch here:

#include <SFE_BMP180.h>
#include <Wire.h>
#include <SD.h>
#include <ArduinoSound.h>

// You will need to create an SFE_BMP180 object, here called "pressure":
SFE_BMP180 pressure;

// filename of wave file to play
const char filename[] = "Party_Te.WAV";
const char filename2[] = "10000_ft.WAV";
const char filename3[] = "7000__ft.WAV";
const char filename4[] = "5500__ft.WAV";
const char filename5[] = "3000__ft.WAV";
const char filename6[] = "1000__ft.WAV";
const char filename7[] = "500___ft.WAV";
const char filename8[] = "300___ft.WAV";

// variable representing the Wave File
SDWaveFile waveFile1;
SDWaveFile waveFile2;
SDWaveFile waveFile3;
SDWaveFile waveFile4;
SDWaveFile waveFile5;
SDWaveFile waveFile6;
SDWaveFile waveFile7;
SDWaveFile waveFile8;

double baseline; // baseline pressure

void setup()
{
  Serial.begin(9600);
  // while the serial stream is not open, do nothing:
  //while (!Serial) ; // disable to run without serial
  Serial.println("REBOOT");
  // setup the SD card, depending on your shield of breakout board
  // you may need to pass a pin number in begin for SS
  Serial.print("Initializing SD card...");
  if (!SD.begin()) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // create a SDWaveFile
  waveFile1 = SDWaveFile(filename);
  waveFile2 = SDWaveFile(filename2);
  waveFile3 = SDWaveFile(filename3);
  waveFile4 = SDWaveFile(filename4);
  waveFile5 = SDWaveFile(filename5);
  waveFile6 = SDWaveFile(filename6);
  waveFile7 = SDWaveFile(filename7);
  waveFile8 = SDWaveFile(filename8);

  // check if the WaveFile is valid
  if (!waveFile1) {
    Serial.println("wave file is invalid!");
    while (1); // do nothing
  }

  // print out some info. about the wave file
  Serial.print("Bits per sample = ");
  Serial.println(waveFile1.bitsPerSample());

  long channels = waveFile1.channels();
  Serial.print("Channels = ");
  Serial.println(channels);

  long sampleRate = waveFile1.sampleRate();
  Serial.print("Sample rate = ");
  Serial.print(sampleRate);
  Serial.println(" Hz");

  long duration = waveFile1.duration();
  Serial.print("Duration = ");
  Serial.print(duration);
  Serial.println(" seconds");

  // adjust the playback volume
  AudioOutI2S.volume(30);

  // check if the I2S output can play the wave file
  if (!AudioOutI2S.canPlay(waveFile1)) {
    Serial.println("unable to play wave file using I2S!");
    while (1); // do nothing
  }

  // start playback of party clip
  Serial.println("starting playback");
  AudioOutI2S.play(waveFile1);
  // Initialize the sensor (it is important to get calibration values stored on the device).
  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail (card disconnected?)\n\n");
    while (1); // Pause forever.
  }

  // Get the baseline pressure:

  baseline = getPressure();

  Serial.print("baseline pressure: ");
  Serial.print(baseline);
  Serial.println(" mb");
  Serial.print("Pause for Boot Process...");
  delay(3000);
}

void loop()
{
  char currentFile;
  char previousFile = waveFile1;
  double a, P;

  // Get a new pressure reading:

  P = getPressure();

  // Show the relative altitude difference between
  // the new reading and the baseline reading:
  a = pressure.altitude(P, baseline);

  Serial.print("relative altitude: ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a, 1);
  Serial.print(" meters, ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a * 3.28084, 0);
  Serial.println(" feet");

if (a * 3.28084 > 10000 && a * 3.28084 < 10020) 
{
  currentFile = waveFile2;
}
else if (a * 3.28084 > 7000 && a * 3.28084 < 7020)
{
  currentFile = waveFile3;
}
else if (a * 3.28084 > 5500 && a * 3.28084 < 5520)
{
  currentFile = waveFile4;
}
else if (a * 3.28084 > 3000 && a * 3.28084 < 3020)
{
  currentFile = waveFile5;
}
else if (a * 3.28084 > 1000 && a * 3.28084 < 1020)
{
  currentFile = waveFile6;
}
else if (a * 3.28084 > 500 && a * 3.28084 < 520)
{
  currentFile = waveFile7;
}
else if (a * 3.28084 > 300 && a * 3.28084 < 320)
{
  currentFile = waveFile8;
}
if (currentFile != previousFile)  //play file if it is different from the last one played
{
  previousFile = currentFile;
  AudioOutI2S.play(currentFile);
}

   delay(100); // Delay before taking another altitude reading
}

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////


  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

double getPressure()
{
  char status;
  double T, P, p0, a;

  // You must first get a temperature measurement to perform a pressure reading.

  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:

    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Use '&T' to provide the address of T to the function.
    // Function returns 1 if successful, 0 if failure.

    status = pressure.getTemperature(T);
    if (status != 0)
    {
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(3);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Use '&P' to provide the address of P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P, T);
        if (status != 0)
        {
          return (P);

        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");

}

I have no experience of the library and don't have it installed but I see that your filenames are declared as follows

SDWaveFile waveFile1;

so they are of type SDWavefile

but your new variables are declared like this

  char currentFile;
  char previousFile = waveFile1;

so are of type char

Try

  SDWavefile currentFile;
  SDWavefile previousFile = waveFile1;

Finally Got it! There were a few problems. SDwaveFile variable was definitely the big one though . Thanks for all your help!

Final Audible Altimeter Sketch

#include <SFE_BMP180.h>
#include <Wire.h>
#include <SD.h>
#include <ArduinoSound.h>

// You will need to create an SFE_BMP180 object, here called "pressure":
SFE_BMP180 pressure;

// filename of wave file to play
const char filename[] = "Party_Te.WAV";
const char filename2[] = "10000_ft.WAV";
const char filename3[] = "7000__ft.WAV";
const char filename4[] = "5500__ft.WAV";
const char filename5[] = "3000__ft.WAV";
const char filename6[] = "1000__ft.WAV";
const char filename7[] = "500___ft.WAV";
const char filename8[] = "300___ft.WAV";

// variable representing the Wave File
SDWaveFile waveFile1;
SDWaveFile waveFile2;
SDWaveFile waveFile3;
SDWaveFile waveFile4;
SDWaveFile waveFile5;
SDWaveFile waveFile6;
SDWaveFile waveFile7;
SDWaveFile waveFile8;
SDWaveFile currentFile;
SDWaveFile previousFile;
  
  
double baseline; // baseline pressure

void setup()
{
  Serial.begin(9600);
  // while the serial stream is not open, do nothing:
  //while (!Serial) ; // disable to run without serial
  Serial.println("REBOOT");
  // setup the SD card, depending on your shield of breakout board
  // you may need to pass a pin number in begin for SS
  Serial.print("Initializing SD card...");
  if (!SD.begin()) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // create a SDWaveFile
  waveFile1 = SDWaveFile(filename);
  waveFile2 = SDWaveFile(filename2);
  waveFile3 = SDWaveFile(filename3);
  waveFile4 = SDWaveFile(filename4);
  waveFile5 = SDWaveFile(filename5);
  waveFile6 = SDWaveFile(filename6);
  waveFile7 = SDWaveFile(filename7);
  waveFile8 = SDWaveFile(filename8);

  // check if the WaveFile is valid
  if (!waveFile1) {
    Serial.println("wave file is invalid!");
    while (1); // do nothing
  }

  // print out some info. about the wave file
  Serial.print("Bits per sample = ");
  Serial.println(waveFile1.bitsPerSample());

  long channels = waveFile1.channels();
  Serial.print("Channels = ");
  Serial.println(channels);

  long sampleRate = waveFile1.sampleRate();
  Serial.print("Sample rate = ");
  Serial.print(sampleRate);
  Serial.println(" Hz");

  long duration = waveFile1.duration();
  Serial.print("Duration = ");
  Serial.print(duration);
  Serial.println(" seconds");

  // adjust the playback volume
  AudioOutI2S.volume(30);

  // check if the I2S output can play the wave file
  if (!AudioOutI2S.canPlay(waveFile1)) {
    Serial.println("unable to play wave file using I2S!");
    while (1); // do nothing
  }

  // start playback of party clip
  Serial.println("starting playback");
  AudioOutI2S.play(waveFile1);
  // Initialize the sensor (it is important to get calibration values stored on the device).
  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail (card disconnected?)\n\n");
    while (1); // Pause forever.
  }

  // Get the baseline pressure:

  baseline = getPressure();

  Serial.print("baseline pressure: ");
  Serial.print(baseline);
  Serial.println(" mb");
  Serial.print("Pause for Boot Process...");
  delay(5000);
}

void loop()
{
  
  double a, P;

  // Get a new pressure reading:

  P = getPressure();

  // Show the relative altitude difference between
  // the new reading and the baseline reading:
  a = pressure.altitude(P, baseline);

  Serial.print("relative altitude: ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a, 1);
  Serial.print(" meters, ");
  if (a >= 0.0) Serial.print(" "); // add a space for positive numbers
  Serial.print(a * 3.28084, 0);
  Serial.println(" feet");

if (a * 3.28084 > 1 && a * 3.28084 < 10020) // 10000 ft
{
  currentFile = waveFile2;
}
else if (a * 3.28084 > 7000 && a * 3.28084 < 7020) // 7000 ft
{
  currentFile = waveFile3;
}
else if (a * 3.28084 > 5500 && a * 3.28084 < 5520) // 5500 ft
{
  currentFile = waveFile4;
}
else if (a * 3.28084 > 3000 && a * 3.28084 < 3020) // 3000 ft
{
  currentFile = waveFile5;
}
else if (a * 3.28084 > 1000 && a * 3.28084 < 1020) // 1000 ft
{
  currentFile = waveFile6;
}
else if (a * 3.28084 > 500 && a * 3.28084 < 520) // 500 ft
{
  currentFile = waveFile7;
}
else if (a * 3.28084 > 300 && a * 3.28084 < 320) // 100 ft
{
  currentFile = waveFile8;
}
 if (currentFile != previousFile)  //play file if it is different from the last one played
{
  Serial.println("Playback Altitude Alert");
  previousFile = currentFile;
  AudioOutI2S.play(currentFile);
  delay(500); // Delay for speach

}


   delay(50); // Delay before taking another altitude reading
}

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////


  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

double getPressure()
{
  char status;
  double T, P, p0, a;

  // You must first get a temperature measurement to perform a pressure reading.

  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:

    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Use '&T' to provide the address of T to the function.
    // Function returns 1 if successful, 0 if failure.

    status = pressure.getTemperature(T);
    if (status != 0)
    {
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(3);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Use '&P' to provide the address of P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P, T);
        if (status != 0)
        {
          return (P);

        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");

}

Well done for getting it working.

The question now can you improve it and/or make it easier to maintain and modify if need be ? One thing that I would do is to use more meaningful names for variables and use named constants instead of “magic” number. For instance

  if (a * 3.28084 > 1 && a * 3.28084 < 10020) // 10000 ft

I can tell by reading the code that a is related to altitude, presumably the altitude in metres so why not give the variable a meaningful name ? Multiplying by 3.28084 is presumably used to convert metres to feet. It occurs several times in the program so why not make it a const variable with a meaningful name and use that ?

Even better why repeat a * 3.28084 several times in the program ? Calculate it once, assign the result to a variable with a meaningful name and use that in the comparisons so that they read something like

  if (altitude > 1 && altitude < 10020) // 10000 ft

So much more readable don’t you think ?

Something looks very clumsy to me in the handling of the .WAV filenames but I don’t know anything about the library that you are using. I am tempted to suggest that you use an array of SDWaveFile variables to hold the filenames. That could obscure the filenames when they are used but no worse than now. I would certainly suggest that you give the filename variables more meaningful names than waveFile1, waveFile2 etc

A final and very small point but it makes me cringe (OCD kicking in perhaps). To me this

const char filename[] = "Party_Te.WAV";
const char filename2[] = "10000_ft.WAV";
const char filename3[] = "7000__ft.WAV";

looks horrible. What happened to filename1 ?