| 1 |
<html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 |
<title>Sound: To Polygon...</title> |
| 3 |
<style> |
| 4 |
td { padding-left: 5pt; padding-right: 5pt; } |
| 5 |
th { padding-left: 5pt; padding-right: 5pt; } |
| 6 |
code { white-space: pre-wrap; } |
| 7 |
dd { white-space: pre-wrap; } |
| 8 |
</style> |
| 9 |
</head><body bgcolor="#FFFFFF"> |
| 10 |
|
| 11 |
<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 |
Sound: To Polygon... |
| 13 |
</b></font></table></table> |
| 14 |
<p>A command that creates a <a href="Polygon.html">Polygon</a> from a selected <a href="Sound.html">Sound</a>, where the Polygon's points are defined by the (<i>time</i>, <i>amplitude</i>) pairs of the sound. </p> |
| 15 |
<h2>Settings</h2> |
| 16 |
<dl> |
| 17 |
<dt><b>Channel</b> |
| 18 |
<dd>defines which channel of the sound is used.</dd> |
| 19 |
<dt><b>Time range (s)</b> |
| 20 |
<dd>defines the part of the sound whose (<i>time</i>, <i>amplitude</i>) pairs have to be included.</dd> |
| 21 |
<dt><b>Vertical range</b> |
| 22 |
<dd>defines the vertical limits, larger amplitudes will be clipped.</dd> |
| 23 |
<dt><b>Connection y-value</b> |
| 24 |
<dd>defines the y-value of the first and last point of the Polygon. This gives the opportunity to draw a closed Polygon with the horizontal connection line at any position you like. </dd> |
| 25 |
</dl> |
| 26 |
<h2>Example</h2> |
| 27 |
<p>The following script paints the area under a sound curve in red and the area above in green.</p> |
| 28 |
<code> s = Create Sound from formula: "s", 1, 0, 1, 10000, ~ 0.5*sin(2*pi*5*x)<br></code> |
| 29 |
<code> # Connection y-value is at amplitude -1: area under the curve.<br></code> |
| 30 |
<code> p1 = To Polygon: 1, 0, 0, -1, 1, -1<br></code> |
| 31 |
<code> Paint: "{1,0,0}", 0, 0, -1, 1<br></code> |
| 32 |
<code> selectObject: s<br></code> |
| 33 |
<code> # Connection y-value is now at amplitude 1: area above the curve.<br></code> |
| 34 |
<code> p2 = To Polygon: 1, 0, 0, -1, 1, 1<br></code> |
| 35 |
<code> Paint: "{0,1,0}", 0, 0, -1, 1<br></code> |
| 36 |
<p align=middle><img height=200 width=450 src=Sound__To_Polygon____1.png></p><hr> |
| 37 |
<address> |
| 38 |
<p>© djmw 20170829</p> |
| 39 |
</address> |
| 40 |
</body> |
| 41 |
</html> |