# Play audio file

**URL:** <https://www.ruby-forum.com/t/play-audio-file/147512>\
**Category:** Ruby\
**Created:** [September 2, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/play-audio-file/147512 "2008-09-02T17:03:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [September 2, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/play-audio-file/147512/1 "2008-09-02T17:03:23Z")

</div>

Hi all,

Does anyone have idea which gem/plug in is used to play audio file under  
Vista?

Thanks,

Li

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [September 2, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/play-audio-file/147512/2 "2008-09-02T18:35:05Z")

</div>

Li Chen wrote:

> Hi all,
> 
> Does anyone have idea which gem/plug in is used to play audio file under  
> Vista?
> 
> Thanks,
> 
> Li

There’s a gem called win32-sound that’s suitable for playing wav files.  
I assume this uses the win32 API function for playing wav files, so it  
should work on vista. If you require anything more complex, you could  
try the Ruby SDL bindings but win32-sound looks fine for playing simple  
wav files.

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [September 2, 2008, 7:04pm UTC](https://www.ruby-forum.com/t/play-audio-file/147512/3 "2008-09-02T19:04:02Z")

</div>

Michael M. wrote:

> There’s a gem called win32-sound that’s suitable for playing wav files.  
> I assume this uses the win32 API function for playing wav files, so it  
> should work on vista. If you require anything more complex, you could  
> try the Ruby SDL bindings but win32-sound looks fine for playing simple  
> wav files.

Thank you very much and it works quite well.

I need to play several short audio files and have two more questions:  
1) Is it possible to set up the time interval between each file?  
2) I want to print out title for each file. What I find is that it  
plays all the files then print all the file name or either way. Can  
it play 1st file followed by the file name, then 2nd file by the file  
name…?

Li
