Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

analyzer

analyzer

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 the value of @samples), not the whole image, but it could be easily modified to draw all samples.

Download

Requirements

  • gems:
    • gd2
    • bindata

Usage

$ ruby analyzer.rb AUDIO_FILE_NAME

Output will be saved as ~/out.png

License

Ruby's

Author

Marcin Lewandowski


Changelog

2010-02-08

Initial release

Last modified:2011/06/11 10:13:51
Keyword(s):
References:[Samples]