[SDL] SDL_Mixer and speed/pitch shift
haleyjd at hotmail.com
Sun Aug 5 22:27:19 PDT 2007
You're correct that SDL_mixer itself doesn't have support for pitch-shifting
sounds. However, since it does give you direct access to the sound stream
buffer via the mixing callback functions (such as the post-mix callback),
you can implement it yourself.
My Eternity Engine Doom port has a rudimentary pitch shifting ability.
Looking at it might give you an idea on what would be involved.
Link to the file:
EE just does all its own digital sound mixing and then pipes it through
SDL_mixer, which we use mainly for playing music. I should probably note
that our sound engine crashes on some x86 Mac machines due apparently to
some mysterious bug in SDL_mixer or its interaction with some particular
sound driver (it sends us a bad buffer seemingly at random). As of the
latest release, this is still a problem for one of my users, so watch out
for that when accessing the stream buffer directly.
>From: Sylvain Beucler <beuc at beuc.net>
>Reply-To: "A list for developers using the SDL library. (includes
>SDL-announce)" <sdl at lists.libsdl.org>
>To: sdl at lists.libsdl.org
>Subject: Re: [SDL] SDL_Mixer and speed/pitch shift
>Date: Mon, 6 Aug 2007 00:21:36 +0200
>Received: from diego.dreamhost.com ([188.8.131.52]) by
>bay0-mc11-f9.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sun, 5
>Aug 2007 15:21:45 -0700
>Received: from diego.dreamhost.com (localhost [127.0.0.1])by
>diego.dreamhost.com (Postfix) with ESMTP id 4B7FF4800A;Sun, 5 Aug 2007
>15:21:41 -0700 (PDT)
>Received: from smtp3-g19.free.fr (smtp3-g19.free.fr [184.108.40.206])by
>diego.dreamhost.com (Postfix) with ESMTP id 9EA8448006for
><sdl at lists.libsdl.org>; Sun, 5 Aug 2007 15:21:38 -0700 (PDT)
>Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1])by
>smtp3-g19.free.fr (Postfix) with ESMTP id 11A0638F1for
><sdl at lists.libsdl.org>; Mon, 6 Aug 2007 00:21:37 +0200 (CEST)
>Received: from localhost.localdomain (unknown [220.127.116.11])by
>smtp3-g19.free.fr (Postfix) with ESMTP id EC72238DFfor
><sdl at lists.libsdl.org>; Mon, 6 Aug 2007 00:21:36 +0200 (CEST)
>Received: from me by localhost.localdomain with local (Exim
>4.63)(envelope-from <beuc at beuc.net>) id 1IHoTg-0006Zz-BDfor
>sdl at lists.libsdl.org; Mon, 06 Aug 2007 00:21:36 +0200
>X-Original-To: sdl at lists.libsdl.org
>References: <20070801150315.GA7104 at perso.beuc.net>
>User-Agent: Mutt/1.5.13 (2006-08-11)
>X-BeenThere: sdl at lists.libsdl.org
>List-Id: "A list for developers using the SDL library.
><http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>,<mailto:sdl-request at lists.libsdl.org?subject=unsubscribe>
>List-Post: <mailto:sdl at lists.libsdl.org>
>List-Help: <mailto:sdl-request at lists.libsdl.org?subject=help>
><http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>,<mailto:sdl-request at lists.libsdl.org?subject=subscribe>
>Errors-To: sdl-bounces at lists.libsdl.org
>Return-Path: sdl-bounces at lists.libsdl.org
>X-OriginalArrivalTime: 05 Aug 2007 22:21:45.0469 (UTC)
>Nobody using pitch shift here? :/
>On Wed, Aug 01, 2007 at 05:03:15PM +0200, Sylvain Beucler wrote:
> > Hi,
> > I'd like to use SDL_Mixer to play multiple sounds at once, and with
> > different speeds for each sound.
> > This allow, for example, to play a normal voice and an acute voice
> > from the same sound file, by playing it with a greater frequency for
> > the acute voice.
> > This feature (which is often refered to as "pitch shift") seems to be
> > missing from SDL_Mixer.
> > (I don't think I can implement it with an SDL_Mixer Effect either,
> > because the callback can only modify a fixed-length sample.)
> > Is there a way to implement pitch shift with SDL_Mixer? Or an
> > alternate SDL library that would do that (but I also need midi/BGM
> > support in the mixer)?
> > For example, DirectX provides it through
> > DirectSoundBuffer::SetFrequency(frequency), and Allegro provides it
> > with play_sample(sample, t vol, pan, freq, loop).
> > Thanks!
>SDL mailing list
>SDL at lists.libsdl.org
More photos, more messages, more storageget 2GB with Windows Live Hotmail.
More information about the SDL