Module: Awaaz::Extensions::Soundfile

Extended by:
FFI::Library
Defined in:
lib/awaaz/extensions/soundfile.rb

Overview

The Soundfile module provides Ruby bindings to the ‘libsndfile` C library using the FFI (Foreign Function Interface).

It allows reading audio file metadata and sample data directly from Ruby.

Defined Under Namespace

Classes: SF_INFO

Constant Summary collapse

SFM_READ =

Open mode for reading sound files.

Returns:

  • (Integer)

    Bitmask flag for read mode.

0x10

Instance Method Summary collapse

Instance Method Details

#sf_closeInteger

Closes an open audio file.

Returns:

  • (Integer)

    Zero on success, non-zero on error.



71
# File 'lib/awaaz/extensions/soundfile.rb', line 71

attach_function :sf_close, [:pointer], :int

#sf_openObject

Opens an audio file and returns a pointer to the file handle.



59
# File 'lib/awaaz/extensions/soundfile.rb', line 59

attach_function :sf_open, i[string int pointer], :pointer

#sf_readf_floatInteger

Reads floating-point audio frames from an open file.

Returns:

  • (Integer)

    Number of frames actually read.



65
# File 'lib/awaaz/extensions/soundfile.rb', line 65

attach_function :sf_readf_float, i[pointer pointer long_long], :long_long