From: temp on
Thanks I chose to use the daq Aquisition toolbox here's some test code for the next person
who may need it

clear
tic
%%
ao=analogoutput('winsound');
ao.samplerate=44100;
y = sin(150*(0:(2*pi/44100):2*pi))'; % creates 150hz test signal
chan=addchannel(ao,1:2); %create 2 channels

ao.RepeatOutput = 3; % to output 3 times you need to repeat 3 USE RepeatOutput
putdata(ao,[y y]) % signal on both channel
start(ao)

% Don't forget to cleanup when done
clear ao
%delete(ao)
toc

From: Sherryl Radbil on
Hi,
The code you posted does not produce any clicks for the duration of the signal.
Sound will be generated for 4 seconds:
44101 samples at 44100 samples/second output once
then repeated 3 more times giving 4 seconds.

If you want to keep outputting the signal continuously beyond 4 seconds you would need to increase ao.RepeatOutput. You can set it to Inf and then use
stop(ao)
to stop the generation when you need.

Clicks are typically heard when you keep starting the output generation in a loop.
So if you let the generation stop after 4 seconds then call
start(ao)
again you will probably hear a click.

All the best,
Sherryl
 | 
Pages: 1
Prev: tick marks position
Next: jLabel (setVisible)