Re: Conversion of '*.bin' to '*.wav' extension (Sam Jelfs )


Subject: Re: Conversion of '*.bin' to '*.wav' extension
From:    Sam Jelfs  <JelfsS1@xxxxxxxx>
Date:    Tue, 10 Aug 2010 10:46:07 +0100
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

This is a multipart message in MIME format. ------=_NextPart_000_0010_01CB3879.40420D60 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Vinay, If you have access to MatLab this is fairly simple. You can read the file in using fread with the 'int16' option, and then write them out as a .wav file using wavwrite. (That assumes signed 16bit ints, for unsigned use 'uint16') To convert every .bin file in the current working directory to a .wav file, something like the below should work (excuse the messy code, it's not elegant, but will hopefully be effective). input_list = dir('*.bin'); for i = 1:length(input_list) fid = fopen(input_list(i).name); data = fread(fid,inf,'int16'); fclose(fid); wavwrite(data,44100,[input_list(i).name(1:length(input_list(i).name)-3),'wav ']; clear data end Sam Jelfs From: AUDITORY - Research in Auditory Perception [mailto:AUDITORY@xxxxxxxx On Behalf Of Vinay Sent: 10 August 2010 09:50 To: AUDITORY@xxxxxxxx Subject: [AUDITORY] Conversion of '*.bin' to '*.wav' extension Dear list, I have sound files in the '*.bin' extension format and I need to convert it to '*.wav' format. The files are ordinary binary files with 16 bit integer values and no file header. Any suggestions please? Regards, Vinay -- Vinay, PhD, Research Scientist Acoustics Research Center, Department of Electronics and Telecommunications, Norwegian University of Science and Technology (NTNU), O.S.Bragstads plass 2B NO-7491 Trondheim, Norway Tel: +47-45063397 Email: vinay.nagaraj@xxxxxxxx No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.851 / Virus Database: 271.1.1/3061 - Release Date: 08/09/10 19:35:00 ------=_NextPart_000_0010_01CB3879.40420D60 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" = xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)"> <style> <!-- /* Font Definitions */ @xxxxxxxx {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @xxxxxxxx {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @xxxxxxxx {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman","serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p {mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; font-size:12.0pt; font-family:"Times New Roman","serif";} span.EmailStyle18 {mso-style-type:personal-reply; font-family:"Calibri","sans-serif"; color:#1F497D;} .MsoChpDefault {mso-style-type:export-only;} @xxxxxxxx Section1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3DEN-GB link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>Vinay,<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'><o:p>&nbsp;</o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>If you have access to MatLab this is fairly simple. You = can read the file in using fread with the 'int16' option, and then write them out = as a .wav file using wavwrite. (That assumes signed 16bit ints, for unsigned = use 'uint16')<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'><o:p>&nbsp;</o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>To convert every .bin file in the current working = directory to a .wav file, something like the below <i>should</i> work (excuse the messy = code, it's not elegant, but will hopefully be = effective).<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'><o:p>&nbsp;</o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>input_list =3D dir('*.bin');<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>for i =3D 1:length(input_list)<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs= p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fid =3D fopen(input_list(i).name); <o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs= p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data =3D fread(fid,inf,'int16'); <o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs= p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fclose(fid); <o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs= p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = wavwrite(data,44100,[input_list(i).name(1:length(input_list(i).name)-3),'= wav']; <o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs= p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear data<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>end<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'><o:p>&nbsp;</o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'>Sam Jelfs<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"; color:#1F497D'><o:p>&nbsp;</o:p></span></p> <div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt = 0cm 0cm 0cm'> <p class=3DMsoNormal><b><span lang=3DEN-US = style=3D'font-size:10.0pt;font-family: "Tahoma","sans-serif"'>From:</span></b><span lang=3DEN-US = style=3D'font-size:10.0pt; font-family:"Tahoma","sans-serif"'> AUDITORY - Research in Auditory = Perception [mailto:AUDITORY@xxxxxxxx <b>On Behalf Of </b>Vinay<br> <b>Sent:</b> 10 August 2010 09:50<br> <b>To:</b> AUDITORY@xxxxxxxx<br> <b>Subject:</b> [AUDITORY] Conversion of '*.bin' to '*.wav' = extension<o:p></o:p></span></p> </div> <p class=3DMsoNormal><o:p>&nbsp;</o:p></p> <p class=3DMsoNormal><br> Dear list,<br> <br> I have sound files in the '*.bin' extension format and I need to convert = it to&nbsp; '*.wav' format. The files are ordinary binary files with 16 bit integer values and no file header.<br> <br> Any suggestions please?<br> <br> <br> <br> Regards,<br> Vinay<br> <br clear=3Dall> <br> -- <br> Vinay, PhD, Research Scientist<br> Acoustics Research Center,<br> Department of Electronics and Telecommunications,<br> Norwegian University of Science and Technology (NTNU),<br> O.S.Bragstads plass 2B<br> NO-7491 Trondheim, Norway<br> Tel: +47-45063397<br> Email: <a = href=3D"mailto:vinay.nagaraj@xxxxxxxx">vinay.nagaraj@xxxxxxxx</a><o= :p></o:p></p> <p><span style=3D'font-size:10.0pt;font-family:"Arial","sans-serif"'>No = virus found in this incoming message.<br> Checked by AVG - www.avg.com<br> Version: 9.0.851 / Virus Database: 271.1.1/3061 - Release Date: 08/09/10 19:35:00</span><o:p></o:p></p> </div> </body> </html> ------=_NextPart_000_0010_01CB3879.40420D60--


This message came from the mail archive
/home/empire6/dpwe/public_html/postings/2010/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University