Does MATLAB support above 96000Hz sampling frequencies of winsound?

6 views (last 30 days)
Why MATLAB 2012a (7.14.0.739) does not support 192000Hz and maybe higher sampling frequency of the winsound while my PCs have this sampling frequency? Is there a solution for this? I make 2 analog output channels and then propinfo(ao,'SampleRate') only shows me [5000 96000] and I receive an error trying to set it to 192000. I have this problem with two laptops, one is running windows XP SP3 32bit and the windows 7 32bit, both with same version of MATLAB. I want to get a sound card with even higher sampling frequencies, so I also need to know if those frequencies (above 96000) are supported by MATLAB? Thanks
ao=analogoutput('winsound');
addchannel(ao,1:2);
propinfo(ao,'SampleRate')
setverify(ao,'SampleRate',96000);
setverify(ao,'RepeatOutput',0)
t=0:0.001:10;
f=500;
T=1/f;
x=sin(2*pi*f*(0:T/80:10000*T));
y=cos(2*pi*f*(0:T/80:10000*T));
putdata(ao,[x',y'])
start(ao)
propinfo(ao,'SampleRate') only shows frin [5000,96000] no sign of 192000! And I can not set 'SampleRate' to 192000 either. Why?
  3 Comments
Walter Roberson
Walter Roberson on 11 Mar 2014
There are different possible messages for attempting to set an unsupported value, and the details of the messages can give clues about the solution. Please post the exact error message.
Also, keep in mind that people will not generally have the exact same hardware as you have available to them to run your program to see exactly what it gives. Furthermore, some of the volunteers have some hardware experience but do not have access to the toolbox you are using, and so might be able to recognize the condition given the message while not being able to test the code themselves.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Mar 2014
No, 96 kHz is the maximum supported for winsound. See http://www.mathworks.com/help/daq/windows-sound-cards.html
What kind of sounds are you recording that you need 192 KHz ? Wouldn't a data acquisition device make more sense than a sound card for rates that high? That's well above whale frequencies, and in line with dolphin frequencies (up to about 150 kHz). Anything that high I would tend to class as "data" rather than "sound". What kind of mic are you using that has that kind of frequency response ?
  3 Comments
Walter Roberson
Walter Roberson on 11 Mar 2014
That would be 8 points per cycle, total 160 k samples per second? Each of 2 channels? How many bits per channel?
Is this a repetitive sequence that can be pre-calculated? Or is it doing interactive work (for example a Segway rebalancing itself)? If it is interactive then what are the characteristics of the input, and what latency of response do you need?
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 13 Mar 2014
It's not what you called interactive, it's precalculated I've been asked to generate the sequence for 81 array of probes, and I'm given a 33500B Agilent Arbitrary function generator with something about 20 or 200 MSamples/s, but the poblems is manually seting up the signals in function generaor, for 81 probs! So I suggested to do this with MATLAB which I already used to generate the 81 precalulated sequences. But I cant deliver a good precision using 4, 8 samples or anything near that. I tried it with 2Khz freqency signal, around 45 samles per cycle which was good enough in terms of accuracy, but at 2K, deflected beam is gonna melt the probe and it wasn't practical! I won't be helpful in tis instance but maybe in future. I have anoter question btw, I tried to record voice with 'winsound' but there is a glitch each time it triggers, do you have a better way that you can tell me about plz? All I could do at the end was to increase the samples per trigger so that it happens after fairly a long time! lol
ai=analoginput('winsound');
addchannel(ai,1)
propinfo(ai,'SampleRate')
setverify(ai,'TriggerType','immediate')
setverify(ai,'SampleRate',96000)
setverify(ai,'TriggerRepeat',0)
setverify(ai,'SamplesPerTrigger',1024000)
%setverify(ai,'BitsPerSample',32)
%daqhwinfo(ai);
data = zeros(1024000/1,10);
%start(ai)
for i= 1:5
start(ai)
%trigger(ai)
%wait(ai,10)
data(:,i)=getdata(ai);
end
stop(ai)
Thanks a lot ;)

Sign in to comment.

More Answers (1)

Jan
Jan on 9 Mar 2014
Did you search in the net or in this forum already? Does this help: http://www.mathworks.com/matlabcentral/answers/1352 ?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!