1

In the context of my thesis I needed to create an audio experiment to be realized by participants in my lab. But with the corona I need to adapt it to an online experiment. I chose to use a site named pavlovia which allow me to make an html/javascript experiment, the site act as a host and collect the data for me.

In matlab I was selecting randomly 3 sounds in a directory to load them in vectors, sum them and play the result with audioplayer function. My problem is that I don't know how to do that in javascript. I only found information on how to play a registered sound, not how to play a sound which is in fact stored in a variable in memory.

zatamine
  • 3,458
  • 3
  • 25
  • 33
FranckEl
  • 63
  • 7
  • i'm not sure i get the problem. do you export the audio to a file ? your website is not connected to matlab – AlainIb May 08 '20 at 22:08
  • No in fact I had a matlab file where I did this : – FranckEl May 08 '20 at 22:13
  • Check the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) – Griffin May 09 '20 at 12:23
  • 1
    It's hard to do on client side. You may check [this](https://stackoverflow.com/a/29319016/1958051) and [this](https://stackoverflow.com/a/32211766/1958051) solutions for more info. – user1987 May 10 '20 at 17:37
  • @Griffin Yes I've already check that way but I don't know how to use it well. Here functions are ready to use whereas in my case I was computing the vector content with the formula I needed before playing the sound so I was sure to do exactly what I want in terms of calculus (I do AM modulation to a complex sound). Do you think I need to found a way to use preregistered sounds for this application ? Or maybe it's possible for me to include Python in the HTML to make the calculus and play the sound (python look like MatLab that's why I ask) ? Sorry I am new in js so I don't know it well – FranckEl May 10 '20 at 17:39
  • @user1987 Just saw your comment when I posted mine, I will check and edit this comment, thanks – FranckEl May 10 '20 at 17:41

0 Answers0