I have a psychopy experiment that I need to convert to psychoJS (unfortunately I don’t have the psyexp file for it). In this experiment, there is an audio stimulus that needs to be used.
The audio simulus uses random stimulation frequency between 1 Hz and 15 Hz.
import numpy as np
audio_time = np.arange(0,3,1/48000)
audio_carrier_freq = 200
audio_carrier = np.sin(2np.piaudio_carrier_freq*audio_time)
audio_envelope_freq = np.random.uniform(1,15)
audio_envelope = np.sin(2np.piaudio_time*audio_envelope_freq)
audio_signal = (1+audio_envelope)audio_carrier0.5
audio_sound = sound.Sound(audio_signal,sampleRate=48000)
Here, audio_signal is an array of decimal.
However, I am not able to convert it to the sound class of psychoJS does not have capacity to introduce array . It either requires a number or a string.
How do I handle this scenario.
I am not sure how do I use tone.js and use it as a stimulus.
Any help is appreciated.