<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I was looking in your book and copied listing 4.3 " Playing a sound file backward"</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
But it didn't work. Hopefully i did everything correctly. It did perform the first (forward) part but during the reverse part i heard nothing. Can you please help me....</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kind regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Herman</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>// copy Listing 4.3 Playing a sound file backward<br>
</span>
<div>// from Programming for Musicians and digital artists by Ge Wang<br>
</div>
<div><br>
</div>
<div>me.sourceDir() + "sample.wav" => string filename;<br>
</div>
<div>if( me.args() ) me.arg(0) => filename;<br>
</div>
<div><br>
</div>
<div>// the patch <br>
</div>
<div>SndBuf mySound => dac;<br>
</div>
<div><br>
</div>
<div>// load the file in buf<br>
</div>
<div>filename => mySound.read;<br>
</div>
<div><br>
</div>
<div>mySound.samples() => int numSamples;<br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 136, 42);">0 => mySound.pos; // this was ok </span><br>
</div>
<div><span style="color: rgb(12, 136, 42);">numSamples::samp => now;</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(200, 38, 19);">numSamples => mySound.pos; // This was not heard. Athough the program stayed in VM. </span><br>
</div>
<div><span style="color: rgb(200, 38, 19);">-1.0 => mySound.rate;</span><br>
</div>
<span style="color: rgb(200, 38, 19);">numSamples::samp => now;</span></div>
</body>
</html>