File: downsamp.html

package info (click to toggle)
csound-doc 3.47b2-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,492 kB
  • ctags: 272
  • sloc: makefile: 36
file content (95 lines) | stat: -rw-r--r-- 5,193 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; IRIX 6.3 IP32) [Netscape]">
   <TITLE>DOWNSAMP</TITLE>
</HEAD>
<BODY>

<CENTER><A NAME="downsamp"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="SIG_MOD.html">Top of this section</A></B> - <A HREF="dam.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="harmon.html">Next</A>&nbsp;
<HR></CENTER>

<H2>
samphold, downsamp, upsamp, interp, integ, diff, samphold</H2>

<PRE>&nbsp;&nbsp;&nbsp;&nbsp; kr&nbsp;&nbsp; <B>downsamp</B>&nbsp; asig[, iwlen]
&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>upsamp</B>&nbsp;&nbsp;&nbsp; ksig&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>interp</B>&nbsp;&nbsp;&nbsp; ksig[, istor]
&nbsp;&nbsp;&nbsp;&nbsp; kr&nbsp;&nbsp; <B>integ</B>&nbsp;&nbsp;&nbsp;&nbsp; ksig[, istor]
&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>integ</B>&nbsp;&nbsp;&nbsp;&nbsp; asig[, istor]
&nbsp;&nbsp;&nbsp;&nbsp; kr&nbsp;&nbsp; <B>diff</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ksig[, istor]
&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>diff</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asig[, istor]
&nbsp;&nbsp;&nbsp;&nbsp; kr&nbsp;&nbsp; <B>samphold</B>&nbsp; xsig, kgate[, ival, ivstor]
&nbsp;&nbsp;&nbsp;&nbsp; ar&nbsp;&nbsp; <B>samphold</B>&nbsp; asig, xgate[, ival, ivstor]</PRE>

<HR>
<H4>
<U>DESCRIPTION</U></H4>
Modify a signal by up- or down-sampling, integration, and differentiation.
<H4>
<U>INITIALIZATION</U></H4>
<I>iwlen</I> (optional) - window length in samples over which the audio
signal is averaged to determine a downsampled value. Maximum length is
<I>ksmps</I>; 0 and 1 imply no window averaging. The default value is 0.

<P><I>istor</I> (optional) - initial disposition of internal save space
( <A HREF="port.html">see reson</A>). The default value is 0.

<P><I>ival, ivstor</I> (optional) - controls initial disposition of internal
save space. If <I>ivstor</I> is zero the internal "hold" value is set to
<I>ival</I> ; else it retains its previous value. Defaults are 0,0 (i.e.
init to zero)
<H4>
<U>PERFORMANCE</U></H4>
<B>downsamp</B> converts an audio signal to a control signal by downsampling.
It produces one kval for each audio control period. The optional window
invokes a simple averaging process to suppress foldover.

<P><B>upsamp, interp</B> convert a <I>control</I> signal to an <I>audio</I>
signal. The first does it by simple repetition of the kval, the second
by linear interpolation between successive kvals. <B>upsamp</B> is a slightly
more efficient form of the assignment, `asig = ksig'.

<P><B>integ, diff</B> perform <I>integration</I> and <I>differentiation</I>
on an input control signal or audio signal. Each is the converse of the
other, and applying both will reconstruct the original signal. Since these
units are special cases of low-pass and high-pass filters, they produce
a scaled (and phase shifted) output that is frequency-dependent. Thus <B>diff</B>
of a sine produces a cosine, with amplitude <I>2 * sin(pi * cps / <B>sr</B>)</I>
that of the original (for each component partial); <B>integ</B> will inversely
affect the magnitudes of its component inputs. With this understanding,
these units can provide useful signal modification.

<P><B>samphold</B> performs a sample-and-hold operation on its input according
to the value of <I>gate</I>. If <I>gate > 0</I>, the input samples are
passed to the output; If <I>gate >= 0</I>, the last output value is repeated.
The controlling <I>gate</I> can be a constant, a control signal, or an
audio signal.
<H4>
<U>EXAMPLE:</U></H4>

<PRE>&nbsp; asrc&nbsp;&nbsp; <B>buzz</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10000,440,20, 1&nbsp;&nbsp;&nbsp;&nbsp; ; band-limited pulse train
&nbsp; adif&nbsp;&nbsp; <B>diff</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asrc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; emphasize the highs
&nbsp; anew&nbsp;&nbsp; <B>balance</B>&nbsp;&nbsp; adif, asrc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp;&nbsp; but retain the power
&nbsp; agate&nbsp; <B>reson</B>&nbsp;&nbsp;&nbsp;&nbsp; asrc,0,440&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; use a lowpass of the original
&nbsp; asamp&nbsp; <B>samphold</B>&nbsp; anew, agate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp;&nbsp; to gate the new audiosig
&nbsp; aout&nbsp;&nbsp; <B>tone</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asamp,100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; smooth out the rough edges</PRE>

<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="SIG_MOD.html">Top of this section</A></B> - <A HREF="dam.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="harmon.html">Next</A>&nbsp;
<HR></CENTER>


<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>&copy;
Jean Pich&eacute; &amp; Peter J. Nix, 1994-97</FONT></FONT></I></B>&nbsp;
</CENTER>
</HTML>