On Monday, May 25, 2009, [email protected] wrote:
> Quoting Pedro Lopez-Cabanillas <[email protected]>:
> > On Saturday, May 23, 2009, Louis B. wrote:
> >> Thanks for the info. I have just update the wiki with information on
> >> how to run fluid on a netbook. see
> >> http://fluidsynth.resonance.org/trac/wiki/LowLatency. Please correct
> >> it if it is wrong or you want to add anything else.
> >
> > "Also halving the sample rate with the flag '-r22050' helps a lot."
> >
> > I doubt the above advice would be beneficial for latency. On the
> > contrary, running FluidSynth with a native sound card sample rate will
> > give the better results, because reducing the sample rate requires ALSA
> > to perform software interpolation (by the plughw: layer) to transform the
> > buffers into the native frequency before sending it to the hardware. This
> > requires larger buffers and consumes CPU cycles. On the other hand, using
> > the native frequency allows you to use the hw: interface directly.
> >
> > By the way, which netbook are we talking about? Which Linux distro?
> >
> > Regards,
> > Pedro
>
> If the system is running out of CPU and the sound card actually works
> with 22050 natively, then it could help reduce CPU usage, thus
> preventing CPU starvation. Another idea is to decrease
> synth.polyphony in that case though.
Louis said that he is using an eeepc 901. According to my sources this device
has an integrated Intel HDA sound card:
http://array.org/ubuntu/status.html?model=eeepc-901
The HDA cards allow only a very restricted set of native sample rates,
typically only above 44.1 KHz, so I found very improbable that sr=22050 is
natively supported. This can be verified compiling and running the attached
program. Here are some results obtained on my Asus laptop:
$ ./alsa-rate
supported sample rates for hw:0,0 : min=44100, max=192000
$ ./alsa-rate dmix
supported sample rates for dmix : min=48000, max=48000
$ ./alsa-rate plughw
supported sample rates for plughw : min=4000, max=4294967295
$ ./alsa-rate default
supported sample rates for default : min=4000, max=4294967295
Note that "dmix", "plughw" and "default" are not native, they are software
conversion layers.
Regards,
Pedro
/* gcc -W -Wall -o alsa-rate alsa-rate.c -lasound */
#include <stdio.h>
#include <alsa/asoundlib.h>
int main(int argc, char *argv[])
{
char *device;
snd_pcm_t *handle;
snd_pcm_hw_params_t *params;
unsigned int min;
unsigned int max;
int dir;
int err;
device = argc > 1 ? argv[1] : "hw:0,0";
err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0);
if (err < 0) {
fprintf(stderr, "snd_pcm_open: %s\n", snd_strerror(err));
return err;
}
err = snd_pcm_hw_params_malloc(¶ms);
if (err < 0) {
fprintf(stderr, "snd_pcm_hw_params_alloc: %s\n",
snd_strerror(err));
return err;
}
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
fprintf(stderr, "snd_pcm_hw_params_any: %s\n",
snd_strerror(err));
return err;
}
err = snd_pcm_close(handle);
if (err < 0) {
fprintf(stderr, "snd_pcm_close: %s\n", snd_strerror(err));
return err;
}
err = snd_pcm_hw_params_get_rate_min(params, &min, &dir);
if (err < 0) {
fprintf(stderr, "snd_pcm_hw_params_get_rate_min: %s\n",
snd_strerror(err));
return err;
}
err = snd_pcm_hw_params_get_rate_max(params, &max, &dir);
if (err < 0) {
fprintf(stderr, "snd_pcm_hw_params_get_rate_max: %s\n",
snd_strerror(err));
return err;
}
snd_pcm_hw_params_free(params);
printf("supported sample rates for %s : min=%u, max=%u\n", device, min, max);
return 0;
}
_______________________________________________
fluid-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fluid-dev