class ZoomSample

Defined in:

zoom_sample.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(raw_data : Bytes, loop_pos : Int32, tag : String) #

[View source]

Instance Method Detail

def parse #

Unpack the four 8-bit samples into four 16-bit samples Per MAME documentation (src/devices/sound/zsg2.cpp):

The samples are compressed with a 2:1 ratio. Each block of 4-bytes becomes 4 16-bits samples. Reading the 4 bytes as a little-endian 32bits values, the structure is:

42222222 51111111 60000000 ssss3333

's' is a 4-bit scale value. '0000000', '1111111', '2222222' and '6543333' are signed 7-bits values corresponding to the 4 samples. To compute the final 16bits value, left-align and shift right by s.


[View source]
def tag : String #

[View source]
def to_pcm(filename) #

Write a raw PCM audio file (no headers)


[View source]
def to_wav(filename) #

Write a PCM WAV file.


[View source]