How to play a sound file by pressing on a picture


Author
Message
plush
plush
Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)
Group: Forum Members
Posts: 57, Visits: 96
Hi!

I am starting to learn inquisit, and I would like to know how you can play a sound file by pressing with the mouse on a picture, without going to the next frame.

Thank you

seandr
seandr
Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)
Group: Administrators
Posts: 1.3K, Visits: 5.6K

Hi There,


You can define a picture as follows:


<picture mypic>
/ items = ("mypic.jpg")
/ position = (50%, 20%)
</picture>


and a sound as follows:


<sound mysound>
/ items = ("mysound.wav")
</sound>


Finally, you can connect them using a <trial> element:


<trial mytrial>
/ stimulustimes = [1=mypic]
/ inputdevice = mouse
/ validresponse = (mypic)
/ responsemessage = (mypic, mysound, 0)
/ responseinterrupt = trial
</trial>


That should hopefully give you the idea.


-Sean



plush
plush
Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)
Group: Forum Members
Posts: 57, Visits: 96
Thank you for the answer!

I have another question though.

How do I embed trials, within trials? Or how do I make sure both trial start at the same time? Because on one level, I am working with button press-action trials while on a second level I am working with embedding all the pictures and text on the same screen.

<trial mytrial>
/ stimulustimes = [1=play]
/ inputdevice = mouse
/ validresponse = (play)
/ responsemessage = (play, musicstimuli, 0)
/ responseinterrupt = trial
</trial>

+

<trial myturn>
/ pretrialpause = 500
/ stimulusframes=[1=musicstimulitext, participant1, participant2]
/ validresponse = (28)
/ inputdevice=keyboard
</trial>

= ..?



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
I'm not sure I fully understand what you're trying to accomplish. Please take the time to write up and post a more specific description of the overall procedure you're struggling to implement. However, I might make a few general points:

(1) Trials cannot be embedded within other trials, nor can Inquisit currently start / run two (or more) seperate trials at the same time. Inquisit is currently limited to running a single trial in order to collect a single response at a given time. Inquisit currently is also restricted to a single response modality (i.e. keyboard input OR mouse input OR response box input, etc) per trial.

(2) If all you want is a more complex event following your first trial (when subjects click on a picture in order to start playing a sound), you should look at the '/ responsetrial' attribute as an alternative to the '/ responsemessage' command you're currently working with.

Hope this helps,
~Dave

P.S.: One further note - if you really want to learn how to use Inquisit, it would be a good idea to start with some of the tutorials contained in the Inquisit helpfile. This would give you a pretty good idea about how Inquisit actually works...

plush
plush
Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)
Group: Forum Members
Posts: 57, Visits: 96
Thank you for the response. I understand now that one trial can only deal with one input modality. I am trying to study the tutorials in depth to get a feeling of inquisit, but I still have a few specific questions.

My experiment needs to be set up like this:

1. trial myturn1: the participant hears a song and can indicate to repeat the song or go on to the next trial.
2. trial myturn2: the participant needs to perform an action (asking a question to a confederate), and presses the next button when he/she is done.
3. trial otherturn: the participant needs to indicate whether the response the confederate gave was correct or incorrect. A score is adjusted accordingly when the next myturn trial starts.

Problems:

a) to repeat a song, should I use

trialresponse (refresh, myturn1)
OR
/ branch [ if ( trial.myturn.response == refresh) trial.myturn].

The first worked but did not reload  the same stimuli, the latter the did not work at all.

b) how can I achieve to have the same stimuli loaded across trials so that trial myturn1, myturn2, and otherturn show the same number on the scoreboard, and also show the same song title as text.

* remark: the feedback by the confederate is fixed, so I'll already know the score - pattern.

---------------------------------------------------------------------------------------
*** DEFAULTS ***
---------------------------------------------------------------------------------------       

<defaults>
/ fontstyle = ("Courier New", 14pt)
/ screencolor = (255, 255, 255)
</defaults>

<instruct>
/ nextkey = (28)
/ prevkey = (14)
/ prevlabel = "Druk op 'Backspace' om terug te gaan"
/ lastlabel = "Druk op 'Enter' om door te gaan"
/ nextlabel = "Druk op 'Enter' om door te gaan"
/ font = ("Arial", -18, 400, 0, 34)
</instruct>

***Stimuli Score Board ***

<text scoreboard1>
/ items = ("Score:")
/ position = (20%, 17%)
/ fontstyle = ("Arial", 20pt, true)
</text>

<counter scoreselector>
/ select = sequence (1-30)
</counter>

<text scoreboard2>
/ items = scoreboard
/ select = scoreselector
/ position = (20%, 20%)
/ fontstyle = ("Arial", 20pt, true)
</text>

<item scoreboard>
/ 1 = "     0     "
/ 2 = "     10     "
/ 3 = "     -5     "
/ 4 = "     5     "
/ 5 = "     15     "
/ 6 = "     25     "
/ 7 = "     35     "
/ 8 = "     20     "
/ 9 = "     30     "
/10 = "     40     "
/11 = "     25     "
/12 = "     35     "
/13 = "     45     "
/14 = "     30     "
/15 = "     40     "
/16 = "     25     "
/17 = "     10     "
/18 = "     20     "
/19 = "     30     "
/20 = "     40     "
/21 = "     25     "
/22 = "     10     "
/23 = "     -5     "
/24 = "     -20     "
/25 = "     -10     "
/26 = "     0     "
/27 = "     -15     "
/28 = "     -30     "
/29 = "     -45     "
/30 = "     -60     "
</item>

*** Stimuli Titels Liedjes*** (Song Titles)

<counter musicstimulitextselector>
/ select = sequence (1-30)
</counter>

<text musicstimulitext>
/ items = musicstimulitext
/ position = (70%, 20%)
/ select = musicstimulitextselector
</text>

<item musicstimulitext>
/ 1 = "        Op Een Grote Paddestoel        "
/ 2 = "        3 Maal 3 Is Negen        "
/ 3 = "        Iene Miene Mutte        "
/ 4 = "        Lang Zullen Ze Leven        "
/ 5 = "        Sinterklaas Kapoentje        "
/ 6 = "        Het Regent        "
/ 7 = "        Alle Eendjes Zwemmen in het Water      "
/ 8 = "        Ik Zag 2 Beren        "
/ 9 = "        O Denneboom        "
/10 = "        Schipper Mag Ik Overvaren        "
/11 = "        Hoofd, Schouders, Knie en Teen        "
/12 = "        Sinterklaasje Bonne Bonne Bonne        "
/13 = "        Ozewiezewoze        "
/14 = "        Altijd Is Kortjakje Ziek        "
/15 = "        De Mosselman        "
/16 = "        Daar Word Aan De Deur Geklopt        "
/17 = "        Slaap Kindje Slaap        "
/18 = "        Poesje Mauw        "
/19 = "        Zakdoekje Leggen        "
/20 = "        Vader Jacob        "
/21 = "        Berenbotje        "
/22 = "        Moriaantje        "
/23 = "        Dat Gaat Naar Den Bosch Toe        "
/24 = "        Altijd is Kortjakje Ziek        "
/25 = "        Rije Rije Rije        "
/26 = "        Klap Eens In De Handjes        "
/27 = "        Zevensprong        "
/28 = "        Er Is Er Een Jarig        "
/29 = "        In Holland Staat Een Huis        "
/30 = "        Zagen Zagen        "
</item>

*** Stimuli Geluiden*** (Songs)
<counter musicselector>
/ select = sequence (1-30)
</counter>

<sound musicstimuli>
/ items = musicstimuli
/ select = musicselector
</sound>

<item musicstimuli>
/ 1 = "1.paddestoel.wav"
/ 2 = "2.3x3.wav"
/ 3 = "3.ienemiene.wav"
/ 4 = "4.langleven.wav"
/ 5 = "5.kapoentje.wav"
/ 6 = "6.hetregent.wav"
/ 7 = "7.eendzwem.wav"
/ 8 = "8.2beren.wav"
/ 9 = "9.denneboom.wav"
/10 = "10.schipper.wav"
/11 = "11.hoofd.wav"
/12 = "12.sintbonne.wav"
/13 = "13.ozewiezewoze.wav"
/14 = "14.kortjakje.wav"
/15 = "15.mosselman.wav"
/16 = "16.deurgeklopt.wav"
/17 = "17.slaapkind.wav"
/18 = "18.poesje.wav"
/19 = "19.zakdoekje.wav"
/20 = "20.jacob.wav"
/21 = "21.berenbotje.wav"
/22 = "22.moriaantje.wav"
/23 = "23.denbosch.wav"
/24 = "24.huygen.wav"
/25 = "25.rijerije.wav"
/26 = "26.klaphand.wav"
/27 = "27.zeven.wav"
/28 = "28.eenjarig.wav"
/29 = "29.hollandhuis.wav"
/30 = "30.zagen.wav"
</item>

*** Stimuli Plaatjes *** (pictures)

<picture participant1>
/ items = ("participant1.jpg")
/ size = (33%, 33%)
/ position = (20%, 50%)
</picture>

<picture participant2>
/ items = ("participant2.jpg")
/ size = (33%, 33%)
/ position = (25%, 57%)
</picture>

<picture participant11>
/ items = ("participant1.jpg")
/ size = (33%, 33%)
/ position = (25%, 57%)
</picture>

<picture participant22>
/ items = ("participant2.jpg")
/ size = (33%, 33%)
/ position = (20%, 50%)
</picture>

<picture good>
/ items = ("correct.gif")
/ size = (10%, 10%)
/ position = (65%, 50%)
</picture>

<picture incorrect>
/ items = ("incorrect.gif")
/ size = (10%, 10%)
/ position = (75%, 50%)
</picture>

<picture next>
/ items = ("next.jpg")
/ size = (10%, 10%)
/ position = (80%, 50%)
</picture>

<picture refresh>
/ items = ("refresh.jpg")
/ size = (10%, 10%)
/ position = (60%, 50%)
</picture>

<picture next2>
/ items = ("next.jpg")
/ size = (10%, 10%)
/ position = (70%, 50%)
</picture>

------------------------------------------------------------------------------------
*** INSTRUCTION PAGES *****
------------------------------------------------------------------------------------

<page welcome>
^^^^
Hoi! Je staat op het punt om te beginnen met de muziektest!
^^^
Dit betekent dat je deuntjes moet gaan tikken.
^^^^
Het is belangrijk dat je dit erg nauwkeurig doet, want in een ander hokje zit een andere proefpersoon 'de rader', die de liedjes kort heeft bestudeerd voor het experiment begon.
^^^^
Hij of zij moet zo goed mogelijk raden welk deuntje jij tikt, en zijn/haar beloning is gekoppeld aan de eindscore.
</page>

<page page1>
Je zult misschien niet alle liedjes kennen, daarom krijg je van ons wat hulp.
^^
Je krijgt namelijk elk liedje te horen.
</page>

<page end>
Dit deel van het experiment is nu afgelopen.
^^^^

</page>

------------------------------------------------------------------------------------
*** TRIALS *****
------------------------------------------------------------------------------------

<trial myturn1>
/ pretrialpause = 1500
/ stimulusframes=[1=musicstimulitext, participant1, participant2, scoreboard1, scoreboard2, refresh, next, musicstimuli]
/ inputdevice=mouse
/ validresponse = (refresh, next)
</trial>

<trial myturn2>
/ stimulusframes=[1=musicstimulitext, participant1, participant2, scoreboard1, scoreboard2, next2]
/ inputdevice=mouse
/ validresponse = (next2)
</trial>

<trial otherturn>
/ stimulusframes=[1=musicstimulitext, participant22, participant11, good, incorrect, scoreboard1, scoreboard2]
/ inputdevice = mouse
/ correctresponse = (good, incorrect)
</trial>

------------------------------------------------------------------------------------
*** BLOCKS *****
------------------------------------------------------------------------------------

<block one>
/ trials = [1-90 = myturn1, myturn2, otherturn]
</block>

------------------------------------------------------------------------------------
*** EXPERIMENT***
------------------------------------------------------------------------------------

<expt>
/ subjects = (1 of 1)
/ blocks = [1=one]
/ preinstructions = (welcome, page1)
/ postinstructions = (end)
</expt>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Hey there,

thanks for providing the details. The file attached to this post should give you the desired behavior. Please check it out and then report back (I actually require you to do this!). The general approach I used is this:

- 'Linking' the different counters to select corresponding items.
- Forcing the counters to select a single, constant value.
- Incrementing this value if - and only if - the whole 3 trial sequence (myturn1, myturn2, otherturn) is absolved so that the next set of items gets selected.

Best wishes,
~Dave

Attachments
Plush.exp (1.1K views, 7.00 KB)
plush
plush
Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)
Group: Forum Members
Posts: 57, Visits: 96
Works perfectly!

thx for the help!

Klemens
Klemens
Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)
Group: Forum Members
Posts: 6, Visits: 1

Hi Dave, Hi Plush, Hi Sean,


I stumbled across the same problem as Plush did. I'd like to be able to play back a soundfile repeatedly by clicking on a button / picture. To further complicate things, there should be a likert element on the same frame.


As I understood from your post, Dave, this would require to "nest" trials within trials, which is not possible in Inquisit at this time - or is it?


Best,


Klemens


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

As I understood from your post, Dave, this would require to "nest" trials within trials, which is not possible in Inquisit at this time - or is it?


I don't see why one would need to "nest" trials in this case.


I stumbled across the same problem as Plush did. I'd like to be able to play back a soundfile repeatedly by clicking on a button / picture. To further complicate things, there should be a likert element on the same frame.


Here's what you need to do:


(1) Don't (!) use Inquisit's <likert> element in this case. Instead build your own likert scale as exemplified by this sample script: http://www.millisecond.com/download/samples/v2/CustomLikert/customlikert.zip


(2) Add your sound stim and the button as an additional stimulus / response to the custom likert <trial>.


(3) Apply branching logic to the <trial>: If subject clicks on button, repeat the trial. If subject submits a rating, move on to the next trial.


(4) Be careful about item selection. In case of a button press you need to avoid selecting a new sound stim (in case you have several). Use dummy trials to do the item selection.


Regards,


~Dave


Klemens
Klemens
Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)Esteemed Member (1.6K reputation)
Group: Forum Members
Posts: 6, Visits: 1

Hi Dave,



thanks for your quick reply - this is a great forum!! I spent the last few days trying to figure out a way to link the approach you suggested with some advice from older post about paired comparisons (http://www.millisecond.com/community/forums/t/1106.aspxhttp://www.millisecond.com/community/forums/p/976/2511.aspx)


I should have been more specific from the beginning: What I'd like to do is a paired comparisons-study with several auditory stimuli. In each comparison trial, the two sounds to be compared should only be triggered by user action (i.e. by clicking on one of two sound buttons, as opposed to clicking on the likert scale in order to give a rating).


Here's what I've accomplished so far:



  1. I've already set up the paired comparisons part using two linked counters that generate the randomized pairs.

  2. As you suggested, Dave, I've built my own likert scale and added the scale as well and two picture-buttons to my comparison trial.

  3. I tried to include some branching, so that the comparison trial is repeated when a button is clicked, whereas a dummy trial is started when a rating is given.

  4. Clicking on a button starts playback of the sound stim (via the "responsemessage"-attribute).

  5. In order to randomize within the stimulus pairs, I use counters to switch the position of the buttons.


What I do not know yet is how to set up the dummy trial that selects new sound stimuli. Also, clicking the buttons starts playing the sound stims, but unfortunately starts a new trial at the same time (which is not a big surprise).



    Here's my script:


    <sound sound1>
    / items = sounds
    / select = sound1select
    </sound>


    <sound sound2>
    / items = sounds
    / select = sound2select
    </sound>


    <item sounds>
    /1 = "stimulus1.wav"
    /2 = "stimulus2.wav"
    /3 = "stimulus3.wav"
    /4 = "stimulus4.wav" 
    </item>


    <counter sound1select>
    / items = (
    1, 1, 1,
    2, 2,
    3)
    / select = noreplace 
    </counter>


    <counter sound2select>
    / items = (
    2, 3, 4,
    3, 4,
    4)
    / select = current(sound1select) 
    </counter>


    <picture button1>
    / items = ("button1.jpg")
    / position = (counter.bswitch1.selectedvalue, 35%)
    / erase = true(255, 255, 255)
    </picture>


    <picture button2>
    / items = ("button2.jpg")
    / position = (counter.bswitch2.selectedvalue, 35%)
    / erase = true(255, 255, 255)
    </picture>


    <counter bswitch1>
    / items = (40, 60)
    / select = noreplace
    / selectionrate = always
    </counter>


    <counter bswitch2>
    / items = (60, 40)
    / select = current(bswitch1)
    </counter>


    <trial comparison>
    / stimulusframes = [1=button1, button2, likertscale, b1, b2, b3, b4, b5, b6, b7]
    / inputdevice = mouse
    / validresponse = (button1, button2, b1, b2, b3, b4, b5, b6, b7)
    / responsemessage = (button1, sound1, 0)
    / responsemessage = (button2, sound2, 0)
    / responseinterrupt = trial
    / branch = [if (trial.comparison.response == button1|| trial.comparison.response == button2) trial.comparison]
    / branch = [if (trial.comparison.response == b1  || trial.comparison.response == b2  || trial.comparison.response == b3  || trial.comparison.response == b4  || trial.comparison.response == b5  || trial.comparison.response == b6  || trial.comparison.response == b7) trial.itemselection]
    </trial>


    <trial itemselection>
    ???
    / branch = [trial.comparison]
    </trial>


    <block allcomparisons>
    / trials = [1-6= noreplace(comparison)]
    </block> 



    Thanks a lot for your help for which I'm very, very grateful,


    Klemens



    GO

    Merge Selected

    Merge into selected topic...



    Merge into merge target...



    Merge into a specific topic ID...




    Reading This Topic

    Explore
    Messages
    Mentions
    Search