Csound Csound-dev Csound-tekno Search About

[Cs-dev] Tutorial 106

Date2005-10-17 11:27
Fromjpff@cs.bath.ac.uk
Subject[Cs-dev] Tutorial 106
When I attempt to run 106.orc/sco from Chapter 1 of the book on CS5 it
gives errors -- No legal base frequency and loscil sustain defers to
non-looping source.  The sound is quiet and very short.  Has something
broken loscil or is libsndfile failing to handle loop points?
==John ffitch


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-17 13:24
FromIstvan Varga
SubjectRe: [Cs-dev] Tutorial 106
jpff@cs.bath.ac.uk wrote:

> When I attempt to run 106.orc/sco from Chapter 1 of the book on CS5 it
> gives errors -- No legal base frequency and loscil sustain defers to
> non-looping source.  The sound is quiet and very short.  Has something
> broken loscil or is libsndfile failing to handle loop points?

There is still no usable support for loop points in libsndfile,
and as a result they do not work in GEN01/loscil either. As of
now, libsndfile-1.0.12 has the following structure that can be
read from files with the apparently undocumented SFC_GET_LOOP_INFO
command:

typedef struct
{
         short   time_sig_num ;  /* any positive integer    >0  */
         short   time_sig_den ;  /* any positive power of 2 >0  */
         int     loop_mode ;     /* see SF_LOOP enum            */

         int     num_beats ;     /* this is NOT the amount of quarter notes !!!*/
                                               /* a full bar of 4/4 is 4 beats */
                                               /* a full bar of 7/8 is 7 beats */

         float   bpm ;           /* suggestion, as it can be calculated using other fields:*/
                                 /* file's lenght, file's sampleRate and our time_sig_den*/
                                 /* -> bpms are always the amount of _quarter notes_ per minute */

         int     root_key ;      /* MIDI note, or -1 for None */
         int     future [6] ;
} SF_LOOP_INFO ;

Note that it has no information about loop points at all (which
alone makes it useless), and the base frequency is specified in
MIDI notes as an integer - this is very limited. Also, there is
no information about amplitude scale. I assume this structure is
for tracks of recorded music (hence the parameters like tempo and
time signature), rather than loscil-like instruments.

There is also this structure that could be used by the also
undocumented SFC_GET_INSTRUMENT and SFC_SET_INSTRUMENT commands,
and this is exactly what we need. The bad thing is that it is
completely unimplemented - there is apparently no code for it
in the sources at all, even though the structure definition and
command names were already there in version 1.0.11.

typedef struct
{       int basenote ;
         int gain ;
         int     sustain_mode ;
         int sustain_start, sustain_end ;
         int release_mode ;
         int release_start, reslease_end ;
} SF_INSTRUMENT ;

So, in short, loop points for GEN01 and loscil are still not
possible with libsndfile. It is quite possible, though, that
loscil has bugs that are not related to looping.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-17 13:40
FromIstvan Varga
SubjectRe: [Cs-dev] Tutorial 106
Istvan Varga wrote:

> typedef struct
> {       int basenote ;
>         int gain ;
>         int     sustain_mode ;
>         int sustain_start, sustain_end ;
>         int release_mode ;
>         int release_start, reslease_end ;
> } SF_INSTRUMENT ;

By the way, this is still not quite right (apart from the fact
of being unimplemented), given that all values are limited to be
integers. Having at least the base frequency and gain (I assume
the latter would only make sense as a signed decibel value if it
is of type int) as floats would definitely be useful, but
fractional loop points could also be of some use.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-18 09:04
Fromjpff@codemist.co.uk
SubjectRe: [Cs-dev] Tutorial 106
I rather think there are errors in this message.  For example the AIFF
code we have in cs4 does show that AIFF requires the basenote as a
MIDI number and is specified as a char.  The structure just does not
have a base note in Hz.  We just have to work with that.

==John ffitch


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-18 09:44
FromIstvan Varga
SubjectRe: [Cs-dev] Tutorial 106
jpff@codemist.co.uk wrote:

> I rather think there are errors in this message.  For example the AIFF
> code we have in cs4 does show that AIFF requires the basenote as a
> MIDI number and is specified as a char.  The structure just does not
> have a base note in Hz.  We just have to work with that.

Well, we could work with SFC_GET_INSTRUMENT, but it is not implemented
yet, and SFC_GET_LOOP_INFO does not provide information about loop points,
so it is not usable. You may want to mail Erik de Castro Lopo to implement
SFC_GET_INSTRUMENT in libsndfile-1.0.13, possibly with changing the
SF_INSTRUMENT structure so that members other than loop types are of
some floating point type.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-18 10:40
Fromjpff@codemist.co.uk
SubjectRe: [Cs-dev] Tutorial 106
>>>>> "Istvan" == Istvan Varga  writes:

 Istvan> Well, we could work with SFC_GET_INSTRUMENT, but it is not implemented
 Istvan> yet, and SFC_GET_LOOP_INFO does not provide information about loop points,
 Istvan> so it is not usable. You may want to mail Erik de Castro Lopo to implement
 Istvan> SFC_GET_INSTRUMENT in libsndfile-1.0.13, possibly with changing the
 Istvan> SF_INSTRUMENT structure so that members other than loop types are of
 Istvan> some floating point type.

I have already got a reply from him (previous message to the one to
which I am replying).  He says inter alia

>> I can assure that it is unlikely to have ever worked better than it does
>> now. In fact, I doubt if it has ever actually worked.
>> 
>> The SF_LOOP_INFO struct was added to facilitate the development of
>> this feature and then the guy who offered to do it never carried through.
>> 
>> As someone who has never used the loop information in a sound file and
>> has no immediate need to do so, I think I am the worst possible person
>> to define this interface. However, it seems that amongst the Csound
>> development people there are at least a few individuals who know what
>> they want. My suggestion is that they join the libsndfile-devel mailing
>> list :
>> 
>>     http://www.mega-nerd.com/libsndfile/lists.html
>> 
>> and help define and implement this feature. With enough input I could
>> this working and have a new release of libsndfile out within a matter of
>> weeks.

Like Erik I have never used loop points but I suppose I have stared at
the code.  Surely there must be a better option than me.

==John ffitch


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net