Module: Awaaz::Utils::ViaShell

Included in:
Decoders::Mp3Decoder, Decoders::WavefileDecoder
Defined in:
lib/awaaz/utils/via_shell.rb

Overview

Note:

This module is ‘private` and its methods are meant to be used internally by decoders.

Utility module providing shell-based audio decoding support for decoder classes.

This module is intended to be mixed into decoder classes that rely on external tools such as ‘ffmpeg`, `mpg123`, or `sox` to decode audio files. It builds the appropriate shell commands, executes them, and converts the raw audio data into

Numo::NArray

samples.

Examples:

Using within a decoder

class Mp3Decoder < B
  include Awaaz::Utils::ViaShell

  def load
    process(*shell_load(sox_options: { raw: true }))
  end
end