Millisecond Forums

How to stop sounds

https://forums.millisecond.com/Topic17824.aspx

By Herby1209 - 11/24/2015

Hi,

i am programming a game for my master thesis and could need some help.
Participants should play 3 rows of a public goods game while listening to one certain sound (length of about 10 minutes) and after playing those 3 rounds the sound should be stopped or replaced by a second soundfile. Listening to that new soundfile they should play another 3 rows.
My problem is that i cant stop the sound (tried to change the "erase" status, lowering the volume and many other things but it seems you can just set these attributes once and not change them in any trial).
My sound looks like that:  (there are 3 sounds because i got 2 groups and they will hear different sounds)

<sound test>
/ erase = false
/ items = (test1.wav", "test2.wav", "test3.wav")
/ select = replace
/ playthrough = false
</sound>

i hoped by "select = replace" the playing sound would just stop when the next starts but it doenst work, the second starts but the first one doenst stop.

Is there any way to fix my problem? I could reduce the length of the tracks but i dont know exactly how long it will take the participants to play the 3 rounds of the game.

Thanks for your help
Herby
By Dave - 11/24/2015

Set up a <block> that runs your 3 "game rounds" (i.e., the <trial>s). During the <block>, have the sound play in the background via the <block>'s /bgstim. Run the block 3 times.

<expt>
/ blocks = [1-3 = gameblock]
...
</block>

<block gameblock>
/ bgstim = (test)
/ trials = [...]
</block>

<sound test>
/ items = (test1.wav", "test2.wav", "test3.wav")
/ select = noreplace
/ playthrough = false
/ selectionrate = block
/ resetininterval = 0
</sound>

By Herby1209 - 11/25/2015

Thanks for your answer, i will modify my program and see if this works!
By Herby1209 - 11/25/2015

This doenst seem to work at all...
I also tried to seperate the three songs but the effect is the same. After the block ended the music keeps playing and doenst stop as it should.
Is there any mistake i am too blind to see?

<block Spielrunde_neutral>
/ bgstim = (Musik)
/ trials = [1 = sequence(instructions_contributions, verhaltenA_no_fear, verhaltenB_no_fear, verhaltenC_no_fear)]
/ onblockend = [values.totalwin_p=(values.firstround_win+values.secondround_win+values.thirdround_win);
    values.totalwin=((values.firstround_win+values.secondround_win+values.thirdround_win)*40);
    values.totalwin_plus=(((values.firstround_win+values.secondround_win+values.thirdround_win)*40)+2400);
]
</block>

<sound Musik>
/ items = ("test1.wav", "test2.wav", "test3.wav")
/ select = noreplace
/ playthrough = false
/ selectionrate = block
/ resetininterval = 0
</sound>
By Herby1209 - 11/25/2015

Btw i corrected my mistake in resetintervall but it didnt change anything.
When a new block starts with bgstim both songs are played at the same time... no idea why this happens
By Dave - 11/25/2015

That code looks okay. FWIW, sounds stop / change with a new block for me as they should.

#1: What's your OS (type and version)?
#2: Is your Inquisit installation up to date? If not, please install the latest release?
#3: What happens when you use a <video> element instead of <sound>?

Thanks.
By Herby1209 - 11/25/2015

Hi,

1: i am using Windows 10 Home 64 bit
2: i just downloaded the latest Version (Inquisit for Lab 4.0.9.0)
3: i couldnt believe my eyes, videos actually stop. When i use video and sound as bgstim only the video stops but the sound keeps playing.

also tried different sound files, maybe it is a codec problem. i used Audacity to create "WAV (Microsoft) signed 16-bit pcm"


By Herby1209 - 11/25/2015

i cant find a way to edit my posts thus i made a this one:

i am thinking about converting my Wav files to a video and play it with 1x1 pixels in one corner... maybe that would work.
By Dave - 11/25/2015

You don't need to convert to a video format to use the <video> element. The <video> element handles all kinds of compressed / "streaming" formats, including audio-only formats (e.g. MP3).
By Herby1209 - 11/25/2015

Thanks! You are my hero!

I used an mp3 file as video and the program does exactly what it should do!
By vonrishi - 8/24/2017

This thread helped me in getting started, but I have a slightly different task I want to perform.

The experiment will begin when the participants clicks on the picture. It will be a 6 minute audio file. The participant should have the option to pause the sound and resume by clicking on the same picture/button. I read on another thread that Inquisit doesn't support pausing/resuming video files. Does it apply to audio files too? If not, what is the syntax to pause/resume an audio with a button press?

I would greatly appreciate your input. Thank you.