Index: Makefile.inc
===================================================================
--- Makefile.inc	(revision 2380)
+++ Makefile.inc	(revision 2386)
@@ -7,5 +7,6 @@
 # libroardsp:
 DSP_CODECLIBS   = $(lib_celt) $(lib_speex)
-LIBROARDSP_NS   = $(DSP_CODECLIBS) $(LIBROAR) $(lib_m)
+DSP_AUXLIBS     = $(lib_samplerate)
+LIBROARDSP_NS   = $(DSP_CODECLIBS) $(DSP_AUXLIBS) $(LIBROAR) $(lib_m)
 LIBROARDSP      = -lroardsp $(LIBROARDSP_NS)
 
Index: include/libroardsp/convert.h
===================================================================
--- include/libroardsp/convert.h	(revision 2093)
+++ include/libroardsp/convert.h	(revision 2386)
@@ -72,4 +72,5 @@
 int roar_conv_rate_162zoh(void * out, void * in, int samples, int from, int to);
 int roar_conv_rate_16nzoh(void * out, void * in, int samples, int from, int to, int channels);
+int roar_conv_rate_SRC   (void * out, void * in, int samples, int from, int to, int bits, int channels);
 
 int roar_conv_codec (void * out, void * in, int samples, int from, int to, int bits);
Index: include/libroardsp/libroardsp.h
===================================================================
--- include/libroardsp/libroardsp.h	(revision 2316)
+++ include/libroardsp/libroardsp.h	(revision 2386)
@@ -44,4 +44,8 @@
 #ifdef ROAR_HAVE_LIBSPEEX
 #include "transcode_speex.h"
+#endif
+
+#ifdef ROAR_HAVE_LIBSAMPLERATE
+#include <samplerate.h>
 #endif
 
Index: libroardsp/convert.c
===================================================================
--- libroardsp/convert.c	(revision 2103)
+++ libroardsp/convert.c	(revision 2386)
@@ -313,4 +313,7 @@
 
 int roar_conv_rate (void * out, void * in, int samples, int from, int to, int bits, int channels) {
+#ifdef ROAR_HAVE_LIBSAMPLERATE
+ return roar_conv_rate_SRC(out, in, samples, from, to, bits, channels);
+#else
  if ( bits == 8  )
   return roar_conv_rate_8(out, in, samples, from, to, channels);
@@ -320,4 +323,5 @@
 
  return -1;
+#endif
 }
 
@@ -371,5 +375,5 @@
  ROAR_DBG("roar_conv_rate_162zoh(*): samples=%i", samples);
  samples /= 2;
- samples -= 1;
+// samples -= 1;
  ROAR_DBG("roar_conv_rate_162zoh(*): samples=%i", samples);
 
@@ -382,4 +386,85 @@
 
  return 0;
+}
+
+int roar_conv_rate_SRC   (void * out, void * in, int samples, int from, int to, int bits, int channels) {
+#ifdef ROAR_HAVE_LIBSAMPLERATE
+ double radio = (double) to / (double) from;
+ int outsamples = radio * samples;
+ float * inf  = malloc(samples*sizeof(float));
+ float * outf = malloc(outsamples*sizeof(float));
+ int i;
+ SRC_DATA srcdata;
+
+ ROAR_DBG("roar_conv_rate_SRC(*): radio=%lf, samples=%i, outsamples=%i", radio, samples, outsamples);
+
+ if ( inf == NULL ) {
+  if ( outf != NULL )
+   free(outf);
+
+  return -1;
+ }
+
+ if ( outf == NULL ) {
+  if ( inf != NULL )
+   free(inf);
+
+  return -1;
+ }
+
+ switch (bits) {
+  case  8:
+    for (i = 0; i < samples; i++)
+     inf[i] = *(((int8_t *)in)+i) / 128.0;
+   break;
+  case 16:
+    for (i = 0; i < samples; i++)
+     inf[i] = *(((int16_t*)in)+i) / 32768.0;
+   break;
+  case 32:
+    for (i = 0; i < samples; i++)
+     inf[i] = *(((int32_t*)in)+i) / 2147483648.0;
+   break;
+  default:
+    free(outf);
+    free(inf);
+    return -1;
+ }
+
+ srcdata.data_in       = inf;
+ srcdata.data_out      = outf;
+ srcdata.input_frames  = samples/channels;
+ srcdata.output_frames = outsamples/channels;
+ srcdata.src_ratio     = radio;
+
+ if ( src_simple(&srcdata, SRC_SINC_FASTEST, channels) != 0 ) {
+  free(outf);
+  free(inf);
+  return -1;
+ }
+
+ switch (bits) {
+  case  8:
+    for (i = 0; i < samples; i++)
+     *(((int8_t *)out)+i) = outf[i] * 128.0;
+   break;
+  case 16:
+    for (i = 0; i < samples; i++)
+     *(((int16_t*)out)+i) = outf[i] * 32768.0;
+   break;
+  case 32:
+    for (i = 0; i < samples; i++)
+     *(((int32_t*)out)+i) = outf[i] * 2147483648.0;
+   break;
+   // no errors here, they are handled above
+ }
+
+ free(outf);
+ free(inf);
+
+ return 0;
+#else
+ return -1;
+#endif
 }
 
@@ -743,4 +828,12 @@
 
  memcpy(&cinfo, from, sizeof(cinfo));
+
+/*
+ if ( in != out ) {
+  memset(out, 0xA0, bufsize);
+ } else {
+  ROAR_WARN("roar_conv2(*): in==out!");
+ }
+*/
 
  // calcumate number of input samples:
