Variable audio speed playback using PsychPortAudio?

Is a way to change the speed that PsychPortAudio plays a given audio file? I can't seem to find anything to this effect in the documentation so I was wondering if anyone has come up with their own solution. Extra credit, is there a way to dynamically change the audio playback speed without restarting from the beginning of the file?


Thanks,

Ben
it would also be helpful to know what kind and quality of speed change you want.

also basic resampling will of course change the pitch and other qualities of the sound, is this what you are after, or?


---In psychtoolbox@yahoogroups.com, <mario.kleiner@...> wrote :

Just my thoughts:

You can increase the sampling frequency, maybe. Although most sound cards only support 44.1 kHz, 48 kHz and multiple of them in hardware, so other frequencies will either not work at all, depending on OS and soundcard or introduce some resampling which might interfere with timing / timing precision and other low level properties of the sound.

You could resample with some Matlab/Octave signal processing toolbox function. Some of our demos do this to equalize different demo sound files to the proper target frequency, e.g., BasicSoundScheduleDemo with the 'resample' function.

Dynamic change of frequency would require some cleverness on your side. E.g., using the streaming sound playback functionality to compute and feed chunks of sound to the driver while playing. Or preparing multiple sound buffers with the same sound at different playback speeds and use the audio mixing or sound schedule functionality to switch/fade between sounds softly.

-mario