[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] create - analyzer

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2010年 2月 8日 (月) 11:44:00 JST


-------------------------
REMOTE_ADDR = 83.19.226.42
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?analyzer
-------------------------
TITLE       = analyzer
KEYWORD     = 
This script draws an image of the sound (similar to attached below) with Ruby and GStreamer.

It's extremely slow so treat that just as a proof-of-concept code that shows how to use appsink. About 60% of CPU usage is now taken by drawing PNG file, but even if you disable it, it still remains slow. Propably the reason is that in Ruby you cannot just cast buffer to integer or float as you can do in C, so it takes a lot of computing power to convert every frame (that is actually a String) to anything reasonable.

This script draws first n pixels (equal to @samples * @samples_per_pixel), not the whole image, but it could be easily modified to draw all samples.

==Download
{{attach_anchor("analyzer.rb")}}

==Requirements
* gems:
  * gd2
  * bindata


==Screenshot
{{image "analyzer.png"}}

==Usage
$ ruby analyzer.rb AUDIO_FILE_NAME

Output will be saved as ~/out.png

==License
Ruby's

==Author
Marcin Lewandowski

{{br}}
===Changelog
:2010-02-08
Initial release




ruby-gnome2-cvs メーリングリストの案内
Back to archive index