Problem with FILE_WRITE on .WAV files?

Hello Arduino community, I have a project where I need to retrieve some audio files from an online database. I have an ethernet shield (w/ micro sd card) and connectivity is fine.

Previously, I have successfully downloaded .png and .txt files from the database and stored them to the sd card with no problem. However I can’t seem to do it with .wav files. Could an expert please explain to me why I am facing this problem?

Here is the code which I am using

// Gets a file from the Internet and saves it to the SD card
// Removes the incoming HTTP header, saves the file only
//
// References - Arduino Example sketches from IDE by David A. Mellis et al.:
// -- File --> Examples --> Ethernet --> WebClient
// http://www.arduino.cc/en/Tutorial/WebClient
// -- File --> Examples --> SD --> ReadWrite
// http://www.arduino.cc/en/Tutorial/ReadWrite
// 
// Author: W.A. Smith    Date: 10 June 2015
// http://startingelectronics.org/software/arduino/save-web-file-to-SD-card/

#include <SPI.h>
#include <Ethernet2.h>
#include <SD.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC address of the ethernet shield
IPAddress server(192, 168, 100, 13);    // change server to get file from here
IPAddress ip(192, 168, 100, 99);        // static ip address that I assigned to the arduino ethernet shield
EthernetClient client;

boolean currentLineIsBlank = true;
File theFile;

void setup() {
  //*************************Initialize SD Card***************************************
  // disable Ethernet chip
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
  
  Serial.begin(115200);
  
  Serial.print(F("Initializing SD card..."));

  if (!SD.begin(4)) {
    Serial.println(F(" initialization failed!"));
    return;
  }
  Serial.println(F(" initialization done."));
  
  if (SD.exists("recording1.wav")) {
  SD.remove("recording1.wav");
}
  //**********************************ETHERNET**************************************
  digitalWrite(10, LOW);  
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println(F("Failed to configure Ethernet using DHCP"));  // no point in carrying on, so do nothing forevermore:
   
  // try to congifure using IP address instead of DHCP:
  // digitalWrite(10,LOW); // Do I need to enable Ethernet Chip here?
  
    Ethernet.begin(mac, ip);
  }

  // give the Ethernet shield a second to initialize:
  delay(1000);
  
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /recording1.wav HTTP/1.1");  // change resource to get here , Do I need to put 'HTTP/1.1' at the end?
    client.println("Host: 192.168.100.13");    // change resource host here, Set the IP address to the server's (my computer's) IP
    client.println("Connection: close");
    client.println();
  }
  else {
    // didn't get a connection to the server:
    Serial.println("connection failed");
  }
  
  
  // open the file for writing
  Serial.println("Creating file.");
  theFile = SD.open("recording1.wav", FILE_WRITE);  // change file name to write to here
  if (!theFile) {
    Serial.println("Could not create file");
    while (1);
  }
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  
  if (client.available()) {
    char c = client.read();
    if (c == '\n' && currentLineIsBlank) {
      
      // end of HTTP header, now save requested file
      while (client.connected()) {
        
        // stay in this loop until the file has been received
        if (client.available()) {
          
          c = client.read();  // get file byte
          theFile.print(c);   // save file byte
        }
      }
    }
    
    // detect the end of the incoming HTTP header
    if (c == '\n') {
      // starting a new line
      currentLineIsBlank = true;
    }
    else if (c != '\r') {
      // got a character on the current line
      currentLineIsBlank = false;
    }
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    theFile.close();
    Serial.println("Finished writing to file");
    
    // do nothing forevermore:
    while (true);
  }
}

Is your I-tunes card out of money? Sorry it's not helpful, it's just the first thing that came to mind 8)

I don't have any helpful advice unfortunately.

I don't think the SD library handles long filenames, so the filename "recording1.wav" won't work. You have to use 8.3 format.

Pete

However I can't seem to do it with .wav files. Could an expert please explain to me why I am facing this problem?

Without knowing what "this problem" is? No.