Hello Ivan,<div><br></div><div>I have an erlang module that generates sounds. It can generate different wave forms (right now all I need is a saw-like shape and a sinus shape). I am attaching it. It is a bit messy, perhaps, but it should give you an impression of how it can be done.</div>
<div><br></div><div>The synthesize() function uses the sinus() function to create a number of complete waves, and then pastes these together repeatedly (I assumed that would be more efficient that calculating the sinus() function for each sample).</div>
<div><br></div><div>The syntesize() function returns a couple of sound fragments: an "attaque" bit that starts with an amplitude of zero, a fade-out bit where the volume decreases back to 0, and a long and a short bit of sound with a stable volume. Another module creates a complete sound-fragment of the desired duration by pasting together the attaque, a number of long fragments and short fragments in such a way that it matches the duration (as precisely as possible), and a fade out bit.</div>
<div><br></div><div>As you can see this creates sounds with a fixed pitch and volume (within one sound, that is). Also note that both the length and the pitch of the sound will be approximations.</div><div><br></div><div>
I created this to generate music for my web-site: <a href="http://coria.nl">http://coria.nl</a>. You can try the result there, if you want. It is a site that enables me and the other members of my choir (and anyone else who is interested) to practise our music. </div>
<div><br></div><div>Any comments or suggestions will be quite welcome, </div><div>Good luck,</div><div>Willem </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 11:28 AM, Ivan Uemlianin <span dir="ltr"><<a href="mailto:ivan@llaisdy.com">ivan@llaisdy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear All<br>
<br>
I am learning Erlang and one of the things I'm interested in is<br>
generating sine waves, merging them and streaming them to audio output.<br>
<br>
I can kind of imagine how generating and merging would work, with a sine<br>
wave represented as a list of numbers. Is there an Erlang library or<br>
project working with sine waves?<br>
<br>
I can't imagine how to stream a list of numbers to audio output. Can<br>
anyone point me to projects/libraries/ideas for that one? Writing the<br>
data to a file would be OK for now, but "live" sound would be much nicer.<br>
<br>
With thanks and best wishes<br>
<br>
Ivan<br>
<br>
-- <br>
============================================================<br>
Ivan A. Uemlianin<br>
Speech Technology Research and Development<br>
<br>
<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a><br>
<a href="http://www.llaisdy.com" target="_blank">www.llaisdy.com</a><br>
<a href="http://llaisdy.wordpress.com" target="_blank">llaisdy.wordpress.com</a><br>
<a href="http://www.linkedin.com/in/ivanuemlianin" target="_blank">www.linkedin.com/in/ivanuemlianin</a><br>
<br>
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"<br>
(Schiller, Beethoven)<br>
============================================================<br>
<br>
<br>
<br>
________________________________________________________________<br>
erlang-questions (at) <a href="http://erlang.org" target="_blank">erlang.org</a> mailing list.<br>
See <a href="http://www.erlang.org/faq.html" target="_blank">http://www.erlang.org/faq.html</a><br>
To unsubscribe; mailto:<a href="mailto:erlang-questions-unsubscribe@erlang.org" target="_blank">erlang-questions-unsubscribe@erlang.org</a><br>
<br>
</blockquote></div><br></div>