Module: Awaaz
- Extended by:
- Features, Properties
- Defined in:
- lib/awaaz/config.rb,
lib/awaaz.rb,
lib/awaaz/errors.rb,
lib/awaaz/version.rb,
lib/awaaz/features.rb,
lib/awaaz/properties.rb,
lib/awaaz/utils/utils.rb,
lib/awaaz/utils/resample.rb,
lib/awaaz/decoders/decode.rb,
lib/awaaz/utils/soundread.rb,
lib/awaaz/utils/via_shell.rb,
lib/awaaz/decoders/decoders.rb,
lib/awaaz/utils/sound_config.rb,
lib/awaaz/decoders/mp3_decoder.rb,
lib/awaaz/extensions/soundfile.rb,
lib/awaaz/decoders/base_decoder.rb,
lib/awaaz/extensions/extensions.rb,
lib/awaaz/extensions/samplerate.rb,
lib/awaaz/decoders/wavefile_decoder.rb,
lib/awaaz/utils/shell_command_builder.rb
Overview
The Awaaz gem provides audio decoding utilities and related tools for working with various audio formats. It uses FFI bindings and Numo::NArray for numerical processing and includes multiple decoders, utilities, and configuration options.
Defined Under Namespace
Modules: Decoders, Extensions, Features, Properties, Utils Classes: AudioreadError, Config, DecoderNotFound, ResamplingError
Constant Summary collapse
- VERSION =
Version the Awaaz gem.
"0.2.0"- DECODER_MAP =
Mapping of MIME types to their respective decoder classes.
{ "audio/wav" => Decoders::WavefileDecoder, "audio/x-wav" => Decoders::WavefileDecoder, "audio/wave" => Decoders::WavefileDecoder, "audio/vnd.wave" => Decoders::WavefileDecoder, "audio/mpeg" => Decoders::Mp3Decoder, "audio/mp3" => Decoders::Mp3Decoder, "audio/x-mpeg" => Decoders::Mp3Decoder, "audio/x-mp3" => Decoders::Mp3Decoder }.freeze
Class Method Summary collapse
-
.config ⇒ Awaaz::Config
Returns the current configuration object.
-
.configure {|config| ... } ⇒ Object
Yields the current configuration object for modifications.
-
.load(filename) ⇒ Object
Loads an audio file and processes it using the appropriate decoder based on the file’s MIME type.
-
.potential_decoders ⇒ Array<Symbol>
Lists all potential decoders that Awaaz can work with.
Methods included from Features
build_ranges, compute_bandwidth, compute_centroid, fft, frame_magnitude, frame_ranges, frames_to_time, frequency_bins, hann_window, pad_amount, pad_right, prepare_for_fft, rms, rms_overall, rolloff_for_frame, spectral_bandwidth, spectral_centroids, spectral_flatness, spectral_rolloff, stft, total_frames, zcr, zcr_for_frame, zcr_overall
Methods included from Properties
Class Method Details
.config ⇒ Awaaz::Config
Returns the current configuration object.
123 124 125 |
# File 'lib/awaaz/config.rb', line 123 def config @config ||= Config.new end |
.configure {|config| ... } ⇒ Object
Yields the current configuration object for modifications.
132 133 134 |
# File 'lib/awaaz/config.rb', line 132 def configure yield(config) end |
.load(filename) ⇒ Object
Loads an audio file and processes it using the appropriate decoder based on the file’s MIME type.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/awaaz/decoders/decode.rb', line 28 def load(filename, ...) fm = FileMagic.new(FileMagic::MAGIC_MIME_TYPE) mime_type = fm.file(filename) unless DECODER_MAP.key?(mime_type) raise ArgumentError, "Cannot load the file. Available mime types: #{DECODER_MAP.keys.join(", ")}" end decoding_class = DECODER_MAP[mime_type] decoding_class.load(filename, ...) end |
.potential_decoders ⇒ Array<Symbol>
Lists all potential decoders that Awaaz can work with.
141 142 143 |
# File 'lib/awaaz/config.rb', line 141 def potential_decoders config.potential_decoders end |