MOLE Modifiable Language Experiments

fancywavread Instructions

Description

This function adds on to the built-in MATLAB function wavread by converting the input sound file to the correct format  (2 channel, stereo sound) instead of crashing the program.

General

This function will read in the sound file specified and will transform the direction of the vector if it is in a format that PsychPortAudio is unfamiliar with.  This function also allows for the optional argument ‘side’ to be specified, which will play the sound to one specified ear (one side of the headphones).

If the optional argument is specified, the function is able to format a stereo sound to act as a mono sound by overwriting one sound channel with no sound.

The function will return your correctly formatted sound, along with the sampling rate of the sound.

Usage

fancywavread(soundfile,side)

Ex. fancywavread(‘ExpASound’)
Ex. fancywavread(‘ExpASound’,’L’)

Arguments

soundfile:  String input that specifies the name of the sound file (.wav format) to be played.
Ex.  ‘ExpASound’

side:  Optional string input that specifies which ear the mono sound should be played to.  Input takes the form of either ‘L’ for left, or ‘R’ for right.
Ex. ‘L’

Notes

All string inputs must be surrounded by single quotation marks ( ‘ ‘ ).

All string inputs are case sensitive.

If you feed this function a stereo sound but then specify the ‘side’ argument, the non-specified channel will be overwritten with blanksound to create a mono sound.  This means you do not have to feed this function a mono sound if you want it to only be played to one side of the head.

 

If you would like to download this read-me to your computer, you can do so below (right-click and ‘Save As’).
PDF
RTF

 

About Sarah Creel

I'm an Associate Professor of Cognitive Science at UC San Diego.

Comments are closed.

Post Navigation