Csound Csound-dev Csound-tekno Search About

[Cs-dev] [OT] Floats limit when converting to int

Date2009-07-15 00:35
FromAndres Cabrera
Subject[Cs-dev] [OT] Floats limit when converting to int
Hi,

What's the best way to limit the output of floats when saving to an
int soundfile? If nothing is done, the float values are wrapped around
producing nasty distortion. Naturally an if can be used but is there a
more efficient way?

Cheers,
Andrés

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-07-15 01:06
FromErik de Castro Lopo
SubjectRe: [Cs-dev] [OT] Floats limit when converting to int
Andres Cabrera wrote:

> Hi,
> 
> What's the best way to limit the output of floats when saving to an
> int soundfile? If nothing is done, the float values are wrapped around
> producing nasty distortion. Naturally an if can be used but is there a
> more efficient way?

If you are using libsndfile then it can do the limiting for you.

See:

    http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_CLIPPING


Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-07-15 14:17
FromAndres Cabrera
SubjectRe: [Cs-dev] [OT] Floats limit when converting to int
Nice thanks. Of course I'm using libsndfile =).

Cheers,
Andrés

On Tue, Jul 14, 2009 at 7:06 PM, Erik de Castro
Lopo wrote:
> Andres Cabrera wrote:
>
>> Hi,
>>
>> What's the best way to limit the output of floats when saving to an
>> int soundfile? If nothing is done, the float values are wrapped around
>> producing nasty distortion. Naturally an if can be used but is there a
>> more efficient way?
>
> If you are using libsndfile then it can do the limiting for you.
>
> See:
>
>    http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_CLIPPING
>
>
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 


Andrés

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net