Csound Csound-dev Csound-tekno Search About

Re: Help Needed: loscil

Date2006-05-30 23:53
From"Art Hunkins"
SubjectRe: Help Needed: loscil
Thanks for the horn sample, Prent. I've been doing a lot of work with it
today, with loscil. And I can categorically state that loscil (and current
libsndfile) *is working with internal sample loop points* - (at least with
AIFF files, see below).

One interesting thing about running the current sndinfo on the horn sample
is that I get different info from you. I get:

util sndinfo:
C:\progra~1\csound5\bin\Horn.ff.F5.aif:
        srate 44100, monaural, 16 bit AIFF, 2.157 seconds
        (95114 sample frames)

No looping info at all, though indeed the info *is* there in the sample (as
indeed it loops without much prompting).

I interpret your mode data to mean that loop mode 1 (regular repeat) will
work, and also mode 0 (no looping). This is particularly interesting because
my conclusion is that *the only feature of loscil that doesn't work is
specifying 0 for the sustain loop mode*.

What this means is that for any sample with internal loop data, you can't
play it without looping. OTOH, you *can* play a sample that doesn't
containloop data one time - by either specifying -1 for sustain loop mode,
or omitting the parameter altogether.

I'd appreciate Istvan or another developer correcting this "disallowed
sustain mode = 0" problem - unless, that is, his previous upgrade of loscil
perhaps included this fix. It seems that with sustain mode = 0, loscil is
still looking for the loop data to follow (this is what the error message
says), and of course, it isn't there.

Unfortunately, I seemed unable to test an internally looped WAV. I tried
Audacity - importing the horn AIFF and exporting to WAV. I expect I lost
looping data in the conversion, as Audacity doesn't seem to deal with such
data. I know loscil handles WAV as well as AIFF format, but can't tell if
WAV loop info is handled correctly by loscil. Does anybody know?

(Incidentally, I've *assumed* that WAV samples routinely *do* contain loop
info, and that such info is not typically confined to AIFF. I'd appreciate
confirmation of this.)

So, I'd be happy is someone could send a *WAV* file that contains loop
information.

Thanks again, Prent.

Art Hunkins

----- Original Message ----- 
From: "Prent Rodgers" 
To: 
Sent: Tuesday, May 30, 2006 11:59 AM
Subject: Re: [Csnd] Help Needed: loscil


> Attached is a French Horn sample containing looping data. If someone is
> looking at loscil, it would be nice if the pitch correction information
> buried in the .aiff was used, or documented that it is ignored. This is
> not very important, though.
>
> Here's what sndinfo says about the French Horn sample. I don't know why
> it says "no looping", even though the next line says "looping with modes
> 1,0". Curious.
>
> Horn.ff.D#5.aif: AIFF, 98685  samples, no looping
>          AIFF soundfile, looping with modes 1, 0
>          srate 44100, monaural, 16 bit shorts, 2.24 seconds
>          headersiz 54, datasiz 197370 (98685 sample frames)
>
> I've been using loscil for the past 8 years and have worked around all
> the issues I encountered. I now have a test in my orchestra to check,
> through a table lookup, if a sample is looping or not, and invoke a
> different form of loscil based on the answer. I also look up if it is a
> mono or stereo sample. Another table applies pitch correction, for each
> sample. At one point I applied a time correction to accommodate sound
> startup delays, via a table of values.
>
> Prent Rodgers
>
>
> Art Hunkins wrote:
> > I'd really like to be certain loscil is not working correctly with
samples
> > than include their own looping info. Does anyone know of a sample in the
> > distribution that includes looping information?
> >
> > Or could someone send me such a sample so I can test it with loscil?
> > (Perhaps, OTOH, someone has already tested this and can report whether
this
> > feature works with the above loscil code or not.)
> >
> > TIA, and thanks again, Istvan.
> >
> > Art Hunkins
> >
> > ----- Original Message ----- 
>
> -- 
> Music that's "Fake but Accurate"!
> Web page: http://prodgers13.home.comcast.net
> Podcast: http://podcast1024.libsyn.com
> Another Podcast: http://BumperMusic.blogspot.com
> Music: http://www.soundclick.com/PrentRodgers
>

Date2006-05-31 00:47
FromErik de Castro Lopo
SubjectRe: Help Needed: loscil
Art Hunkins wrote:

> One interesting thing about running the current sndinfo on the horn sample
> is that I get different info from you. I get:
> 
> util sndinfo:
> C:\progra~1\csound5\bin\Horn.ff.F5.aif:
>         srate 44100, monaural, 16 bit AIFF, 2.157 seconds
>         (95114 sample frames)
> 
> No looping info at all, though indeed the info *is* there in the sample (as
> indeed it loops without much prompting).

You might want to try the sndfile-info program which is distributed as
part of libsndfile. Here's what it says about Prent's horn sample:

    ========================================
    File : Horn.ff.F5.aif
    Length : 190372
    FORM : 190364
     AIFF
     COMM : 18
      Sample Rate : 44100
      Frames      : 95114
      Channels    : 1
      Sample Size : 16
      Encoding    : NONE
     MARK : 34
      Count : 2
       Mark ID  : 1
       Position : 61440
       Name     : beg loop
       Mark ID  : 2
       Position : 75338
       Name     : end loop
     INST : 20
      Base Note : 65
      Detune    : 8
      Low  Note : 0
      High Note : 127
      Low  Vel. : 0
      High Vel. : 127
      Gain (dB) : 0
      Sustain
       mode  : 801 => forward
       begin : 1
       end   : 2
      Release
       mode  : 801 => forward
       begin : 1
       end   : 2
     SSND : 190236
      Offset     : 0
      Block Size : 0
     NAME : Horn.ff.F5
    
    ----------------------------------------
    Sample Rate : 44100
    Frames      : 95114
    Channels    : 1
    Format      : 0x00020002
    Sections    : 1
    Seekable    : TRUE
    Duration    : 00:00:02.156
    Signal Max  : 12042 (-8.70 dB)



> Unfortunately, I seemed unable to test an internally looped WAV. I tried
> Audacity - importing the horn AIFF and exporting to WAV.

Audacity is unlikely to be able to do this because 1) Audacity has its
own internal version of libsndfile which is usually a couple of releases
behind my own 2) this stuff is recent 3) the instrument loop stuff hasn't
been tested thoroughly enough yet.

As part of libsndfile, there is another program called sndfile-convert.
The version of that program in this pre-release:

    http://www.mega-nerd.com/tmp/libsndfile-1.0.17pre5.tar.gz
	
has the first pass at code to convert looping information when its
present.

> (Incidentally, I've *assumed* that WAV samples routinely *do* contain loop
> info, and that such info is not typically confined to AIFF.

Yes, WAV files can carry looping info. The format is very different from
AIFF ; WAV actually seems to be able to do a superset of what AIFF can do.

> So, I'd be happy is someone could send a *WAV* file that contains loop
> information.

Try this one:

    http://www.mega-nerd.com/tmp/DynoA3.wav

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"The beauty of religious mania is that it has the power to
explain everything. Once God (or Satan) is accepted as the first
cause of everything which happens in the mortal world, nothing
is left to chance...logic can be happily tossed out the window."
- Stephen King