Playing raw PCM files in ruby

R

Roger Braun

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?
 
M

Michael Morin

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
 
R

Roger Braun

You might be better off converting these sounds to something that can be
handled more easily. =A0You could use a command-line tool like Sox to do = the
job, just iterate over the files (in Ruby, perhaps) and convert them to w= av
files. =A0This has the added benefit of possibly encoding them in MP3 or = Ogg
Vorbis for smaller file sizes.

Thanks for the suggestion, but I would really like to play the files
directly from the games archive format.
Raw PCM should be able to be handled though. =A0The problem is, raw PCM h= as no
header information. =A0If you know the exact format, you could theoretica= lly
load it into memory and have it played, but it'll be a pain. =A0If you ge= t any
of the settings wrong, you might as well be pumping random noise through
your speakers.

That's exactly what I want to do, but I found no way to actually do
this. Wrong settings are no problem here, because all the music files
in the game use the same format and the program is just supposed to
play these songs.

--=20
Roger Braun
http://rbraun.net
(e-mail address removed)-tuebingen.de
 
R

Roger Pack

Roger said:
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?

Linux or windows?
-r
 
R

Roger Pack

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?


call out to VLC?
 
Y

yermej

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?

Are you unable to load them because of the lack of headers or is there
another reason?

If it's the lack of headers, would it be too difficult to create them
on the fly and then use SDL?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top