
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/e1173f7b-9967-4004-b5e1-437ed1cf2b61%40googlegroups.com.
Hi Jules,Sorry for the delayed reply. I am attaching an example that will hopefully be of use to you:Basically, the idea is that you need to store each of your WAV audio data in a variable (e.g. a BehaviorSubject).Once the data is stored, you can replay it using the AudioPlayback node. The trick is how to control when the replay is done.In this case, I am using a SelectMany node. This node can be used to trigger stuff on-demand. Inside each SelectMany, I simply have a SubscribeSubject that reads from one of the stored audio buffers and sends it out to the AudioPlayback node. This way you can control exactly when you want to play each sound, and it will play it only once to the end. Here I am using a different KeyDown event to control the different sounds, but you can use other things.Make sure that your event source fires only once at the beginning of the event, and that it doesn't keep firing. For example, if you want ROI entry to activate the sound, you can't have the event firing for every frame the ROI is activated, but only the first time there is an entry. If you have a Boolean source, for example from the PythonTransform, you can use DistinctUntilChanged to make sure events are only fired when the value changes.Play around with the attached workflow a bit and hopefully it will make things more clear.Hope this helps!
On 5 February 2018 at 14:58, <lebert...@gmail.com> wrote:
Hi again.I am a beginner in programming and I am struggling with this simple bonsai workflow. I managed to create a workflow with a random inside it. But as the workflow seems to be constantly read it only jumps from the beginning of one sound to the other. How could I generate my sweep sound only once and then go to the rest of the workflow? The rest of the workflow would be that, depending on which branch of the workflow the random chose to go, one other ROI would give a reward and restart the workflow, and the other just play an error sound and also restart the workflow.Basically, it is a 2AFC task where I learn a rat to go either on the right or the left of my track depending of the sound played. And if he makes the good choice, bonsai will send a message to an Arduino which will give him a reward.I join my workflow if it can help.Thanks!
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/a2b08555-f96e-4e61-87a3-567c039ada47%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/16412868-6a6f-4b7d-bc8c-98419ad7d1e0%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/c344ebbc-0958-4eec-870c-ec0e7ccd9cc3%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/a43adbbc-29b3-4bfb-ac71-1f0dc98f8958%40googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/2c11d825-260c-4938-af22-d478d7ba578a%40googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/b6c1bca6-0688-4d5a-817b-163dcd1e4996%40googlegroups.com.
Hello Gonçalo,
I am experiencing difficulty in playing the same randomly selected tone at two different stages of an ROI activation sequence. Attached is the toy example I created to discern how best to implement this audio cuing for my task. However, before explaining my problem/confusion, it might be helpful for me to take a step back and explain what my task is.
I am adapting the “Restaurant Row” paradigm outlined in Sweiss et al 2018, as pictured below.
In my version of the task, mice will run in either clockwise or counterclockwise circles, sampling the food pellet “offers” they receive from each restaurant over the course of a 1 hour trial (during which they will collect all of their food for a given day). If a mouse enters the T-shaped junction of a restaurant from the correct direction, an audio cue corresponding to one of four reward probabilities (1, 0.8, 0.2, or 0) will be played until a decision is made. If the mouse rejects the offer and turns left toward the next restaurant (as depicted above) , the cue silences immediately once the offer zone is exited. Alternatively, if a mouse accepts the offer, the same tone will play for a fixed wait time of 5 seconds, which constitutes the cost of an offer. If a mouse enters the offer zone but quits before the full wait time has elapsed, the tone will be silenced immediately.
Though my current workflow (which I am happy to attach if it would be helpful) accurately tracks all of the directionally sensitive ROI activation, I have not been able to fully simulate this cue contingency. In my toy example below, everything seems to work exactly as I need up until the Audio Reader node. Even though the input mapping node sends the relevant string value for the appropriate file to the Audio Reader, the first entrance of the ROI makes no noise (and the Audio Reader appears to be receiving no input at all despite getting an input from input mapping). Additionally, if the ROI that is simulating the offer zone is activated repeatedly without activating the T-junction ROI (so that no tone is generated), the first proper ROI activation sequence will generate the same problem, where the appropriate string gets processed through the input mapping node but not by the Audio Reader node. (To be clear, the stream emanating from the video capture node in this toy example does not explicitly capture the contingencies I have in the ‘master’ workflow, but if you manually trigger the first stream then the second, you can simulate the relevant contingencies).
Any intuitions as to what is going on? I am pretty thoroughly confused. And thank you in advance!!
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai...@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.

To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/516dc48c-b94b-4742-bd24-e4b790b2ee5a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/4bf127a6-b7e0-4aab-a44e-aa1f1efe9e04%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/4bf127a6-b7e0-4aab-a44e-aa1f1efe9e04%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/0eb49d31-ac6a-4d3e-8986-ed6d521f53fb%40googlegroups.com.
Jules
</d