<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<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 Perry,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks and sorry for all the trouble.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the meanwhile i posted another mail to the mailinglist (answered by&nbsp;<span style="color: rgb(0, 120, 212); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; font-size: 14px; text-align: left; background-color: rgb(255, 255, 255); display: inline !important">d.loberg.code@wmich.edu)</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
And he said that in SndBuf , in order to play backward,&nbsp; you have to put de pos to -1 total lenght. Suppose your file has 1000 samples. Then you have to start from 1000 - 1 = 999.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This effectively works. In LiSa on the contrary you can start at 1000.</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);">
Cheers,</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);">
&nbsp;</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Van:</b> chuck-users-bounces@lists.cs.princeton.edu &lt;chuck-users-bounces@lists.cs.princeton.edu&gt; namens Perry Cook &lt;prc@cs.princeton.edu&gt;<br>
<b>Verzonden:</b> woensdag 12 februari 2020 22:04<br>
<b>Aan:</b> chuck-users@lists.cs.princeton.edu &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
<b>Onderwerp:</b> Re: [chuck-users] playing SndBuf backward</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">It is playing backward from 0, to 0, so it does nothing.&nbsp; You have to set .pos<br>
to .samples() (point to the end, so it can play backward).<br>
<br>
In the example, you’d need to advance time to let it play forward:<br>
<br>
mySndBuf.samples() :: samp =&gt; now; // you’d hear it play forward<br>
<br>
then set rate to -1, then advance time again to hear it backward.<br>
<br>
PRC<br>
<br>
Looking at our book, I see that you didn’t copy all the lines.&nbsp; You’ve<br>
got to advance time to hear anything in ChucK.&nbsp; <br>
<br>
// 4.3 Playing sounds in reverse<br>
// by ChucK Programmer 4102, yluJ #A<br>
<br>
SndBuf mySound =&gt; dac;<br>
<br>
me.dir()&#43;&quot;/audio/hihat_04.wav&quot; =&gt; mySound.read; #1<br>
<br>
mySound.samples() =&gt; int numSamples; #2<br>
<br>
// play sound once forward<br>
0 =&gt; mySound.pos;<br>
numSamples :: samp =&gt; now; #3<br>
<br>
// and once backward<br>
numSamples =&gt; mySound.pos; #4<br>
-1.0 =&gt; mySound.rate; #5<br>
numSamples :: samp =&gt; now;<br>
<br>
<br>
&gt; On Feb 12, 2020, at 1:30 PM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
&gt; <br>
&gt; Send chuck-users mailing list submissions to<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chuck-users@lists.cs.princeton.edu<br>
&gt; <br>
&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt; or, via email, send a message with subject or body 'help' to<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chuck-users-request@lists.cs.princeton.edu<br>
&gt; <br>
&gt; You can reach the person managing the list at<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chuck-users-owner@lists.cs.princeton.edu<br>
&gt; <br>
&gt; When replying, please edit your Subject line so it is more specific<br>
&gt; than &quot;Re: Contents of chuck-users digest...&quot;<br>
&gt; <br>
&gt; <br>
&gt; Today's Topics:<br>
&gt; <br>
&gt;&nbsp;&nbsp; 1. Re: playing SndBuf backward (Perry Cook)<br>
&gt;&nbsp;&nbsp; 2. Error in book &quot;Programming for Musicians and digital artists<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; by Ge Wang&quot; ? (herman verbaeten)<br>
&gt;&nbsp;&nbsp; 3. playing SndBuf backward (herman verbaeten)<br>
&gt; <br>
&gt; <br>
&gt; ----------------------------------------------------------------------<br>
&gt; <br>
&gt; Message: 1<br>
&gt; Date: Wed, 12 Feb 2020 12:58:36 -0800<br>
&gt; From: Perry Cook &lt;prc@cs.princeton.edu&gt;<br>
&gt; To: chuck-users@lists.cs.princeton.edu<br>
&gt; Subject: Re: [chuck-users] playing SndBuf backward<br>
&gt; Message-ID: &lt;6DBAE4AC-7E7E-413D-8059-8CB929B9AC78@cs.princeton.edu&gt;<br>
&gt; Content-Type: text/plain; charset=utf-8<br>
&gt; <br>
&gt; You can set the .pos to wherever you like, and set the .rate to a negative number.&nbsp; The sample will happily play backward to zero and stick there (unless you have .loop set).<br>
&gt; <br>
&gt; PRC<br>
&gt; <br>
&gt; Sent from my iPad<br>
&gt; <br>
&gt;&gt; On Feb 12, 2020, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
&gt;&gt; <br>
&gt;&gt; ?Send chuck-users mailing list submissions to<br>
&gt;&gt;&nbsp;&nbsp; chuck-users@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;&gt;&nbsp;&nbsp; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt;&gt; or, via email, send a message with subject or body 'help' to<br>
&gt;&gt;&nbsp;&nbsp; chuck-users-request@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; You can reach the person managing the list at<br>
&gt;&gt;&nbsp;&nbsp; chuck-users-owner@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; When replying, please edit your Subject line so it is more specific<br>
&gt;&gt; than &quot;Re: Contents of chuck-users digest...&quot;<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; Today's Topics:<br>
&gt;&gt; <br>
&gt;&gt;&nbsp; 1. Re: =&gt; now (herman verbaeten)<br>
&gt;&gt; <br>
&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt; <br>
&gt;&gt; Message: 1<br>
&gt;&gt; Date: Tue, 11 Feb 2020 18:11:09 &#43;0000<br>
&gt;&gt; From: herman verbaeten &lt;hverb54@hotmail.com&gt;<br>
&gt;&gt; To: ChucK Users Mailing List &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
&gt;&gt; Subject: Re: [chuck-users] =&gt; now<br>
&gt;&gt; Message-ID:<br>
&gt;&gt;&nbsp;&nbsp; &lt;AM0PR08MB389035F6190B1D2C897C097BA5180@AM0PR08MB3890.eurprd08.prod.outlook.com&gt;<br>
&gt;&gt; <br>
&gt;&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;&gt; <br>
&gt;&gt; Thanks again Mario,<br>
&gt;&gt; <br>
&gt;&gt; I have another question:<br>
&gt;&gt; Can you recommend a procedure to address individual samples of a wave-file you read into the SndBuf.<br>
&gt;&gt; I discovered a way to play a part of a wave file starting at a certain point using &quot;.pos&quot;.<br>
&gt;&gt; I also wonder if there's a way to play it backwards (reverse).<br>
&gt;&gt; <br>
&gt;&gt; Cheers,<br>
&gt;&gt; <br>
&gt;&gt; herman<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; _______________________________<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; ------------------------------<br>
&gt; <br>
&gt; Message: 2<br>
&gt; Date: Wed, 12 Feb 2020 21:15:51 &#43;0000<br>
&gt; From: herman verbaeten &lt;hverb54@hotmail.com&gt;<br>
&gt; To: chuck mailing list &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
&gt; Subject: [chuck-users] Error in book &quot;Programming for Musicians and<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digital artists by Ge Wang&quot; ?<br>
&gt; Message-ID:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;AM0PR08MB38900B846EE7C57D44869411A51B0@AM0PR08MB3890.eurprd08.prod.outlook.com&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt; <br>
&gt; Hi,<br>
&gt; <br>
&gt; I was looking in your book and copied listing 4.3 &quot; Playing a sound file backward&quot;<br>
&gt; 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....<br>
&gt; <br>
&gt; Kind regards,<br>
&gt; <br>
&gt; Herman<br>
&gt; <br>
&gt; <br>
&gt; // copy Listing 4.3 Playing a sound file backward<br>
&gt; // from Programming for Musicians and digital artists by Ge Wang<br>
&gt; <br>
&gt; me.sourceDir() &#43; &quot;sample.wav&quot; =&gt; string filename;<br>
&gt; if( me.args() ) me.arg(0) =&gt; filename;<br>
&gt; <br>
&gt; // the patch<br>
&gt; SndBuf mySound =&gt; dac;<br>
&gt; <br>
&gt; // load the file in buf<br>
&gt; filename =&gt; mySound.read;<br>
&gt; <br>
&gt; mySound.samples() =&gt; int numSamples;<br>
&gt; <br>
&gt; 0 =&gt; mySound.pos;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this was ok<br>
&gt; numSamples::samp =&gt; now;<br>
&gt; <br>
&gt; numSamples =&gt; mySound.pos;&nbsp;&nbsp;&nbsp;&nbsp; // This was not heard. Athough the program stayed in VM.<br>
&gt; -1.0 =&gt; mySound.rate;<br>
&gt; numSamples::samp =&gt; now;<br>
&gt; -------------- next part --------------<br>
&gt; An HTML attachment was scrubbed...<br>
&gt; URL: &lt;<a href="http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/622aecd2/attachment-0001.html">http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/622aecd2/attachment-0001.html</a>&gt;<br>
&gt; <br>
&gt; ------------------------------<br>
&gt; <br>
&gt; Message: 3<br>
&gt; Date: Wed, 12 Feb 2020 21:29:59 &#43;0000<br>
&gt; From: herman verbaeten &lt;hverb54@hotmail.com&gt;<br>
&gt; To: ChucK Users Mailing List &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
&gt; Subject: [chuck-users] playing SndBuf backward<br>
&gt; Message-ID:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;AM0PR08MB3890357CDD692F4A42A2BC9DA51B0@AM0PR08MB3890.eurprd08.prod.outlook.com&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&gt; Content-Type: text/plain; charset=&quot;utf-8&quot;<br>
&gt; <br>
&gt; <br>
&gt; Sorry PRC it doesn't work: When i set &quot;buf.rate&quot; to 1.0 and&nbsp; &quot;buf.pos&quot;&nbsp; to 0,&nbsp; it does but not the other way around....<br>
&gt; <br>
&gt; <br>
&gt; me.sourceDir() &#43; &quot;aeiou.wav&quot; =&gt; string filename;<br>
&gt; if( me.args() ) me.arg(0) =&gt; filename;<br>
&gt; <br>
&gt; SndBuf buf =&gt; dac;<br>
&gt; <br>
&gt; filename =&gt; buf.read;<br>
&gt; <br>
&gt; buf.length() =&gt; dur totalelengte;<br>
&gt; buf.samples() =&gt; int samples;<br>
&gt; <br>
&gt; samples =&gt; buf.pos;<br>
&gt; -1.0 =&gt; buf.rate;<br>
&gt; <br>
&gt; samples::ms =&gt; now;<br>
&gt; <br>
&gt; ________________________________<br>
&gt; Van: chuck-users-bounces@lists.cs.princeton.edu &lt;chuck-users-bounces@lists.cs.princeton.edu&gt; namens Perry Cook &lt;prc@cs.princeton.edu&gt;<br>
&gt; Verzonden: woensdag 12 februari 2020 20:58<br>
&gt; Aan: chuck-users@lists.cs.princeton.edu &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
&gt; Onderwerp: Re: [chuck-users] playing SndBuf backward<br>
&gt; <br>
&gt; You can set the .pos to wherever you like, and set the .rate to a negative number.&nbsp; The sample will happily play backward to zero and stick there (unless you have .loop set).<br>
&gt; <br>
&gt; PRC<br>
&gt; <br>
&gt; Sent from my iPad<br>
&gt; <br>
&gt;&gt; On Feb 12, 2020, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
&gt;&gt; <br>
&gt;&gt; ?Send chuck-users mailing list submissions to<br>
&gt;&gt;&nbsp;&nbsp; chuck-users@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;&gt;&nbsp;&nbsp; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt;&gt; or, via email, send a message with subject or body 'help' to<br>
&gt;&gt;&nbsp;&nbsp; chuck-users-request@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; You can reach the person managing the list at<br>
&gt;&gt;&nbsp;&nbsp; chuck-users-owner@lists.cs.princeton.edu<br>
&gt;&gt; <br>
&gt;&gt; When replying, please edit your Subject line so it is more specific<br>
&gt;&gt; than &quot;Re: Contents of chuck-users digest...&quot;<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; Today's Topics:<br>
&gt;&gt; <br>
&gt;&gt;&nbsp; 1. Re: =&gt; now (herman verbaeten)<br>
&gt;&gt; <br>
&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt; <br>
&gt;&gt; Message: 1<br>
&gt;&gt; Date: Tue, 11 Feb 2020 18:11:09 &#43;0000<br>
&gt;&gt; From: herman verbaeten &lt;hverb54@hotmail.com&gt;<br>
&gt;&gt; To: ChucK Users Mailing List &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
&gt;&gt; Subject: Re: [chuck-users] =&gt; now<br>
&gt;&gt; Message-ID:<br>
&gt;&gt;&nbsp;&nbsp; &lt;AM0PR08MB389035F6190B1D2C897C097BA5180@AM0PR08MB3890.eurprd08.prod.outlook.com&gt;<br>
&gt;&gt; <br>
&gt;&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;&gt; <br>
&gt;&gt; Thanks again Mario,<br>
&gt;&gt; <br>
&gt;&gt; I have another question:<br>
&gt;&gt; Can you recommend a procedure to address individual samples of a wave-file you read into the SndBuf.<br>
&gt;&gt; I discovered a way to play a part of a wave file starting at a certain point using &quot;.pos&quot;.<br>
&gt;&gt; I also wonder if there's a way to play it backwards (reverse).<br>
&gt;&gt; <br>
&gt;&gt; Cheers,<br>
&gt;&gt; <br>
&gt;&gt; herman<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; _______________________________<br>
&gt; <br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; chuck-users mailing list<br>
&gt; chuck-users@lists.cs.princeton.edu<br>
&gt; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt; -------------- next part --------------<br>
&gt; An HTML attachment was scrubbed...<br>
&gt; URL: &lt;<a href="http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/b97a132a/attachment.html">http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/b97a132a/attachment.html</a>&gt;<br>
&gt; <br>
&gt; ------------------------------<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; chuck-users mailing list<br>
&gt; chuck-users@lists.cs.princeton.edu<br>
&gt; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt; <br>
&gt; <br>
&gt; End of chuck-users Digest, Vol 174, Issue 14<br>
&gt; ********************************************<br>
<br>
_______________________________________________<br>
chuck-users mailing list<br>
chuck-users@lists.cs.princeton.edu<br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</div>
</span></font></div>
</div>
</body>
</html>