# HG changeset patch # User Marcus Pearce # Date 1311099247 -3600 # Node ID 235484b93707841123f517f8319a73afe291058d # Parent e2242b4b0b3d541fc1ecfe02886954ad99081eca Make the familarity/pleasantness questions and final questionnaire command line options. Ignore-this: cc4721e49541fa92c99fc37cf313b09b diff -r e2242b4b0b3d -r 235484b93707 Experiment.java --- a/Experiment.java Fri Jul 15 16:36:53 2011 +0100 +++ b/Experiment.java Tue Jul 19 19:14:07 2011 +0100 @@ -2,7 +2,7 @@ * File: Experiment.java * Author: Marcus Pearce * Created: <2007-02-14 11:28:27 marcusp> - * Time-stamp: <2011-07-15 12:34:18 marcusp> + * Time-stamp: <2011-07-19 15:25:51 marcusp> *============================================================================= */ @@ -46,6 +46,13 @@ /* number of units that clock runs for before a probe event */ private int numUnits; + /* whether to ask about familiarity of each song */ + private boolean askFamiliarity; + /* whether to ask about liking of each song */ + private boolean askLiking; + /* whether to include final questionnaire */ + private boolean finalQuestionnaire; + /* the blocks of the experiment */ Block[] blocks; int currentBlockID; @@ -65,6 +72,10 @@ private int midiDevice; /* accessors */ + public boolean getAskLiking() { return askLiking; } + public boolean getAskFamiliarity() { return askFamiliarity; } + public boolean getFinalQuestionnaire() { return finalQuestionnaire; } + public int getMidiDeviceNumber() { return midiDevice; } public int getScaleLength() { return scaleLength; } public String getLowAnchor() { return lowAnchor; } @@ -87,7 +98,7 @@ } /* Constructor */ - public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf) { + public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf, int fam, int lik, int quest) { // Setup variables results = new SubjectResults(this); @@ -105,6 +116,22 @@ MIDIFILELIST_FILE = MIDI_DIRECTORY + "filelist.txt"; PRACTICE_MIDIFILELIST_FILE = MIDI_DIRECTORY + "pfilelist.txt"; INSTRUCTIONS_FILE = inf; + + if (fam == 0) + askFamiliarity = false; + else + askFamiliarity = true; + if (lik == 0) + askLiking = false; + else + askLiking = true; + if (quest == 0) + finalQuestionnaire = false; + else + finalQuestionnaire = true; + + + // Initialise the experiment Block practice = new Block(this, gui, PRACTICE_MIDIFILELIST_FILE, @@ -168,9 +195,12 @@ String ha = args[n++]; String mfd = args[n++]; String inf = args[n++]; + int fam = Integer.parseInt(args[n++]); + int lik = Integer.parseInt(args[n++]); + int quest = Integer.parseInt(args[n++]); // Create experiment - Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf); + Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf, fam, lik, quest); // Show the GUI int width=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(); diff -r e2242b4b0b3d -r 235484b93707 ExperimentController.java --- a/ExperimentController.java Fri Jul 15 16:36:53 2011 +0100 +++ b/ExperimentController.java Tue Jul 19 19:14:07 2011 +0100 @@ -2,7 +2,7 @@ * File: ExperimentController.java * Author: Marcus Pearce * Created: <2007-12-14 12:06:10 marcusp> - * Time-stamp: <2010-11-25 11:09:56 marcusp> + * Time-stamp: <2011-07-19 15:26:30 marcusp> *============================================================================= */ @@ -88,12 +88,15 @@ // SubjectDataPanel else if (e.getSource() == sdp.getFinishButton()) { - if (sdp.allDataEntered()) { - sdp.storeData(); - results.writeSubjectData(); + if (exp.getFinalQuestionnaire()) { + if (sdp.allDataEntered()) { + sdp.storeData(); + results.writeSubjectData(); + System.exit(0); + } else + reportError("You have not filled in all the information."); + } else System.exit(0); - } else - reportError("You have not filled in all the information."); } // StimulusPanel @@ -109,10 +112,18 @@ reportError("There are unanswered questions."); else { // store results (and write to file) - String answer1 = (String)(sp.getQ1Box().getSelectedItem()); - String answer2 = (String)(sp.getQ2Box().getSelectedItem()); - block.addMelodyQA("known", answer1); - block.addMelodyQA("liked", answer2); + if (exp.getAskFamiliarity()) { + String answer1 = (String)(sp.getQ1Box().getSelectedItem()); + block.addMelodyQA("known", answer1); + } else + block.addMelodyQA("known", "-1"); + + if (exp.getAskLiking()) { + String answer2 = (String)(sp.getQ2Box().getSelectedItem()); + block.addMelodyQA("liked", answer2); + } else + block.addMelodyQA("liked", "-1"); + block.storeMelodyResult(); results.writeResults(); // close the midi player diff -r e2242b4b0b3d -r 235484b93707 README --- a/README Fri Jul 15 16:36:53 2011 +0100 +++ b/README Tue Jul 19 19:14:07 2011 +0100 @@ -5,7 +5,7 @@ USAGE - java Experiment + java Experiment where specifies whether to show the clock (0 = no; 1 = yes) and and are integers: the clock runs for time @@ -25,6 +25,16 @@ the participant which will be displayed at the beginning of the experiment. +If is 1 the participant is asked to rate the familiarity +of each stimulus, if it is 0 the question is omitted. + +If is 1 the participant is asked to rate the pleasantness +of each stimulus, if it is 0 the question is omitted. + +if is 1, experiment ends with a compulsory +questionnaire on age, sex, musical training etc.; if it is 0 the +questionnaire is optional. + See runExperiment.bat for an example. To use in a study: @@ -36,7 +46,8 @@ to contain the midi files played in the practice and main blocks respectively: put one file on each line followed by a list of note numbers to probe with the visual clock. NB: that the last line of -these files must terminate with a newline. +these files must terminate with a newline and the note numbers are +zero indexed (so the first note is indexed by 0). 3. edit Data/instructions.html if necessary or create a new set of instructions. diff -r e2242b4b0b3d -r 235484b93707 StimulusPanel.java --- a/StimulusPanel.java Fri Jul 15 16:36:53 2011 +0100 +++ b/StimulusPanel.java Tue Jul 19 19:14:07 2011 +0100 @@ -2,7 +2,7 @@ * File: StimulusPanel.java * Author: Marcus Pearce * Created: <2007-12-05 11:24:00 marcusp> - * Time-stamp: <2010-06-21 16:50:59 marcusp> + * Time-stamp: <2011-07-19 15:39:36 marcusp> *============================================================================= */ @@ -78,19 +78,23 @@ JPanel questionsPanel = new JPanel(); GridLayout gl = new GridLayout(2,2); gl.setHgap(50); - questionsPanel.setLayout(gl); + questionsPanel.setLayout(gl); - String[] q1BoxOptions = { "", "Yes", "No" }; - q1Box = new JComboBox(q1BoxOptions); - q1Box.setSelectedIndex(0); - questionsPanel.add(new JLabel("Are you familiar with this melody?")); - questionsPanel.add(q1Box); + if (exp.getAskFamiliarity()) { + String[] q1BoxOptions = { "", "Yes", "No" }; + q1Box = new JComboBox(q1BoxOptions); + q1Box.setSelectedIndex(0); + questionsPanel.add(new JLabel("Are you familiar with this melody?")); + questionsPanel.add(q1Box); + } - String[] q2BoxOptions = { "", "1", "2", "3", "4", "5"}; - q2Box = new JComboBox(q2BoxOptions); - q2Box.setSelectedIndex(0); - questionsPanel.add(new JLabel("How pleasant do you find this melody (1 = very unpleasant, 5 = very pleasant)?")); - questionsPanel.add(q2Box); + if (exp.getAskLiking()) { + String[] q2BoxOptions = { "", "1", "2", "3", "4", "5"}; + q2Box = new JComboBox(q2BoxOptions); + q2Box.setSelectedIndex(0); + questionsPanel.add(new JLabel("How pleasant do you find this melody (1 = very unpleasant, 5 = very pleasant)?")); + questionsPanel.add(q2Box); + } JPanel questionsPanel2 = new JPanel(); questionsPanel2.setBorder(BorderFactory.createRaisedBevelBorder()); @@ -134,14 +138,15 @@ } public void defaultAnswers() { - q1Box.setSelectedIndex(0); - q2Box.setSelectedIndex(0); + if (exp.getAskFamiliarity()) + q1Box.setSelectedIndex(0); + if (exp.getAskLiking()) + q2Box.setSelectedIndex(0); } public boolean unansweredQuestions() { - if (q1Box.getSelectedItem().equals("") || - q2Box.getSelectedItem().equals("") - ) + if ((exp.getAskFamiliarity() && q1Box.getSelectedItem().equals("")) || + (exp.getAskLiking() && q2Box.getSelectedItem().equals(""))) return true; else return false;