[Stk] *.wav file that FileRead can open

Rich M rmarsch at bu.edu
Mon Mar 2 13:14:24 PST 2009


Hi,
I have a c++ project using STK and Real-Time Audio in which I open a 
44.1kHz interleaved 32bit float 2 channel WAVE file. I created this .wav 
file in Cubase 3 SX. When I run my program I get this error:
FileRead: error reading WAV file <GuitarDelayTest2.wav>.

Included after e-mail is related code.

I'm not really sure where to go from this error, since I don't know what 
the problem is... Perhaps even the best solution is if someone could 
give me a .wav file that FileRead can open, all I need to do is get this 
program to actually run. I'm doing this for a directed study at 
University and my adviser doesn't care what the sound clip is, as long 
as I can make my program play it and process it through a few delay 
units I coded.

Thanks,
Rich

When prompted in main I enter: GuitarDelayTest2.wav
the name of the filename I want to open, which is found in the same 
directory as the *.exe file for my program

//This is the function i use to open the input

bool AudioHandler::openInput(std::string file){
   //if .wav is found to be the extension format
   if(file.find(".wav", 0) == std::string::npos){
       cout << "\nInvalid file type. Please try again.\n";
       return false;
   }
   else{
       try{
           this->input.openFile(file);
       }
       catch( StkError & ) {
           cout << "\nInput file did not open correctly.\n";
           exit(1);
       }
       return true;
   }
}


//This is the section of main that runs before I get my Stk Error
int main(){
    AudioHandler audio;
    std::string fileName = "";

    cout << "This is the console version of the Digital Delay Unit with 
3 Delays Implemented by Richard Marscher." << endl;
    cout << "This program uses the Real Time Audio and Synthesis Tool 
Kit Native C++ libraries for audio file manipulation." << endl;
    cout << "This program expects to recieve a two-channel interleaved 
44.1kHz (non 24-bit) .wav file for processing." << endl;
    cout << "This program currently only supports WINDOWS and only 
supports the audio drivers ASIO or DirectSound." << endl;
    cout << "The program will then prompt the user to select a digital 
delay type to process the audio file with." << endl;
    cout << "There are three delays: Single delay, Double delay, and 
Feedback delay." << endl;
    cout << "Once a delay is selected, the settings of the delay must be 
defined by the user." << endl;
    cout << "Once defined, the program will playback the audio file 
through the corresponding delay unit." << endl << endl << endl;


    bool driverChoice;
    cout << "Enter 1 to use ASIO, 0 to use DirectSound preprocessor 
definitions: ";
    cin >> driverChoice;
    audio.setDriver(driverChoice);

    do{
       cout << "\n\nEnter the filename of a two-channel interleaved 
44.1kHz .wav file to open for processing: ";
        cin >> fileName;
        cout << endl << fileName;
    }while(!audio.openInput(fileName)); //Call the function to open the 
input file to a FileWvIn object. Repeat                                 
                                  //until valid file entered
}



More information about the Stk mailing list