From: Michael Morin Date: 2010-08-30T03:58:51+09:00 Subject: Re: Playing raw PCM files in ruby On 8/29/2010 2:45 PM, Roger Braun wrote: > Hello everyone, > > I am trying to play the music from the old game "Ascendancy" using > Ruby, the files are 8-bit unsigned raw PCM files at 22 khz. I thought > about using SDL for playing them, but I can't seem to find any way to > load these files with the ruby bindings. Has anyone done this before > or has any other idea how to play the sound? > You might be better off converting these sounds to something that can be handled more easily. You could use a command-line tool like Sox to do the job, just iterate over the files (in Ruby, perhaps) and convert them to wav files. This has the added benefit of possibly encoding them in MP3 or Ogg Vorbis for smaller file sizes. Raw PCM should be able to be handled though. The problem is, raw PCM has no header information. If you know the exact format, you could theoretically load it into memory and have it played, but it'll be a pain. If you get any of the settings wrong, you might as well be pumping random noise through your speakers. -- Michael Morin Guide to Ruby http://ruby.about.com/ Become an About.com Guide: beaguide.about.com About.com is part of the New York Times Company