<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 <span style="color: rgb(0, 120, 212); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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, 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);">
</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 <chuck-users-bounces@lists.cs.princeton.edu> namens Perry Cook <prc@cs.princeton.edu><br>
<b>Verzonden:</b> woensdag 12 februari 2020 22:04<br>
<b>Aan:</b> chuck-users@lists.cs.princeton.edu <chuck-users@lists.cs.princeton.edu><br>
<b>Onderwerp:</b> Re: [chuck-users] playing SndBuf backward</font>
<div> </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. 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 => 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. You’ve<br>
got to advance time to hear anything in ChucK. <br>
<br>
// 4.3 Playing sounds in reverse<br>
// by ChucK Programmer 4102, yluJ #A<br>
<br>
SndBuf mySound => dac;<br>
<br>
me.dir()+"/audio/hihat_04.wav" => mySound.read; #1<br>
<br>
mySound.samples() => int numSamples; #2<br>
<br>
// play sound once forward<br>
0 => mySound.pos;<br>
numSamples :: samp => now; #3<br>
<br>
// and once backward<br>
numSamples => mySound.pos; #4<br>
-1.0 => mySound.rate; #5<br>
numSamples :: samp => now;<br>
<br>
<br>
> On Feb 12, 2020, at 1:30 PM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
> <br>
> Send chuck-users mailing list submissions to<br>
> chuck-users@lists.cs.princeton.edu<br>
> <br>
> To subscribe or unsubscribe via the World Wide Web, visit<br>
> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
> or, via email, send a message with subject or body 'help' to<br>
> chuck-users-request@lists.cs.princeton.edu<br>
> <br>
> You can reach the person managing the list at<br>
> chuck-users-owner@lists.cs.princeton.edu<br>
> <br>
> When replying, please edit your Subject line so it is more specific<br>
> than "Re: Contents of chuck-users digest..."<br>
> <br>
> <br>
> Today's Topics:<br>
> <br>
> 1. Re: playing SndBuf backward (Perry Cook)<br>
> 2. Error in book "Programming for Musicians and digital artists<br>
> by Ge Wang" ? (herman verbaeten)<br>
> 3. playing SndBuf backward (herman verbaeten)<br>
> <br>
> <br>
> ----------------------------------------------------------------------<br>
> <br>
> Message: 1<br>
> Date: Wed, 12 Feb 2020 12:58:36 -0800<br>
> From: Perry Cook <prc@cs.princeton.edu><br>
> To: chuck-users@lists.cs.princeton.edu<br>
> Subject: Re: [chuck-users] playing SndBuf backward<br>
> Message-ID: <6DBAE4AC-7E7E-413D-8059-8CB929B9AC78@cs.princeton.edu><br>
> Content-Type: text/plain; charset=utf-8<br>
> <br>
> You can set the .pos to wherever you like, and set the .rate to a negative number. The sample will happily play backward to zero and stick there (unless you have .loop set).<br>
> <br>
> PRC<br>
> <br>
> Sent from my iPad<br>
> <br>
>> On Feb 12, 2020, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
>> <br>
>> ?Send chuck-users mailing list submissions to<br>
>> chuck-users@lists.cs.princeton.edu<br>
>> <br>
>> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
>> or, via email, send a message with subject or body 'help' to<br>
>> chuck-users-request@lists.cs.princeton.edu<br>
>> <br>
>> You can reach the person managing the list at<br>
>> chuck-users-owner@lists.cs.princeton.edu<br>
>> <br>
>> When replying, please edit your Subject line so it is more specific<br>
>> than "Re: Contents of chuck-users digest..."<br>
>> <br>
>> <br>
>> Today's Topics:<br>
>> <br>
>> 1. Re: => now (herman verbaeten)<br>
>> <br>
>> ----------------------------------------------------------------------<br>
>> <br>
>> Message: 1<br>
>> Date: Tue, 11 Feb 2020 18:11:09 +0000<br>
>> From: herman verbaeten <hverb54@hotmail.com><br>
>> To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br>
>> Subject: Re: [chuck-users] => now<br>
>> Message-ID:<br>
>> <AM0PR08MB389035F6190B1D2C897C097BA5180@AM0PR08MB3890.eurprd08.prod.outlook.com><br>
>> <br>
>> Content-Type: text/plain; charset="iso-8859-1"<br>
>> <br>
>> Thanks again Mario,<br>
>> <br>
>> I have another question:<br>
>> Can you recommend a procedure to address individual samples of a wave-file you read into the SndBuf.<br>
>> I discovered a way to play a part of a wave file starting at a certain point using ".pos".<br>
>> I also wonder if there's a way to play it backwards (reverse).<br>
>> <br>
>> Cheers,<br>
>> <br>
>> herman<br>
>> <br>
>> <br>
>> <br>
>> _______________________________<br>
> <br>
> <br>
> <br>
> <br>
> ------------------------------<br>
> <br>
> Message: 2<br>
> Date: Wed, 12 Feb 2020 21:15:51 +0000<br>
> From: herman verbaeten <hverb54@hotmail.com><br>
> To: chuck mailing list <chuck-users@lists.cs.princeton.edu><br>
> Subject: [chuck-users] Error in book "Programming for Musicians and<br>
> digital artists by Ge Wang" ?<br>
> Message-ID:<br>
> <AM0PR08MB38900B846EE7C57D44869411A51B0@AM0PR08MB3890.eurprd08.prod.outlook.com><br>
> <br>
> Content-Type: text/plain; charset="iso-8859-1"<br>
> <br>
> Hi,<br>
> <br>
> I was looking in your book and copied listing 4.3 " Playing a sound file backward"<br>
> 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>
> <br>
> Kind regards,<br>
> <br>
> Herman<br>
> <br>
> <br>
> // copy Listing 4.3 Playing a sound file backward<br>
> // from Programming for Musicians and digital artists by Ge Wang<br>
> <br>
> me.sourceDir() + "sample.wav" => string filename;<br>
> if( me.args() ) me.arg(0) => filename;<br>
> <br>
> // the patch<br>
> SndBuf mySound => dac;<br>
> <br>
> // load the file in buf<br>
> filename => mySound.read;<br>
> <br>
> mySound.samples() => int numSamples;<br>
> <br>
> 0 => mySound.pos; // this was ok<br>
> numSamples::samp => now;<br>
> <br>
> numSamples => mySound.pos; // This was not heard. Athough the program stayed in VM.<br>
> -1.0 => mySound.rate;<br>
> numSamples::samp => now;<br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<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>><br>
> <br>
> ------------------------------<br>
> <br>
> Message: 3<br>
> Date: Wed, 12 Feb 2020 21:29:59 +0000<br>
> From: herman verbaeten <hverb54@hotmail.com><br>
> To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br>
> Subject: [chuck-users] playing SndBuf backward<br>
> Message-ID:<br>
> <AM0PR08MB3890357CDD692F4A42A2BC9DA51B0@AM0PR08MB3890.eurprd08.prod.outlook.com><br>
> <br>
> Content-Type: text/plain; charset="utf-8"<br>
> <br>
> <br>
> Sorry PRC it doesn't work: When i set "buf.rate" to 1.0 and "buf.pos" to 0, it does but not the other way around....<br>
> <br>
> <br>
> me.sourceDir() + "aeiou.wav" => string filename;<br>
> if( me.args() ) me.arg(0) => filename;<br>
> <br>
> SndBuf buf => dac;<br>
> <br>
> filename => buf.read;<br>
> <br>
> buf.length() => dur totalelengte;<br>
> buf.samples() => int samples;<br>
> <br>
> samples => buf.pos;<br>
> -1.0 => buf.rate;<br>
> <br>
> samples::ms => now;<br>
> <br>
> ________________________________<br>
> Van: chuck-users-bounces@lists.cs.princeton.edu <chuck-users-bounces@lists.cs.princeton.edu> namens Perry Cook <prc@cs.princeton.edu><br>
> Verzonden: woensdag 12 februari 2020 20:58<br>
> Aan: chuck-users@lists.cs.princeton.edu <chuck-users@lists.cs.princeton.edu><br>
> Onderwerp: Re: [chuck-users] playing SndBuf backward<br>
> <br>
> You can set the .pos to wherever you like, and set the .rate to a negative number. The sample will happily play backward to zero and stick there (unless you have .loop set).<br>
> <br>
> PRC<br>
> <br>
> Sent from my iPad<br>
> <br>
>> On Feb 12, 2020, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:<br>
>> <br>
>> ?Send chuck-users mailing list submissions to<br>
>> chuck-users@lists.cs.princeton.edu<br>
>> <br>
>> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
>> or, via email, send a message with subject or body 'help' to<br>
>> chuck-users-request@lists.cs.princeton.edu<br>
>> <br>
>> You can reach the person managing the list at<br>
>> chuck-users-owner@lists.cs.princeton.edu<br>
>> <br>
>> When replying, please edit your Subject line so it is more specific<br>
>> than "Re: Contents of chuck-users digest..."<br>
>> <br>
>> <br>
>> Today's Topics:<br>
>> <br>
>> 1. Re: => now (herman verbaeten)<br>
>> <br>
>> ----------------------------------------------------------------------<br>
>> <br>
>> Message: 1<br>
>> Date: Tue, 11 Feb 2020 18:11:09 +0000<br>
>> From: herman verbaeten <hverb54@hotmail.com><br>
>> To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br>
>> Subject: Re: [chuck-users] => now<br>
>> Message-ID:<br>
>> <AM0PR08MB389035F6190B1D2C897C097BA5180@AM0PR08MB3890.eurprd08.prod.outlook.com><br>
>> <br>
>> Content-Type: text/plain; charset="iso-8859-1"<br>
>> <br>
>> Thanks again Mario,<br>
>> <br>
>> I have another question:<br>
>> Can you recommend a procedure to address individual samples of a wave-file you read into the SndBuf.<br>
>> I discovered a way to play a part of a wave file starting at a certain point using ".pos".<br>
>> I also wonder if there's a way to play it backwards (reverse).<br>
>> <br>
>> Cheers,<br>
>> <br>
>> herman<br>
>> <br>
>> <br>
>> <br>
>> _______________________________<br>
> <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>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<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>><br>
> <br>
> ------------------------------<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>
> <br>
> <br>
> End of chuck-users Digest, Vol 174, Issue 14<br>
> ********************************************<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>