Created
March 2, 2014 15:03
-
-
Save kuniyoshi/9307819 to your computer and use it in GitHub Desktop.
A chirp sample. The sound's frequency changes from 2500 Hz to 1500 Hz, and fade out it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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