Create a gist now

Instantly share code, notes, and snippets.

A chirp sample. The sound's frequency changes from 2500 Hz to 1500 Hz, and fade out it.
gen(chirp, Options) ->
FirstFrequency = proplists:get_value(first_frequency, Options),
LastFrequency = proplists:get_value(last_frequency, Options),
SamplingFrequency = proplists:get_value(sampling_frequency, Options),
Count = proplists:get_value(count, Options),
Samples = lists:map(fun(I) ->
Frequency = FirstFrequency + (LastFrequency - FirstFrequency) / Count * I,
math:sin(2 * math:pi() * Frequency / SamplingFrequency * I)
lists:seq(1, Count)),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment