Program

WAVE Files:

What is a WAVE file?: A WAVE file is an audio format developed by Microsoft and IBM that was designed an early form of lossless audio storage.

Contents: A WAVE file contains three main sections, or chunks, which are called the RIFF, fmt, and data.

  • RIFF: The Riff chunk contains the file identifier, the size of the file, and the format of the file.
  • Fmt: the fmt or format chunk contains most of the information for the WAVE file like the chunk size, the number of channels the file contains, the rates of both the samples and bytes, the block align, or offset, of each subchunk of information, and how many bits per sample there are.
  • Data: The data chunk contains the chunk’s identifier, its size, and the actual data that contains the music that make-up the song that’s stored within the WAVE file.

I found it extremely useful to use an expanded visual aid for the wave file since it would have otherwise been difficult to know what was in a wave file. I mainly used the explanation of wave files from the Stanford website regarding wave files: https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/.

Display Program:

Reading chunks of a WAVE file: Like with any wave file there are indicators built into the file itself that contain the necessary information for the file to function. I used those indicators to know when and where to store values.

Structs: I used structs in this program because I initially thought that they would allow me to quickly to read in the necessary values from each subchunk of a wavefile. This was quickly proved wrong because of the method I used to read in each subchunk of the file which made it awkward at best to store the correct values.

Complications: Because I wasn’t able to fully get the conversion to work I didn’t have the chance to rewrite the conversion code segments into the main program. I also couldn’t verify if I ever correctly modified the bits within the data section of the file. I was able to see small changes in the array, that holds the data, but otherwise saw no other visual indicators.

Conversion Program:

LPCSTR conversion: LPCSTR is a different version of the string variable in c++ that in essence means “long string”. I used LPCSTR because the function Playsound as one of its parameters needs an LPCSTR to function.

PlaySound: is a function that I used to play the song that is provided by the user in the beginning of the program. This function isn’t the newest but it works.

Display Bytes: This snippet of code will display all of the bytes in a wave file. This function is mainly necessary to the program as a whole but it is useful to seeing a wall of 1’s and 0’s that are the bits of the provided wave file.

Why Monkey Island?:

What is it?: Monkey Island is a videogame that was developed by Lucasfilm Games LLC in 1990. It was designed by Ron Gilbert, Dave Grossman, and Tim Schafer. The story follows a wannabe pirate Guybrush Threepwood and his adventures in the Caribbean.

Its Significance: Around the time of its release, new and improved versions of audio cards were also being released. It’s a videogame that has seen continual support and development with the newest version, Return to Monkey Island, being released September 19, 2022.

Video that brought “The Monkey Island Theme” to mind when discussing audio.
Video showcasing how audio, of specifically Monkey Island, has changed throughout the years.

Due to technical difficulties the code will be in .pdf form that will need to be put into a useable .cpp

Sources Bibliography:

Ben Jacklin, “What is WAV File,” movavi.com, https://www.movavi.com/learning-portal/wav-file.html.

“constexpr specifier (since C++11),” cppreference.com, https://en.cppreference.com/w/cpp/language/constexpr.

Craig S. Sapp, “WAVE PCM soundfile format,” stanford.edu, December 11, 1997, https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/.

Cute, “How to convert std::string to LPCSTR,” stackoverflow, July 29, 2009, https://stackoverflow.com/questions/1200188/how-to-convert-stdstring-to-lpcstr.

“Fixed width integer types (since C++11),” cppreference.com, https://en.cppreference.com/w/cpp/types/integer.

John Talbott, “How to play or open *.mp3 or *.wav sound file in c++ program?,” stackoverflow, March 7, 2014, https://stackoverflow.com/questions/22253074/how-to-play-or-open-mp3-or-wav-sound-file-in-c-program.

“Left shift and right shift operators (<< and >>),” microsoft.com, https://learn.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-170.

LGR, “LGR – Evolution of PC Audio – As Told by Secret of Monkey Island,” youtube, January 7, 2010, https://www.youtube.com/watch?v=a324ykKV-7Y.

MaikCAE, “converting audioformat 16bit/16kHz <-> 8bit/8kHz,” cplusplus.com, October 19, 2009, https://cplusplus.com/forum/general/15469/.

Mark S. Csele, “WAV File Format Description,” nolandda.org, https://nolandda.org/pusite/cs490-dsp/wav_format.html.

“memcmp,” cplusplus.com, https://cplusplus.com/reference/cstring/memcmp/.

“Microsoft RIFF,” netghost, https://netghost.narod.ru/gff/graphics/summary/micriff.htm.

NothingMaster, “LPCSTR, LPCTSTR and LPTSTR,” stackoverflow, November 26, 2008, https://stackoverflow.com/questions/321413/lpcstr-lpctstr-and-lptstr.

Noodle, “Adaptive Music (In Gaming) Is Amazing,” youtube, July 7, 2019, https://www.youtube.com/watch?v=yLd5wmBNCBM.

Pastx, “Read file by bits c++,” stackoverflow, March 13, 2014, https://stackoverflow.com/questions/22390641/read-file-by-bits-c.

“PlaySound function,” Microsoft, June 6, 2016, https://learn.microsoft.com/en-us/previous-versions/dd743680(v=vs.85).

Razgriz, “Reading the Data part of a Wave file,” stackoverflow, December 1, 2012, https://stackoverflow.com/questions/13660777/c-reading-the-data-part-of-a-wav-file.

Vince, “Play Music File in C++,” stackoverflow, June 7, 2014, https://stackoverflow.com/questions/24092425/play-music-file-in-c.

css.php