<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>Bauer stereophonic-to-binaural DSP</title> <meta content="Boris Mikhaylov" name="author"></head><body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" vlink="#990099" alink="#000099" link="#000099"> <table style="width: 800px; text-align: left; font-family: times new roman,times,serif;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><big><span style="font-weight: bold;">Bauer stereophonic-to-binaural DSP: library description.</span></big><br> <br> The <a href="http://bs2b.sourceforge.net/" target="_top">bs2b</a> library is simple to use. See tables 1 and 2 for example. It is a reductive code of 'bs2bstream.c'. The 'bs2b.h' and 'bs2bclass.h' files of the source code package can help also.<br> You can use a 'bs2bstream' with '<a href="http://lame.sourceforge.net/" target="_top">lame</a>' by a command line like this:<br> lame -t --decode test.wav - | bs2bstream | lame -r -x -m j -s 44.1 --bitwidth 16 --preset extreme - test.mp3<br> or without of '-x' swap bytes of input file, like this:<br> lame -t --decode test.wav - | bs2bstream | lame -r -m j -s 44.1 --bitwidth 16 --preset extreme - test.mp3<br><br> <span style="font-weight: bold;">Table 1. Example of using of bs2b library (C).</span><br> <table style="width: 100%; background-color: rgb(255, 255, 204); text-align: left; font-family: courier new,courier,monospace;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><font size="-1">#include <stdio.h><br> #include "bs2b.h"<br> <br> int main()<br> {<br> t_bs2bdp bs2bdp;<br> short sample[ 2 ];<br> <br> bs2bdp = bs2b_open();<br> <br> /* Default init value<br> bs2b_set_srate( bs2bdp, 44100 );<br> bs2b_set_level( bs2bdp, BS2B_DEFAULT_CLEVEL ); // 700 Hz, 4.5 dB<br> // or another way<br> bs2b_set_srate( bs2bdp, 44100 );<br> bs2b_set_level_fcut( bs2bdp, 700 ); // 700 Hz<br> bs2b_set_level_feed( bs2bdp, 45 ); // 4.5 dB<br> */<br> <br> /* raw LPCM, signed 16 bit, native to CPU byte order, stereo interleaved */<br> while( 2 == fread( sample, sizeof( short ), 2, stdin ) )<br> {<br> bs2b_cross_feed_s16( bs2bdp, sample );<br> fwrite( sample, sizeof( short ), 2, stdout );<br> }<br> <br> bs2b_close( bs2bdp );<br> bs2bdp = 0;<br> <br> return 0 ;<br> }</font><font size="-1"><br> </font> </td> </tr> </tbody> </table> <br>Sample rate default value is 44100 Hz. Crossfeed level default value is 700 Hz, 4.5 dB. If a sample rate of audio data is different or if you want to change crossfeed level then you must call 'bs2b_set_srate' and 'bs2b_set_level' functions (or 'bs2b_set_srate', 'bs2b_set_level_fcut', 'bs2b_set_level_feed') accordingly.<br> <br> <span style="font-weight: bold;">Table 2. Example of using of bs2b library (C++).</span><br> <table style="width: 100%; background-color: rgb(255, 255, 204); text-align: left; font-family: courier new,courier,monospace;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;"><font size="-1">#include <stdio.h><br> #include "bs2bclass.h"<br> <br> int main()<br> {<br> bs2b_base bs2b;<br> <br> // Default init value<br> //bs2b.set_srate( 44100 );<br> //bs2b.set_level( BS2B_DEFAULT_CLEVEL ); // 700 Hz, 4.5 dB<br> // or another way<br> //bs2b.set_srate( 44100 );<br> //bs2b.set_level_fcut( 700 ); // 700 Hz<br> //bs2b.set_level_feed( 45 ); // 4.5 dB<br> <br> // raw LPCM, signed 16 bit, native to CPU byte order, stereo interleaved<br> short sample[ 2 ];<br> while( 2 == fread( sample, sizeof( short ), 2, stdin ) )<br> {<br> bs2b.cross_feed( sample );<br> fwrite( sample, sizeof( short ), 2, stdout );<br> }<br> <br> return 0 ;<br> }</font><font size="-1"></font><br> </td> </tr> </tbody> </table> <br> <hr style="width: 100%; height: 2px;">Copyright (c) 2005-2010 Boris Mikhaylov < <a href="http://www.tmn.ru/%7Ebor" target="_top">http://www.tmn.ru/~bor</a>></td> </tr> </tbody> </table> </body></html>