private void loadMidi(String fileName) {
        this.unload();
        try {
            URL midiURL = getClass().getClassLoader().getResource(fileName);
            midiFile = new File(midiURL.getFile());

            seq = MidiSystem.getSequence(midiURL);

            seqr.open();
            seqr.setSequence(seq);
            loaded = true;
            defaultTempo = seqr.getTempoInBPM();
        } catch (IOException ioe) {
            log.d("MIDI error: Problem occured while reading " + midiFile.getName() + ".");
        } catch (InvalidMidiDataException imde) {
            log.d("MIDI error: " + midiFile.getName() + " is not a valid MIDI file or is unreadable.");
        } catch (Exception e) {
            log.d("MIDI error: Unexplained error occured while loading midi.");
        }
    }