# Play music on ruby gnome2?

**URL:** <https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831>\
**Category:** Ruby-Gnome 2\
**Created:** [May 28, 2008, 5:46am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831 "2008-05-28T05:46:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 28, 2008, 5:46am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/1 "2008-05-28T05:46:48Z")

</div>

How can I do this?? ruby gnome has fuction to play it??

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 29, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/2 "2008-05-29T17:41:12Z")

</div>

Pat K. wrote:

> How can I do this?? ruby gnome has fuction to play it??

There are gstreamer bindings. I am not sure about their status, but IMO  
the biggest problem with gstreamer is that it is overdesigned for such  
simple tasks 😃

By the way, I think there is no need to use ‘??’.  
A simple ‘?’ should suffice.

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 29, 2008, 6:33pm UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/3 "2008-05-29T18:33:27Z")

</div>

check samples on the trunk …  
and the tutorial …

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gst](http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gst)

pgoetzin@pgoetzin-nc6000:~/Desktop/ruby-gnome2/ruby-gnome2/tags/0.9.1/gstreamer/sample$  
more mp3-player.rb

require ‘gst’

def usage  
puts “Usage: #{ **FILE** } mp3-file”  
exit  
end

def main  
usage if ARGV.length != 1  
file = ARGV[0]

```
# Create a pipeline to hold the elements
pipeline = Gst::Pipeline.new("my_pipeline")

# Create a disk reader
filesrc = Gst::ElementFactory.make("filesrc", "my_disk_source")
filesrc.location = file

# Now it's time to get the MP3 decoder
decoder = Gst::ElementFactory.make("mad", "my_decoder")

# And an audio sink
audiosink = Gst::ElementFactory.make("osssink", "my_audio_player")

# Add objects to the main pipeline
pipeline.add(filesrc, decoder, audiosink)

# Link disk source => decoder => audio player
filesrc >> decoder >> audiosink

# Start playing
puts "Playing #{file}..."
pipeline.play

begin
    # Wait until the file is played
    while pipeline.iterate do end
rescue Interrupt
ensure
    # Stop the pipeline
    pipeline.stop
end

```

end

Gst.init  
main

pgoetzin@pgoetzin-nc6000  
:~/Desktop/ruby-gnome2/ruby-gnome2/tags/0.9.1/gstreamer/sample$

2008/5/29 Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 31, 2008, 7:00am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/4 "2008-05-31T07:00:50Z")

</div>

I have problem when install gstream it support window?

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 31, 2008, 4:56am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/5 "2008-05-31T04:56:08Z")

</div>

thank you I will try this 🙂

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 31, 2008, 9:33am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/6 "2008-05-31T09:33:38Z")

</div>

Shin guey Wong wrote:

> Pat K. wrote:
> 
> > I have problem when install gstream it support window?
> 
> I just compile the latest trunk with gstream for windows. Fortunately,  
> the latest trunk src able to play mp3. But I get some warning  
> message…Although it shows the warning but I still able to listen to  
> the music.
> 
> Here is the output:  
> C:\Devel\installer3\sandbox\ruby-gnome2-trunk-latest\trunk\gstreamer\sample\>ruby  
> audio-player.rb xy.mp3  
> OIL: ERROR liboilcpu.c 282: oil\_cpu\_i386\_kernel\_restrict\_flags():  
> Operating system is not known to support SSE. Assuming it does, which  
> might cause problems

the audio-player.rb hang after the song finish…I have to kill it in  
order to exit from the application…

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 31, 2008, 9:31am UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/7 "2008-05-31T09:31:06Z")

</div>

Pat K. wrote:

> I have problem when install gstream it support window?

I just compile the latest trunk with gstream for windows. Fortunately,  
the latest trunk src able to play mp3. But I get some warning  
message…Although it shows the warning but I still able to listen to  
the music.

Here is the output:  
C:\Devel\installer3\sandbox\ruby-gnome2-trunk-latest\trunk\gstreamer\sample\>ruby  
audio-player.rb xy.mp3  
OIL: ERROR liboilcpu.c 282: oil\_cpu\_i386\_kernel\_restrict\_flags():  
Operating system is not known to support SSE. Assuming it does, which  
might cause problems

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 31, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/8 "2008-05-31T12:47:55Z")

</div>

Shin guey Wong wrote:

> Pat K. wrote:
> 
> > I have problem when install gstream it support window?
> 
> I just compile the latest trunk with gstream for windows. Fortunately,  
> the latest trunk src able to play mp3. But I get some warning  
> message…Although it shows the warning but I still able to listen to  
> the music.
> 
> Here is the output:  
> C:\Devel\installer3\sandbox\ruby-gnome2-trunk-latest\trunk\gstreamer\sample\>ruby  
> audio-player.rb xy.mp3  
> OIL: ERROR liboilcpu.c 282: oil\_cpu\_i386\_kernel\_restrict\_flags():  
> Operating system is not known to support SSE. Assuming it does, which  
> might cause problems

where can I download latest trunk with gstream for windows? I download  
ruby-gstreamer0.10-0.2.0.tar and when I click extconf.rb it has error  
:’(

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [June 3, 2008, 4:03pm UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/9 "2008-06-03T16:03:33Z")

</div>

> There is no binary package for the gstream yet. I compiled it myself  
> using the mingw ruby. You have to download all the require dll urself  
> and use mingw gcc to compile it. I only able to get the .lib file for  
> gstream and has to use other tool to convert it into the gcc share  
> library libxx.a file.
> 
> Regards,  
> Shin Guey

Do you think this info is important for users, and is it missing on the  
wiki?

If so would you mind to do this again :)) or otherwise provide the info?  
If I have the info I can put it onto the wiki, so that windows users at  
least  
have the necessary information on the ruby-gtk wiki available

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [June 1, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/play-music-on-ruby-gnome2/138831/10 "2008-06-01T17:20:27Z")

</div>

Pat K. wrote:

> where can I download latest trunk with gstream for windows? I download  
> ruby-gstreamer0.10-0.2.0.tar and when I click extconf.rb it has error  
> :’(

There is no binary package for the gstream yet. I compiled it myself  
using the mingw ruby. You have to download all the require dll urself  
and use mingw gcc to compile it. I only able to get the .lib file for  
gstream and has to use other tool to convert it into the gcc share  
library libxx.a file.

Regards,  
Shin Guey
