Transcription task online

Hello.

I need to build an experiment where participants hear an audio sample and transcribe what they heard. Audio samples are recorded utterances/sentences.
I learned that I need to use codes to set this up in Psychopy. Is this text entry function supported online? I will use Pavlovia to launch this experiment.
If possible, what code do I need to use to set this up?

Thanks!

Hi @yoon, here is an example of text input for both local and online studies. This task asks your to type the word that appears on screen, but you could replace the probe word with audio:

code repo: https://gitlab.pavlovia.org/demos/textinput/
task URL: https://run.pavlovia.org/demos/textinput/html/

Hi @dvbridges,

Thank you so much for your help. I will use this resource!

I greatly appreciate it!

Hi @dvbridges, thank you for sharing this code here! Do you know how it’s possible to modify this code in the way that it allows not only letter input, but also all the other signs on the keyboard? Such as: .,-+()@

Hi @Mel499, you want to catch the keypress, and convert it to the right symbol. Currently I think it literally spells out the name of the symbol, e.g., "comma" for ','. Here is an example in JS - see the comma example:

if (textAdd === 'return') {
      textAdd = '';  // Add nothing
      continueRoutine = false;  // End routine (if that is what you want)
  } else if (textAdd === 'space') {
      textAdd = ' ';  // Add a space
  } else if (textAdd === 'backspace') {
      text.text = text.text.slice(0, -1);
      textAdd = undefined;
  } else if (textAdd === 'comma') {
      textAdd = ',';  // Add a comma     ////////////// COMMA EXAMPLE //////////////
  } else if (['lshift', 'rshift'].includes(textAdd)) {
      modify = true;
  } else if (textAdd !== undefined) {
      if (modify) {
          text.text = text.text + textAdd.toUpperCase();
          modify = false;
      } else {
          text.text = text.text + textAdd
      }
      textAdd = undefined;
  }

@dvbridges thank you for your answer! Is there any way that the program detects keyboard symbols as they are automatically, so that I don’t have to enter more than 30 symbols manually to the code?

Unfortunately not, but you can easily change the code to use a dictionary to look up the symbol instead. So you want the following:


// Begin Experiment tab
symbolObject = {}
symbolObject['comma'] = ','
symbolObject['period'] = '.'
symbolObject['plus'] = '+'
// and all other symbol names

// Each Frame
...
// instead of the specific comma code in the example
} else if ( symbolObject.hasOwnProperty(textAdd) ) {
      textAdd = symbolObject[textAdd]
...

@dvbridges okay, thanks for your help, I’ll try that!!

Hi @dvbridges,

I figured out I need to set up a code property in another routine and use the codes that you provided for ‘Begin routine’, ‘Each routine’, and ‘End routine’.
In my experiment, I will ask participants to first type what they heard and provide difficulty ratings for each audio sample. For ratings, I am using slide properties. Since I have another task after typing, should I leave the ‘End routine’ blank in code properties? Or will I insert any codes there?
How should I modify these codes?

Thank you!!

Hi,

I have used the code provided by @dvbridges (https://gitlab.pavlovia.org/demos/textinput/)
for my experiment and it worked perfectly well on my local computer.

However, when I synced my experiment with Pavlovia and played it online, I got an error message:

TypeError: Cannot read property ‘getKeys’ of undefined

Does anybody know what’s going on with this error?