Csound Csound-dev Csound-tekno Search About

Re: Help Needed: loscil

Date2006-05-28 23:18
From"Art Hunkins"
SubjectRe: Help Needed: loscil
I've finally gotten loscil to work with looping - though I never determined
whether or not my samples had designated loop points or not. (At any rate,
loscil does not seem to respond to such loop points.)

The following code works to loop an entire stereo sample (f1) from the
beginning:
a1, a2  loscil 10000, 1, 1, 1, 1, 0, ftlen(1)*.5

The following (with nsamp in place of ftlen, as Andres suggested) does not,
though I think it should:
a1, a2  loscil 10000, 1, 1, 1, 1, 0, nsamp(1)

The problem seems to be that ftlen can deal with a deferred-size table,
whereas nsamp cannot. The latter always generates this error:

INIT ERROR in instr 1: deferred-size ftable 1.000000 illegal here
#i1 nsamp.i 1
INIT ERROR in instr 1: illegal sustain loop data
a1 a2 loscil 10000 1 1 1 1 0 #i1 -1 0 0
   B  1.000 - note deleted.  i1 had 2 init errors

As a result I'd like to request two code changes (Istvan, or anyone else
willing/interested):

1) Get nsamp to work with deferred-size ftables;

2) When looping is requested in loscil (and loscil3), and no looping data is
specified in the opcode, default the sustain loop to the length of the
entire sample. Example (that works the same as the above code):
a1, a2  loscil 10000, 1, 1, 1, 1
This is the default behavior Andres suggested below, and is what I'd expect
as well.

I assume that if there were internal sample looping data that the default
should be to the internal loop points rather than the entire sample.

Of course, this is in turn assuming that loscil is handling internal sample
loop points correctly. I should think, however, that the above code
refinements (which shouldn't break anything that I can tell) would
facilitate many basic looping applications (regardless of internal sample
loop points being recognized by loscil or not). It could also make simple
looping somewhat less complicated and confusing for the average user.

Comments are most welcome.

Art Hunkins

----- Original Message ----- 
From: "Andres Cabrera" 
To: "Art Hunkins" 
Sent: Saturday, May 27, 2006 6:49 PM
Subject: Re: [Csnd] Help Needed: loscil


Hi Art,
Audacity seems not to be able to generato loop points, but if no loop
points are specified, shouldn't loscil default to the whole length?

I think you might need to specify both loop points since csound seems to
think you want to loop between 0 and 0...

Does this work?

isamps = nsamp(1)
a1,a2  loscil kamp, 1, 1, 1, 1, 0, isamps

Cheers,
Andrés

On Sat, 2006-05-27 at 18:52 -0400, Art Hunkins wrote:
> Thanks for the suggestion, Andres.
>
> Using it, I still get a comparable error message:
>
> audio sr = 44100, stereo, reading both channels
> opening AIFF infile C:\My Documents\My Music\SEAMUS\Good\Seamus2norm.aiff
> INIT ERROR in instr 1: illegal sustain loop data
> a1 a2 loscil kamp 1 1 1 1 0 0 -1 0 0
>    B  0.000 - note deleted.  i1 had 1 init errors
>
> I wish I could be certain my sample has loop data in it; if it does, the
> above should certainly work. As I wasn't sure, I attempted the previous
> version.
>
> Does anyone know for sure whether Audacity adds loop information? I've
been
> looking around among other basic sample editors and see virtually no
> reference to loop points at all. This would seem to me to be a fairly
> desired feature!
>
> Art Hunkins
>
> ----- Original Message ----- 
> From: "Andres Cabrera" 
> To: "Art Hunkins" 
> Sent: Saturday, May 27, 2006 5:56 PM
> Subject: Re: [Csnd] Help Needed: loscil
>
>
> Hi Art,
>
> I think you need to do something like:
> a1,a2  loscil kamp, 1, 1, 1, 1
>
> (Change the 261.626 to 1 and remove the last '1')
> So that you play the loop at the original speed, otherwise your code
> plays the loop transposed more than 9 octaves down...
>
> Cheers,
> Andrés
>
>
>
>
> kfreq = ftlenOn Sat, 2006-05-27 at 18:00 -0400, Art Hunkins wrote:
> > I'm just starting to work with samples in Csound 5.02 beta, and am
having
> > trouble doing simple looping, i.e., repeating the entire sample. I
recall
> > some talk here about loop problems with loscil, but was not then
involved
> > with samples and so recall nothing specific.
> >
> > Here is the error output I'm getting (when rendering):
> >
> > opening AIFF infile C:\My Documents\My
Music\SEAMUS\Good\Seamus2norm.aiff
> > INIT ERROR in instr 1: illegal sustain loop data
> > a1 a2 loscil kamp 1 1 1 261.626 1 0 -1 0 0
> >    B  0.000 - note deleted.  i1 had 1 init errors
> >
> > My relevent orch code is:
> >
> > instr 1
> >
> > kamp   linseg 0, .01, 10000, p3 - .02, 10000, .01, 0
> > a1,a2  loscil kamp, 1, 1, 1, 261.626, 1
> >
> >    outs a1, a2
> >
> > endin
> >
> > The orchestra and sample are stereo. (The final 1 in loscil is to enable
> > ordinary looping. Without this loop flag, my orchestra works fine.)
> >
> > F1 is as follows:
> >
> > f 1 0 0 1 "C:\My Documents\My Music\SEAMUS\Good\Seamus2norm.aiff" 0 0 0
> >
> > which I believe to be correct (I tried with a .wav version of the sample
> as
> > well, and get the same result).
> >
> > My audio editor is Audacity, and I don't know whether I'm even setting
> loop
> > points correctly in there or not. I've selected the entire sample before
> > doing looped playback, and then exported to either .wav or .aiff. As
> > mentioned above, all I want to do is simply loop the entire sample.
> > Audacity's docs don't talk about loop points at all, even though
Audacity
> > itself loops fine. Do I need to change editors?
> >
> > I'd appreciate any help. I've the distinct feeling I'm missing something
> > really basic.
> >
> > Art Hunkins
> >
>

Date2006-05-29 15:00
FromIstvan Varga
SubjectRe: Help Needed: loscil
AttachmentsNone