diff --git a/addons/audio/alsa.c b/addons/audio/alsa.c
index 98e8a53..0bb341a 100644
--- a/addons/audio/alsa.c
+++ b/addons/audio/alsa.c
@@ -66,6 +66,19 @@ static unsigned int get_buffer_size(const ALLEGRO_CONFIG *config)
    return DEFAULT_BUFFER_SIZE;
 }
 
+static snd_pcm_uframes_t get_buffer_frames(void)
+{
+  const char *val = al_get_config_value(al_get_system_config(),
+	 "alsa", "buffer_frames");
+  if (val && val[0] != '\0') {
+	 int n = atoi(val);
+	 if (n < 1)
+		n = 1;
+	 return n;
+  }
+  return 2048;
+}
+
 typedef struct ALSA_VOICE {
    unsigned int frame_size; /* in bytes */
    unsigned int len; /* in frames */
@@ -631,6 +644,8 @@ static int alsa_allocate_voice(ALLEGRO_VOICE *voice)
    ALSA_CHECK(snd_pcm_hw_params_set_channels(ex_data->pcm_handle, hwparams, chan_count));
    ALSA_CHECK(snd_pcm_hw_params_set_rate_near(ex_data->pcm_handle, hwparams, &req_freq, NULL));
    ALSA_CHECK(snd_pcm_hw_params_set_period_size_near(ex_data->pcm_handle, hwparams, &ex_data->frag_len, NULL));
+   snd_pcm_uframes_t buffer_frames = get_buffer_frames();
+   ALSA_CHECK(snd_pcm_hw_params_set_buffer_size_near(ex_data->pcm_handle, hwparams, &buffer_frames));
    ALSA_CHECK(snd_pcm_hw_params(ex_data->pcm_handle, hwparams));
 
    if (voice->frequency != req_freq) {
