[Haskell-cafe] sdl-mixer loading issue

Luke Palmer lrpalmer at gmail.com
Wed Jun 25 01:16:16 EDT 2008


On Tue, Jun 24, 2008 at 6:34 PM, Norbert Wojtowicz
<wojtowicz.norbert at gmail.com> wrote:
>> Attached is a patched version of SDL_mixer 0.5.2 with a C wrapper
>> for this macro. I'm now able to run loadWAV in ghci.
>
> Works for me, thanks!
>
> Now I just need to learn how to make my WAVs sound not like
> computer-generated children voices. For example, using the hback wav
> files and this:
>
> import Control.Concurrent (threadDelay)
> import Graphics.UI.SDL.Mixer.General
> import Graphics.UI.SDL.Mixer.Music
>
> main = do
>  openAudio 22050 AudioS16Sys 2 4096

This is probably the issue.  Most wavs are sampled at 44100, not
22050, and I think you have to ask mplayer specifically to downsample.
 Changing this to

  openAudio 44100 AudioS16Sys 2 4096

should do the trick.

Luke

>  w <- loadMUS "c.wav"
>  playMusic w 1
>  threadDelay 2000000
>  freeMusic w
>  closeAudio
>
> It plays (which is an immense improvement), but I can't get it to
> sound the way it does from eg. mplayer. I have almost no knowledge of
> the inner workings of computer sound drivers, so if there is something
> obvious I'm missing please do speak up.
>
> - Norbert
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list