[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Glitch-free presentations with Windows 7 and Matlab
Unless someone has found the solution (I can't recall), there's another
issue with Windows 7 which is that the mixer interface is unbelievably
complicated and it is a nightmare to set the sound level. If I'm correct
that nobody has provided a solution to this problem as yet, this is
another good reason to stick to good old XP.
Note that the issue also sometime arise with ASIO drivers in WinXP as
well because the ASIO volume isn't always linked to the Windows' mixer
Otherwise, another alternatives is to play sounds through TDT Systems.
But again we are far from the simple "sound" function in Matlab
(although I don't see why anyone would like to use this when the
audioplayer object offers so much more flexibility).
PS: Trevor, I guess you've seen this:
http://www.playrec.co.uk/forum/viewtopic.php?id=209 and other entries in
this forum: http://www.playrec.co.uk/forum/viewforum.php?id=4.
On 18/10/2011 16:52, Trevor Agus wrote:
I've found it surprisingly difficult to present glitch-free sounds with
The short answer is that Padraig Kitterick's "asioWavPlay" seems to be the
simplest reliable method (remembering to buffer the waveforms with 256 samples
of silence to avoid truncation issues). For those with more complex needs,
perhaps soundmexpro or PsychToolbox would be better. I'd value any second
opinions and double-checking, so a review of the options follows, with all the
I've been using a relatively old version of Matlab (R2007b) with a Fireface UC
soundcard. If the problems are fixed in another version or soundcard, I'd love
to know about it.
===Matlab's native functions (sound, wavplay, audioplayer)
Large, unpredictable truncations were the least of our problems. We also often
got mid-sound glitches, ranging from sporadic (just a few subtle glitches per
minute) to frequent (making the sound barely recognisable). The magic formula
for eliminating the glitches seemed to be to keep the soundcard turned off
the desktop was ready, with all background programs loaded. (Restarting either
the soundcard or the computer alone guaranteed some glitches.) So this formula
seems to work, but it's a bit too Harry Potter for my liking, and the spell
might change with the next Windows update. I think I read that Fireface were
no longer supporting Microsoft's vagaries, and they recommended using ASIO. I'm
not sure if other high-end soundcard manufacturers are any different. Since
Matlab's native functions don't support ASIO (unless the new versions do?),
I think we're forced to look at the ASIO options.
This seems to be potentially the most flexible method of presenting sounds but
I've hit a brick wall compiling it for Windows 7. I think its author stopped
providing support for it a few years ago. Has anyone had more success than me?
This simply presents a .wav file using ASIO. It's a little annoying that you
have to save your sound to disk before presenting it, but as Joachim pointed
out, it's not too difficult to automate this process. While doing that, I add
256 samples of silence to the end to work around the truncation problem.
This is nearly the perfect solution except (1) the number of samples truncated
from the end is slightly unpredictable and (2) it prints a message on the
screen after every sound ("Playing on device 0"). For these two reasons, I
This might be best choice for the high-end user (I've just had a quick look at
the demo version today). It's easy to install and there are good tutorials, but
it involves initialising sound objects, etc. -- it's not just a replacement for
Matlab's "sound" command. Also it looks like it's €500+.
Originally designed for visual experiments, PsychToolbox has now got quite
extensive low-latency sound functions, including realtime continuous
playing/recording. It's also free. However, it's slightly challenging to
install Like soundmexpro, it's object-oriented -- so don't expect to play a
sound with a simple one-liner.
Most of above programs are based on this C library. If you're an experienced
programmer, perhaps you'd prefer to go direct the source? And while you're
there, perhaps you could write the perfect Matlab-ASIO interfaces for the rest
of us? (Please!)
Has anyone found a simpler solution? I'd be glad to hear it.
Etienne Gaudrain, PhD
MRC Cognition and Brain Sciences Unit
15 Chaucer Road
Cambridge, CB2 7EF
Phone: +44 1223 355 294, ext. 645
Fax (unit): +44 1223 359 062