Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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)
end,
lists:seq(1, Count)),
Samples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment