module CoreMIDI::TypeConversion

Helper for convertig MIDI data

Public Instance Methods

numeric_bytes_to_hex_string(bytes) click to toggle source

Convert an array of numeric byes to a hex string (e.g. [0x90, 0x40, 0x40] becomes “904040”) @param [Array<Integer>] bytes @return [String]

# File lib/coremidi/type_conversion.rb, line 11
def numeric_bytes_to_hex_string(bytes)
  string_bytes = bytes.map do |byte|
    str = byte.to_s(16).upcase
    str = "0" + str if byte < 16
    str
  end
  string_bytes.join
end