Csound Csound-dev Csound-tekno Search About

[Csnd] accumulation of amplitudes

Date2011-08-10 16:12
FromRoger Kelly
Subject[Csnd] accumulation of amplitudes
What is the best way to control the accumulation of amplitudes in an orchestra when multiple score events happen at the same time?  In other words, how do I programmatically avoid distortion when multiple notes play?

Date2011-08-10 16:22
FromVictor Lazzarini
SubjectRe: [Csnd] accumulation of amplitudes
I think the best way is to give enough headroom. Any other method will  
involve some sort of compression that might not be musically advisable.

Victor
On 10 Aug 2011, at 16:12, Roger Kelly wrote:

> What is the best way to control the accumulation of amplitudes in an  
> orchestra when multiple score events happen at the same time?  In  
> other words, how do I programmatically avoid distortion when  
> multiple notes play?

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-08-10 17:58
FromMichael Gogins
SubjectRe: [Csnd] accumulation of amplitudes
Always render to a floating-point soundfile. Give yourself plenty of
headroom (this is not likely to create noise problems if you use the
floating-point format). 50 or 100 dB headroom is not too much. Then,
after rendering, use a script to automatically rescale the soundfile
to maximum amplitude -6 dbfs.

Hope this helps,
Mike

On Wed, Aug 10, 2011 at 11:22 AM, Victor Lazzarini
 wrote:
> I think the best way is to give enough headroom. Any other method will
> involve some sort of compression that might not be musically advisable.
>
> Victor
> On 10 Aug 2011, at 16:12, Roger Kelly wrote:
>
>> What is the best way to control the accumulation of amplitudes in an
>> orchestra when multiple score events happen at the same time?  In other
>> words, how do I programmatically avoid distortion when multiple notes play?
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-08-10 18:44
FromRoger Kelly
SubjectRe: [Csnd] accumulation of amplitudes
Great advice thanks.  So to rescale the sound file, would I multiply each of the samples by 32,767?


On Wed, Aug 10, 2011 at 11:58 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
Always render to a floating-point soundfile. Give yourself plenty of
headroom (this is not likely to create noise problems if you use the
floating-point format). 50 or 100 dB headroom is not too much. Then,
after rendering, use a script to automatically rescale the soundfile
to maximum amplitude -6 dbfs.

Hope this helps,
Mike

On Wed, Aug 10, 2011 at 11:22 AM, Victor Lazzarini
<Victor.Lazzarini@nuim.ie> wrote:
> I think the best way is to give enough headroom. Any other method will
> involve some sort of compression that might not be musically advisable.
>
> Victor
> On 10 Aug 2011, at 16:12, Roger Kelly wrote:
>
>> What is the best way to control the accumulation of amplitudes in an
>> orchestra when multiple score events happen at the same time?  In other
>> words, how do I programmatically avoid distortion when multiple notes play?
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>



--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-08-10 20:12
FromMichael Gogins
SubjectRe: [Csnd] accumulation of amplitudes
No, you would run a utility such as sox to rescale the file. You could
also use an editor such as Audacity. To rescale the file, the program
must read through the entire file to find the current maximum
amplitude, then determine the desired amplitude from your input, then
multiply each sample by a factor equal to the desired amplitude
divided by the current maximum amplitude, and of course save the
result.

I highly recommend sox. In my own work, I use a Lua script to run
Csound that ends up running sox on the output soundfile to not only
rescale it, but also translate it to different formats such as
CD-Audio tracks, MP3 files, and so on.

So, whenever I have rendered a piece that I like, I already have it at
the right amplitude, in all the formats I need to make a CD or post it
online.

Regards,
Mike

On Wed, Aug 10, 2011 at 1:44 PM, Roger Kelly  wrote:
> Great advice thanks.  So to rescale the sound file, would I multiply each of
> the samples by 32,767?
>
> On Wed, Aug 10, 2011 at 11:58 AM, Michael Gogins 
> wrote:
>>
>> Always render to a floating-point soundfile. Give yourself plenty of
>> headroom (this is not likely to create noise problems if you use the
>> floating-point format). 50 or 100 dB headroom is not too much. Then,
>> after rendering, use a script to automatically rescale the soundfile
>> to maximum amplitude -6 dbfs.
>>
>> Hope this helps,
>> Mike
>>
>> On Wed, Aug 10, 2011 at 11:22 AM, Victor Lazzarini
>>  wrote:
>> > I think the best way is to give enough headroom. Any other method will
>> > involve some sort of compression that might not be musically advisable.
>> >
>> > Victor
>> > On 10 Aug 2011, at 16:12, Roger Kelly wrote:
>> >
>> >> What is the best way to control the accumulation of amplitudes in an
>> >> orchestra when multiple score events happen at the same time?  In other
>> >> words, how do I programmatically avoid distortion when multiple notes
>> >> play?
>> >
>> > Dr Victor Lazzarini
>> > Senior Lecturer
>> > Dept. of Music
>> > NUI Maynooth Ireland
>> > tel.: +353 1 708 3545
>> > Victor dot Lazzarini AT nuim dot ie
>> >
>> >
>> >
>> >
>> >
>> > Send bugs reports to the Sourceforge bug tracker
>> >           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> > Discussions of bugs and features can be posted here
>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> > csound"
>> >
>> >
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-08-10 20:22
FromJacob Joaquin
SubjectRe: [Csnd] accumulation of amplitudes
Another method is to change 0dbfs when you're ready to render the
final version. There's a writeup here on how to do it:

http://codehop.com/normalize-your-render/


You could also create a macro definition for a master gain setting
that you multiply at every output:

# define MASTER_GAIN # 0.3337 #
...
outs aleft * $MASTER_GAIN, aright * $MASTER_GAIN  ; do this for every output


And finally, instead of using the out(s) opcode in each instrument,
you can graph all your instruments to an instrument designed for the
sole purpose of sending the audio to the DAC or soundfile, and change
the gain there. I prefer the chn bus opcodes myself.

Best,
Jake
-- 
codehop.com | #code #art #music


On Wed, Aug 10, 2011 at 12:12 PM, Michael Gogins
 wrote:
> No, you would run a utility such as sox to rescale the file. You could
> also use an editor such as Audacity. To rescale the file, the program
> must read through the entire file to find the current maximum
> amplitude, then determine the desired amplitude from your input, then
> multiply each sample by a factor equal to the desired amplitude
> divided by the current maximum amplitude, and of course save the
> result.
>
> I highly recommend sox. In my own work, I use a Lua script to run
> Csound that ends up running sox on the output soundfile to not only
> rescale it, but also translate it to different formats such as
> CD-Audio tracks, MP3 files, and so on.
>
> So, whenever I have rendered a piece that I like, I already have it at
> the right amplitude, in all the formats I need to make a CD or post it
> online.
>
> Regards,
> Mike
>
> On Wed, Aug 10, 2011 at 1:44 PM, Roger Kelly  wrote:
>> Great advice thanks.  So to rescale the sound file, would I multiply each of
>> the samples by 32,767?
>>
>> On Wed, Aug 10, 2011 at 11:58 AM, Michael Gogins 
>> wrote:
>>>
>>> Always render to a floating-point soundfile. Give yourself plenty of
>>> headroom (this is not likely to create noise problems if you use the
>>> floating-point format). 50 or 100 dB headroom is not too much. Then,
>>> after rendering, use a script to automatically rescale the soundfile
>>> to maximum amplitude -6 dbfs.
>>>
>>> Hope this helps,
>>> Mike
>>>
>>> On Wed, Aug 10, 2011 at 11:22 AM, Victor Lazzarini
>>>  wrote:
>>> > I think the best way is to give enough headroom. Any other method will
>>> > involve some sort of compression that might not be musically advisable.
>>> >
>>> > Victor
>>> > On 10 Aug 2011, at 16:12, Roger Kelly wrote:
>>> >
>>> >> What is the best way to control the accumulation of amplitudes in an
>>> >> orchestra when multiple score events happen at the same time?  In other
>>> >> words, how do I programmatically avoid distortion when multiple notes
>>> >> play?
>>> >
>>> > Dr Victor Lazzarini
>>> > Senior Lecturer
>>> > Dept. of Music
>>> > NUI Maynooth Ireland
>>> > tel.: +353 1 708 3545
>>> > Victor dot Lazzarini AT nuim dot ie
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > Send bugs reports to the Sourceforge bug tracker
>>> >           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> > Discussions of bugs and features can be posted here
>>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> > csound"
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>
>
>
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-08-12 00:32
Frommatt ingalls
SubjectRe: [Csnd] accumulation of amplitudes
i usually do something like this:

nchnls = 1

instr 1

ipeak filepeak "myfloatingptsoundfile.wav"

print ipeak
if (ipeak == 0) then
	prints "WARNING: No peak data, cannot normalize!"
endif

iscale = (ipeak == 0 ? 1 : 0dbfs/ipeak)

aout1 in
out iscale*aout1

endin


On Aug 10, 2011, at 12:22 PM, Jacob Joaquin wrote:

> Another method is to change 0dbfs when you're ready to render the
> final version. There's a writeup here on how to do it:
> 
> http://codehop.com/normalize-your-render/
> 
> 
> You could also create a macro definition for a master gain setting
> that you multiply at every output:
> 
> # define MASTER_GAIN # 0.3337 #
> ...
> outs aleft * $MASTER_GAIN, aright * $MASTER_GAIN  ; do this for every output
> 
> 
> And finally, instead of using the out(s) opcode in each instrument,
> you can graph all your instruments to an instrument designed for the
> sole purpose of sending the audio to the DAC or soundfile, and change
> the gain there. I prefer the chn bus opcodes myself.
> 
> Best,
> Jake
> -- 
> codehop.com | #code #art #music
> 
> 
> On Wed, Aug 10, 2011 at 12:12 PM, Michael Gogins
>  wrote:
>> No, you would run a utility such as sox to rescale the file. You could
>> also use an editor such as Audacity. To rescale the file, the program
>> must read through the entire file to find the current maximum
>> amplitude, then determine the desired amplitude from your input, then
>> multiply each sample by a factor equal to the desired amplitude
>> divided by the current maximum amplitude, and of course save the
>> result.
>> 
>> I highly recommend sox. In my own work, I use a Lua script to run
>> Csound that ends up running sox on the output soundfile to not only
>> rescale it, but also translate it to different formats such as
>> CD-Audio tracks, MP3 files, and so on.
>> 
>> So, whenever I have rendered a piece that I like, I already have it at
>> the right amplitude, in all the formats I need to make a CD or post it
>> online.
>> 
>> Regards,
>> Mike
>> 
>> On Wed, Aug 10, 2011 at 1:44 PM, Roger Kelly  wrote:
>>> Great advice thanks.  So to rescale the sound file, would I multiply each of
>>> the samples by 32,767?
>>> 
>>> On Wed, Aug 10, 2011 at 11:58 AM, Michael Gogins 
>>> wrote:
>>>> 
>>>> Always render to a floating-point soundfile. Give yourself plenty of
>>>> headroom (this is not likely to create noise problems if you use the
>>>> floating-point format). 50 or 100 dB headroom is not too much. Then,
>>>> after rendering, use a script to automatically rescale the soundfile
>>>> to maximum amplitude -6 dbfs.
>>>> 
>>>> Hope this helps,
>>>> Mike
>>>> 
>>>> On Wed, Aug 10, 2011 at 11:22 AM, Victor Lazzarini
>>>>  wrote:
>>>>> I think the best way is to give enough headroom. Any other method will
>>>>> involve some sort of compression that might not be musically advisable.
>>>>> 
>>>>> Victor
>>>>> On 10 Aug 2011, at 16:12, Roger Kelly wrote:
>>>>> 
>>>>>> What is the best way to control the accumulation of amplitudes in an
>>>>>> orchestra when multiple score events happen at the same time?  In other
>>>>>> words, how do I programmatically avoid distortion when multiple notes
>>>>>> play?
>>>>> 
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Send bugs reports to the Sourceforge bug tracker
>>>>>           https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>>> Discussions of bugs and features can be posted here
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>>> csound"
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Michael Gogins
>>>> Irreducible Productions
>>>> http://www.michael-gogins.com
>>>> Michael dot Gogins at gmail dot com
>>>> 
>>>> 
>>>> Send bugs reports to the Sourceforge bug tracker
>>>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> Discussions of bugs and features can be posted here
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>> csound"
>>>> 
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>> 
>> 
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>> 
>> 
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"