# PsychPortAudio - audible pops/clicks

**URL:** <https://psychtoolbox.discourse.group/t/psychportaudio-audible-pops-clicks/762>\
**Category:** Uncategorized\
**Created:** [June 19, 2008, 3:55pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-audible-pops-clicks/762 "2008-06-19T15:55:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.chevillet](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mark.chevillet](https://psychtoolbox.discourse.group/u/mark.chevillet)\
**Post date:** [June 19, 2008, 3:55pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-audible-pops-clicks/762/1 "2008-06-19T15:55:37Z")

</div>

Hi,   
  
I've just started using Psychtoolbox and PsychPortAudio. Using the  
provided demos, I've been able to piece together a basic  
same/different auditory paradigm which works nicely. However, at the  
end of each stimulus presented, there is a very audible "pop" as  
though the stimulus is being cut off. This pop is not in the audio  
file, since I have presented the same stimuli in Presentation with no  
artifact (amplitude is ramped at onset and offset).   
  
I've noticed a similar pop/click effect in the  
BasicMultiSoundOutputDemo program provided in the Files section of  
this Forum.   
  
Does anyone know what might cause this, and how to remove them?  
  
Thanks!  
  
For other info  
machine = intel mac pro workstation  
os = osx (tiger)  
sound = onboard   
  
and here's the code i'm running  
  
%AX\_experiment  
  
% Wait for release of all keys on keyboard:  
KbReleaseWait;  
  
% Running on PTB-3? Abort otherwise.  
AssertOpenGL;  
  
KbName('UnifyKeyNames');   
  
% Perform basic initialization of the sound driver:  
InitializePsychSound(1);  
  
% Open the default audio device [], with default mode [] (==Only  
playback),  
% and a required latencyclass of zero 0 == no low-latency mode, as well as  
% a frequency of freq and nrchannels sound channels.  
% This returns a handle to the audio device:  
freq = 16000;  
nrchannels = 1;  
pahandle1 = PsychPortAudio('Open', [], [], 3, freq, nrchannels);  
pahandle2 = PsychPortAudio('Open', [], [], 3, freq, nrchannels);  
  
filename1 = 'mline2\_38.wav';  
filename2 = 'mline2\_38.wav';  
  
%startSecs = GetSecs;  
%timeSecs = KbWait;  
%[keyIsDown, t, keyCode] = KbCheck;  
%fprintf('"%s" typed at time %.3f seconds\n', KbName(keyCode),  
timeSecs - startSecs);  
  
AX\_trial(pahandle1,filename1,pahandle2,filename2,0.55);  
  
PsychPortAudio('Close');  
  
function AX\_trial(pahandle1, wavfilename1, pahandle2, wavfilename2, ISI)  
  
% Read WAV file from filesystem:  
wavedata1 = wavread(wavfilename1)';  
wavedata2 = wavread(wavfilename2)';  
  
% Fill the audio playback buffer with the audio data 'wavedata':  
PsychPortAudio('FillBuffer', pahandle1, wavedata1,0);  
PsychPortAudio('FillBuffer', pahandle2, wavedata2,0);  
  
t1 = PsychPortAudio('Start', pahandle1, 1, 0, 1);  
PsychPortAudio('Stop',pahandle1,1);  
wait = t1+ISI;  
t3 = PsychPortAudio('Start', pahandle2, 1, wait, 1);  
PsychPortAudio('Stop',pahandle2,1);
