Re: Trasients when playing silence with Matlab (David Isherwood )


Subject: Re: Trasients when playing silence with Matlab
From:    David Isherwood  <David.Isherwood@xxxxxxxx>
Date:    Fri, 8 Feb 2008 11:50:27 +0200
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

This is a multi-part message in MIME format. ------_=_NextPart_001_01C86A38.090344DF Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 Some things to check might be... (appologies if these are too obvious) =20 - Make sure all your sound files have the exact same specifications = (sampling freq., bit depth, coding, etc.) - If you are creating the "silence" file in Matlab also check whether = the samples are signed or unsigned integer and that the zeroes you are = writing for the file are not just giving a 0dBFS DC component, which = would result in a large pop at the start - Try adding dither to the "silence" sample (some DACs switch state, = with an associated glitch, after recieving a continuous sequence of = samples having all zeros) - If you aren't already using ASIO drivers try replaying the "silence" = sample in a dedicated audio replay software that has ASIO driver support = to see if the problem still exists - If you have samples preceding the "silence" sample try fading them = over the last ~500 samples so there isn't a large sample transition to = "silence". =20 Dave ________________________________ From: AUDITORY - Research in Auditory Perception = [mailto:AUDITORY@xxxxxxxx On Behalf Of ext Sylvain Choisel Sent: 08 February, 2008 09:55 To: AUDITORY@xxxxxxxx Subject: Re: Trasients when playing silence with Matlab =09 =09 Enrique,=20 =09 If you want to exclude the possibility that these clicks come from = Windows (if that is the OS=20 you are using), I suggest you try the user-contributed function = "pa_wavplay" that makes=20 use of the ASIO drivers. It has the advantage of bypassing the Windows = sound mixer.=20 You can find this function here:=20 = http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3D= 4017&objectType=3Dfile=20 =09 Another source of clicks is a change of sampling frequency, that will = cause the soundcard=20 to loose the clock for a short while. Check the clock settings in the = sound card's control panel,=20 you can monitor the current sampling frequency, and see if it changes = at the same time as=20 you hear the click.=20 =09 Best regards,=20 =09 Sylvain=20 =09 =09 AUDITORY - Research in Auditory Perception <AUDITORY@xxxxxxxx> = wrote on 07/02/2008 17:25:40: =09 > Dear Enrique, >=20 > the issue your are experiencing may come from many things. I would=20 > suggest you to try with a different soundcard first to discard the=20 > soundcard issue. >=20 > Then, Matlab does not handle sound cards directly, but rather uses = some=20 > OS calls. So your issue may also come from your operating system = (Linux,=20 > Mac OS X, ...). If you replicate the same behavior with a different=20 > soundcard, I would suggest to contact Matlab support directly with a = > complete description of your issue with code, they usually answer in = a=20 > day or two. >=20 > That said, I know that the command "sound" is very brittle on many = OSes.=20 > You can try the "audioplayer" that uses JAVA calls and may behave = better=20 > for your purpose (type "doc audioplayer" in your Matlab command = prompt=20 > for usage). >=20 > Cheers, >=20 > Mathieu Lagrange > Lopez-Poveda, Enrique A. a =E9crit : > > Dear friends, > > > > Here is a technical question on a problem that is driving us crazy. > > > > We want to play sounds from Matlab through an RME Fireface 400 = sound=20 > > card. The problem is that when we play a "silence" interval (array = of=20 > > zeros) we can hear (and even record) a clear transient at the onset = of=20 > > the _silence_ signal. We would very much like to get rid of that = onset=20 > > transient. Any cues as to how to get rid of it? > > > > Thank you so much in advance. > > > > - Enrique > > > > Enrique A. Lopez-Poveda, Ph.D. > > Instituto de Neurociencias de Castilla y Le=F3n > > Universidad de Salamanca > > Av. Alfonso X El Sabio S/N, 37007 Salamanca, Spain. > > Phone: (+34) 923 294 500 ext. 1957 > > Fax: (+34) 923 294 750 > > E-mail: ealopezpoveda@xxxxxxxx > > http://web.usal.es/~ealopezpoveda/=20 >=20 =09 ------_=_NextPart_001_01C86A38.090344DF Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR></HEAD> <BODY> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008>Hi,</SPAN></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008></SPAN></FONT>&nbsp;</DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008>Some things to check might be... (appologies = if these=20 are too obvious)</SPAN></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008></SPAN></FONT>&nbsp;</DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008>- Make sure all your sound files have the = exact same=20 specifications (sampling freq., bit depth, coding, = etc.)</SPAN></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008>- If you are creating the "silence" file in = Matlab also=20 check whether the samples are signed or unsigned integer&nbsp;and that = the=20 zeroes you are writing for the file are not just giving a 0dBFS DC = component,=20 which would result in a large pop at the start</SPAN></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff = size=3D2><SPAN=20 class=3D061332408-08022008>- Try adding dither to the "silence" sample = (some DACs=20 switch state, with an associated glitch,&nbsp;after recieving = a&nbsp;continuous=20 sequence of samples having all zeros)</SPAN></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT><SPAN = class=3D061332408-08022008></SPAN></FONT><SPAN=20 class=3D061332408-08022008></SPAN><FONT face=3DArial><FONT = color=3D#0000ff><FONT=20 size=3D2>-<SPAN class=3D061332408-08022008> If you aren't already using = ASIO drivers=20 try replaying the "silence" sample in a dedicated audio replay software = that has=20 ASIO driver support to see if the problem still=20 exists</SPAN></FONT></FONT></FONT></DIV> <DIV dir=3Dltr align=3Dleft><FONT><FONT color=3D#0000ff><FONT = size=3D2><SPAN=20 class=3D061332408-08022008></SPAN></FONT></FONT></FONT><SPAN=20 class=3D061332408-08022008></SPAN><FONT face=3DArial><FONT = color=3D#0000ff><FONT=20 size=3D2>-<SPAN class=3D061332408-08022008> If you have samples = preceding the=20 "silence" sample try fading them over the last&nbsp;~500 samples so = there isn't=20 a large sample transition to = "silence".</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20 class=3D061332408-08022008></SPAN></FONT></FONT></FONT>&nbsp;</DIV> <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20 class=3D061332408-08022008>Dave</SPAN></FONT></FONT></FONT></DIV> <DIV dir=3Dltr align=3Dleft><BR></DIV> <BLOCKQUOTE=20 style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px = solid; MARGIN-RIGHT: 0px"> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B> AUDITORY - Research in = Auditory=20 Perception [mailto:AUDITORY@xxxxxxxx <B>On Behalf Of </B>ext = Sylvain=20 Choisel<BR><B>Sent:</B> 08 February, 2008 09:55<BR><B>To:</B>=20 AUDITORY@xxxxxxxx<BR><B>Subject:</B> Re: Trasients when playing = silence=20 with Matlab<BR></FONT><BR></DIV> <DIV></DIV><BR><FONT face=3Dsans-serif size=3D2>Enrique,</FONT> = <BR><BR><FONT=20 face=3Dsans-serif size=3D2>If you want to exclude the possibility that = these=20 clicks come from Windows (if that is the OS</FONT> <BR><FONT = face=3Dsans-serif=20 size=3D2>you are using), I suggest you try the user-contributed = function=20 "pa_wavplay" that makes </FONT><BR><FONT face=3Dsans-serif = size=3D2>use of the=20 ASIO drivers. &nbsp;It has the advantage of bypassing the Windows = sound mixer.=20 </FONT><BR><FONT face=3Dsans-serif size=3D2>You can find this function = here:</FONT> <BR><FONT face=3Dsans-serif=20 = size=3D2>http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?= objectId=3D4017&amp;objectType=3Dfile</FONT>=20 <BR><BR><FONT face=3Dsans-serif size=3D2>Another source of clicks is a = change of=20 sampling frequency, that will cause the soundcard </FONT><BR><FONT=20 face=3Dsans-serif size=3D2>to loose the clock for a short while. Check = the clock=20 settings in the sound card's control panel,</FONT> <BR><FONT = face=3Dsans-serif=20 size=3D2>you can monitor the current sampling frequency, and see if it = changes=20 at the same time as</FONT> <BR><FONT face=3Dsans-serif size=3D2>you = hear the=20 click. </FONT><BR><BR><FONT face=3Dsans-serif size=3D2>Best = regards,</FONT>=20 <BR><BR><FONT face=3Dsans-serif size=3D2>Sylvain</FONT> = <BR><BR><BR><FONT=20 size=3D2><TT>AUDITORY - Research in Auditory Perception=20 &lt;AUDITORY@xxxxxxxx&gt; wrote on 07/02/2008 = 17:25:40:<BR><BR>&gt;=20 Dear Enrique,<BR>&gt; <BR>&gt; the issue your are experiencing may = come from=20 many things. I would <BR>&gt; suggest you to try with a different = soundcard=20 first to discard the <BR>&gt; soundcard issue.<BR>&gt; <BR>&gt; Then, = Matlab=20 does not handle sound cards directly, but rather uses some <BR>&gt; OS = calls.=20 So your issue may also come from your operating system (Linux, = <BR>&gt; Mac OS=20 X, ...). If you replicate the same behavior with a different <BR>&gt;=20 soundcard, &nbsp;I would suggest to contact Matlab support directly = with a=20 <BR>&gt; complete description of your issue with code, they usually = answer in=20 a <BR>&gt; day or two.<BR>&gt; <BR>&gt; That said, I know that the = command=20 "sound" is very brittle on many OSes. <BR>&gt; You can try the = "audioplayer"=20 that uses JAVA calls and may behave better <BR>&gt; for your purpose = (type=20 "doc audioplayer" in your Matlab command prompt <BR>&gt; for = usage).<BR>&gt;=20 <BR>&gt; Cheers,<BR>&gt; <BR>&gt; Mathieu Lagrange<BR>&gt; = Lopez-Poveda,=20 Enrique A. a =E9crit :<BR>&gt; &gt; Dear friends,<BR>&gt; &gt;<BR>&gt; = &gt; Here=20 is a technical question on a problem that is driving us crazy.<BR>&gt; = &gt;<BR>&gt; &gt; We want to play sounds from Matlab through an RME = Fireface=20 400 sound <BR>&gt; &gt; card. The problem is that when we play a = "silence"=20 interval (array of <BR>&gt; &gt; zeros) we can hear (and even record) = a clear=20 transient at the onset of <BR>&gt; &gt; the _silence_ signal. We would = very=20 much like to get rid of that onset <BR>&gt; &gt; transient. Any cues = as to how=20 to get rid of it?<BR>&gt; &gt;<BR>&gt; &gt; Thank you so much in=20 advance.<BR>&gt; &gt;<BR>&gt; &gt; - Enrique<BR>&gt; &gt;<BR>&gt; &gt; = Enrique=20 A. Lopez-Poveda, Ph.D.<BR>&gt; &gt; Instituto de Neurociencias de = Castilla y=20 Le=F3n<BR>&gt; &gt; Universidad de Salamanca<BR>&gt; &gt; Av. Alfonso = X El Sabio=20 S/N, 37007 Salamanca, Spain.<BR>&gt; &gt; Phone: (+34) 923 294 500 = ext.=20 1957<BR>&gt; &gt; Fax: (+34) 923 294 750<BR>&gt; &gt; E-mail:=20 ealopezpoveda@xxxxxxxx<BR>&gt; &gt; http://web.usal.es/~ealopezpoveda/ = <BR>&gt;=20 <BR></BLOCKQUOTE></TT></FONT></BODY></HTML> ------_=_NextPart_001_01C86A38.090344DF--


This message came from the mail archive
http://www.auditory.org/postings/2008/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University