private static Integer createBuffer(String wavFile) {
        // Define file location
        String file = defaultSoundLocation + wavFile;

        // Create a new buffer
        int buffer = AL10.alGenBuffers();

        // Try to load the wav file
        try (InputStream in 
                        = new BufferedInputStream(new FileInputStream(file))) {
            
            switch(file.substring(file.length() - 4).toLowerCase()) {
                case ".wav":
                    // Load the wav data
                    WaveData wav = WaveData.create(in);

                    // Upload the data into the buffer
                    AL10.alBufferData(buffer, wav.format, wav.data, wav.samplerate);

                    // Dispose the wav data
                    wav.dispose(); break;
                case ".ogg":
                    // Load the ogg data
                    OggData ogg = new OggDecoder().getData(in);
                    
                    // Upload the data into the buffer
                    AL10.alBufferData(buffer, ogg.channels > 1 ?
                            AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16,
                                                            ogg.data, ogg.rate);
                    
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

        // Check if the buffer is properly created
        if (AL10.alGetError() != AL10.AL_NO_ERROR) {
            Logger.error("Could not load " + wavFile);
            return null;
        }

        return buffer;
    }