Skip to content

Ruby wrapper around the high performance, cross-platform FMOD low-level sound library. You get all the benefits of the FMOD library, but in the object-oriented Ruby way!

License

ForeverZer0/fmod

Repository files navigation

LOGO

Gem Version Documentation

A full-featured and complete Ruby wrapper of the ultra-powerful FMOD Low-Level API. Uses the built-in Fiddle library (Ruby 2.0+) to eliminate unnecessary external gem dependencies, all that is needed is the native FMOD platform-specific native FMOD libraries.

Supports a host of audio formats including:

  • Audio Interchange File Format (.aiff )
  • Advanced Systems Format (.asf)
  • Advanced Stream Redirector (.asx)
  • Downloadable Sound (.dls)
  • Free Loss-less Audio Codec (.flac)
  • FMOD Sound Bank (.fsb)
  • Impulse Tracker (.it)
  • MPEG Audio Layer 3 URL (.m3u)
  • Musical Instrument Digital Interface (.mid, .midi)
  • Module Format (.mod)
  • MPEG Audio Layer 2 (.mp2)
  • MPEG Audio Layer 3 (.mp3)
  • OGG Vorbis (.ogg)
  • Playlist (.pls)
  • ScreamTracker 3 Module (.s3m )
  • PS2/PSP Format (.vag )
  • Waveform Audio File Forma (.wav )
  • Windows Media Audio Redirector (.wax )
  • Windows Media Audio (.wma )
  • Extended Module (.xm )
  • Windows Media Audio (Xbox 360) (.xma)

FMOD is most widely known for its application in video games for sound effects, as it fully supports 3D sound, and can be found in all popular video game consoles (Sony, Microsoft, and Nintendo), as well as a large number of popular PC and mobile games. This is not a restriction by any means, though, and it functions just as well for any audio back-end in your Ruby application, even providing the core functionality to a full-fledged audio player, as it supports such a wide array of formats.

Built-in is a large collection of audio effects that can be applied to a sound, including various equalizers, advanced reverb environments, pitch-shifting, frequency, flange, chorus, and many, many more. Sound manipulation is where FMOD really shines, and places it as an industry standard on nearly all platforms.

The wrapper supports callbacks for various events, such as sync-points in wave files, sound playback ending (either by user or end of data), and various other scenarios. It additionally supports access to raw PCM data directly from the sound card, for creating visualizations or examining the sound in real-time.

Installation

Add this line to your application's Gemfile:

gem 'fmod'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fmod

As of version 0.9.3, the external dependencies are no longer bundled with the gem, but are readily available here (these are the versions the gem was built against). Alternatively, you may download the external libraries directly from the FMOD website (free registration required). Place the platform-specific binaries within the working directory, or in directory of your choice and use FMOD.load_library to initialize the gem.

Usage

Including in the /extras folder (no longer bundled with the gem as of version 0.9.3, but found here on GitHub) is the compiled help documentation for the actual FMOD library, which can be helpful for understanding how the API works if you are unfamiliar.

Those who are familiar with FMOD will find the structure and syntax familiar, though performed in the object-oriented "Ruby" way. All base core FMOD data types have been created as classes, and mostly share the same names with their C counterpart though in Ruby "snake_case" style as opposed to "UpperCamelCase". Being object-oriented each class is wrapped around using the functions that relate to it, and doesn't require the use of passing pointers or the object to the methods.

So creating and working with objects has been simplified..

require 'fmod'

FMOD.load_library

system = FMOD::System.create
sound = system.create_sound("./myFile.mp3")
sound.play  

Each get/set method in the FMOD API has been converted to an "attribute" that can be accessed in the Ruby way. So instead ofFMOD_Channel_GetVolume and FMOD_Channel_SetVolume, it is simply channel.volume and channel.volume = value.

Future Releases

There is still yet to be a few areas that need completed, and are in active development. Included are the following known issues:

  • FMOD plugin support (including 3rd party codecs)
  • Loading custom sound formats (related to plugin support)
  • Custom file-system support to piggyback and monitor FMOD's read/write callbacks
  • Creation of custom effects (Digital Sound Processors) (also related to plugins)

None of these incomplete areas will have any effect on the existing code-base, and existing code will be unaffected by their implementation in future versions.

Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

The FMOD library is under a free license for non-commercial use, and a proprietary license otherwise. See the FMOD License Page for details on pricing if you plan to use this commercially.

Code of Conduct

Everyone interacting in the FMOD project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby wrapper around the high performance, cross-platform FMOD low-level sound library. You get all the benefits of the FMOD library, but in the object-oriented Ruby way!

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages