[chuck-users] playing SndBuf backward

David Loberg Code d.loberg.code at wmich.edu
Wed Feb 12 17:11:47 EST 2020


In my experience, in SndBuf, to play the file backwards from the end requires
file.samples() - 1 => file.pos; file.rate(-1.);

If the size of the file is, for example, 1000 samples, the first sample is located at 0 and the last sample bit is 999 (not 1000).
On my machine, at least, if I set the position beyond the end of the file, it won't play backward.

However, when using LiSa, the starting position is 1::samp, and the ending point is 1000::samp

davd

David Loberg Code
School of Music
Western Michigan University



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....


me.sourceDir() + "aeiou.wav" => string filename;
if( me.args() ) me.arg(0) => filename;

SndBuf buf => dac;

filename => buf.read;

buf.length() => dur totalelengte;
buf.samples() => int samples;

samples => buf.pos;
-1.0 => buf.rate;

samples::ms => now;

________________________________
Van: chuck-users-bounces at lists.cs.princeton.edu<mailto:chuck-users-bounces at lists.cs.princeton.edu> <chuck-users-bounces at lists.cs.princeton.edu<mailto:chuck-users-bounces at lists.cs.princeton.edu>> namens Perry Cook <prc at cs.princeton.edu<mailto:prc at cs.princeton.edu>>
Verzonden: woensdag 12 februari 2020 20:58<x-apple-data-detectors://3>
Aan: chuck-users at lists.cs.princeton.edu<mailto:chuck-users at lists.cs.princeton.edu><chuck-users at lists.cs.princeton.edu<mailto:chuck-users at lists.cs.princeton.edu>>
Onderwerp: Re: [chuck-users] playing SndBuf backward

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).

PRC

Sent from my iPad

> On Feb 12, 2020, at 9:00 AM, chuck-users-request at lists.cs.princeton.edu<mailto:chuck-users-request at lists.cs.princeton.edu> wrote:
>
> Send chuck-users mailing list submissions to
>    chuck-users at lists.cs.princeton.edu<mailto:chuck-users at lists.cs.princeton.edu>
>
> To subscribe or unsubscribe via the World Wide Web, visit
>    https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> or, via email, send a message with subject or body 'help' to
>    chuck-users-request at lists.cs.princeton.edu<mailto:chuck-users-request at lists.cs.princeton.edu>
>
> You can reach the person managing the list at
>    chuck-users-owner at lists.cs.princeton.edu<mailto:chuck-users-owner at lists.cs.princeton.edu>
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of chuck-users digest..."
>
>
> Today's Topics:
>
>   1. Re: => now (herman verbaeten)
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 11 Feb 2020 18:11:09 +0000
> From: herman verbaeten <hverb54 at hotmail.com<mailto:hverb54 at hotmail.com>>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu<mailto:chuck-users at lists.cs.princeton.edu>>
> Subject: Re: [chuck-users] => now
> Message-ID:
>    <AM0PR08MB389035F6190B1D2C897C097BA5180 at AM0PR08MB3890.eurprd08.prod.outlook.com<mailto:AM0PR08MB389035F6190B1D2C897C097BA5180 at AM0PR08MB3890.eurprd08.prod.outlook.com>>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Thanks again Mario,
>
> I have another question:
> Can you recommend a procedure to address individual samples of a wave-file you read into the SndBuf.
> I discovered a way to play a part of a wave file starting at a certain point using ".pos".
> I also wonder if there's a way to play it backwards (reverse).
>
> Cheers,
>
> herman
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/d16c734e/attachment-0001.html>


More information about the chuck-users mailing list