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> </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> </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 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, after recieving = a 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 ~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> </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. 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&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 <AUDITORY@xxxxxxxx> wrote on 07/02/2008 = 17:25:40:<BR><BR>>=20 Dear Enrique,<BR>> <BR>> the issue your are experiencing may = come from=20 many things. I would <BR>> suggest you to try with a different = soundcard=20 first to discard the <BR>> soundcard issue.<BR>> <BR>> Then, = Matlab=20 does not handle sound cards directly, but rather uses some <BR>> OS = calls.=20 So your issue may also come from your operating system (Linux, = <BR>> Mac OS=20 X, ...). If you replicate the same behavior with a different <BR>>=20 soundcard, I would suggest to contact Matlab support directly = with a=20 <BR>> complete description of your issue with code, they usually = answer in=20 a <BR>> day or two.<BR>> <BR>> That said, I know that the = command=20 "sound" is very brittle on many OSes. <BR>> You can try the = "audioplayer"=20 that uses JAVA calls and may behave better <BR>> for your purpose = (type=20 "doc audioplayer" in your Matlab command prompt <BR>> for = usage).<BR>>=20 <BR>> Cheers,<BR>> <BR>> Mathieu Lagrange<BR>> = Lopez-Poveda,=20 Enrique A. a =E9crit :<BR>> > Dear friends,<BR>> ><BR>> = > Here=20 is a technical question on a problem that is driving us crazy.<BR>> = ><BR>> > We want to play sounds from Matlab through an RME = Fireface=20 400 sound <BR>> > card. The problem is that when we play a = "silence"=20 interval (array of <BR>> > zeros) we can hear (and even record) = a clear=20 transient at the onset of <BR>> > the _silence_ signal. We would = very=20 much like to get rid of that onset <BR>> > transient. Any cues = as to how=20 to get rid of it?<BR>> ><BR>> > Thank you so much in=20 advance.<BR>> ><BR>> > - Enrique<BR>> ><BR>> > = Enrique=20 A. Lopez-Poveda, Ph.D.<BR>> > Instituto de Neurociencias de = Castilla y=20 Le=F3n<BR>> > Universidad de Salamanca<BR>> > Av. Alfonso = X El Sabio=20 S/N, 37007 Salamanca, Spain.<BR>> > Phone: (+34) 923 294 500 = ext.=20 1957<BR>> > Fax: (+34) 923 294 750<BR>> > E-mail:=20 ealopezpoveda@xxxxxxxx<BR>> > http://web.usal.es/~ealopezpoveda/ = <BR>>=20 <BR></BLOCKQUOTE></TT></FONT></BODY></HTML> ------_=_NextPart_001_01C86A38.090344DF--