Skip to content

Instantly share code, notes, and snippets.

View stephb9959's full-sized avatar
🎯
Focusing

Stephane Bourque stephb9959

🎯
Focusing
View GitHub Profile
@stephb9959
stephb9959 / record_to_list.hrl
Created August 22, 2019 04:52 — forked from gdamjan/record_to_list.hrl
An erlang macro that creates a function to convert a record to a key-value list
%%% This macro will create a function that converts a record to
%%% a {key, value} list (a proplist)
-define(record_to_list(Record),
fun(Val) ->
Fields = record_info(fields, Record),
[_Tag| Values] = tuple_to_list(Val),
lists:zip(Fields, Values)
end
).
/* fix_fft.c - Fixed-point in-place Fast Fourier Transform */
/*
All data are fixed-point short integers, in which -32768
to +32768 represent -1.0 to +1.0 respectively. Integer
arithmetic is used for speed, instead of the more natural
floating-point.
For the forward FFT (time -> freq), fixed scaling is
performed to prevent arithmetic overflow, and to map a 0dB
sine/cosine wave (i.e. amplitude = 32767) to two -6dB freq