<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
<P align=left>Hi,</P>
<P align=left>As a first step into the wonderful and time consuming world of DSP&lt;=&gt;Chuck I want to make audible the effect of disregarding the sampling theorem. So all I'm trying to do at the moment is creating a simple down-sampler without any proper filtering. As it is said in the sampling theorem this should not create any distortion as long as my new sampling rate is at least twice as high as the highest sine wave in my input signal. However, when I'm sampling down a sine wave of for example 440 Hz in Chuck, I get a lot of funny noises long before going down to a SR of 880 Hz. </P>
<P align=left>For example:</P>
<P align=left>&nbsp;</P>
<P align=left></P>
<P align=left>SinOsc inputSignal;</P>
<P align=left>Step stepSeq;</P>
<P align=left>inputSignal =&gt; blackhole;</P>
<P align=left>stepSeq=&gt; dac;</P>
<P align=left>440 =&gt; inputSignal.freq;</P>
<P align=left>0.5 =&gt; inputSignal.gain;</P>
<P align=left>//takin every nTh sample of the inputSignal</P>
<P align=left>10 =&gt; int n;</P>
<P align=left>&lt;&lt;&lt;"real sample rate: " + 1::second/1::samp&gt;&gt;&gt;;</P>
<P align=left>&lt;&lt;&lt;"new sample rate: " + 1::second/(1::samp*n)&gt;&gt;&gt;;</P>
<P align=left>//duration of the output signal</P>
<P align=left>1::second =&gt; dur durationOfTest;</P>
<P align=left>now + durationOfTest =&gt; time timeToFinish;</P>
<P align=left>//don't-care-about-Nyquist-downsampling</P>
<P align=left>while (now &lt; timeToFinish) {</P>
<P align=left>inputSignal.last() =&gt; stepSeq.next;</P>
<P align=left>n::samp =&gt; now;</P>
<P align=left>}</P>
<P align=left>&nbsp;</P>
<P align=left></P>
<P align=left>By using a common sample-rate like e.g. 44100 Hz in Chuck this should satisfy the sampling theorem. I guess the reason, why I doesn't get a nice 440-sine wave here is because I have to reconstruct the sine wave after the down sampling with the remaining samples, as the output cannot know that they are part of a proper sine wave. Is this right? If yes, could someone give me a hint how to realize something like this? Of not, what is the real problem? My target&nbsp;is&nbsp;a downsampler which for example would produce an undistorted sine wave of 440 Hz after downsampling to 880 Hz (i.e. a working demonstration of the sampling theorem)</P>
<P align=left>&nbsp;</P>
<P align=left></P>
<P align=left>A second and a bit stupid question: As far as I understand it, it is not possible to downsample a signal with a given SR to any new SR, but only to a new SR which is = (Old SR)/N, whereas N is a simple positive number (of course after converting the new SR to integer). Did I get this right?</P>
<P align=left></P>
<P align=left>&nbsp;</P>
<P align=left>OK, I would be very grateful if someone could give me a hint or two. I =&gt; bed, have a nice day!</P>
<P align=left></P>
<P align=left>Jakob</P><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>