Re: [Csnd] Re: normalizing audio files
Date | 2012-12-18 16:05 |
From | michael.gogins@gmail.com |
Subject | Re: [Csnd] Re: normalizing audio files |
Attachments | None None |
Date | 2012-12-18 17:39 |
From | Richard Dobson |
Subject | Re: [Csnd] Re: normalizing audio files |
Long long ago... I added support for the PEAK chunk to Csound, initially for all WAVE and AIFF formats. I think it subsequently got watered down a bit, such that it is now only included when writing a floats file, even though it is entirely relevant to integer files too. the idea then was that when reading a file into Csound, it would read the PEAK chunk if found and automatically rescale anything over-range (of course that will only be the case for a floats file). If the original conception can be restored, all WAVE files (for example) written by Csound would contain the PEAK chunk, and then a simple opcode (such as an extension/adaptation of "filepeak") can read the per-channel values (and frame positions) and take action accordingly. (Needless to say, all the programs in the CDP toolkit write and read the PEAK chunk, and the play programs also perform the automatic rescaling of over-range files.) Richard Dobson On 18/12/2012 16:05, michael.gogins@gmail.com wrote: > Use the soundfile opcodes and loop through the whole soundfile to find > the maximum amplitude. Saveitina global variable. Then go back to the > start of the file and again use the soundfile opcodes to rescale the > soundfile and either rewrite the original file or write the rescaled > audio to a new file.do all this in the orchestra header, you don't need > an instr if you are moving back and forth in time. I haven't tried this > myself bit it should work. > .. |
Date | 2012-12-18 17:57 |
From | Richard Dobson |
Subject | Re: [Csnd] Re: normalizing audio files |
It is easy to forget what one has tampered with 11 years back; I just checked the sources, and it looks like "filepeak" does read the PEAK chunk for all files via libsndfile if a recent enough version, so at least when reading Csound-generated floats files (or CDP-generated files:-), the necessary elements are in place. Richard Dobson On 18/12/2012 17:39, Richard Dobson wrote: ... > > If the original conception can be restored, all WAVE files (for example) > written by Csound would contain the PEAK chunk, and then a simple opcode > (such as an extension/adaptation of "filepeak") can read the per-channel > values (and frame positions) and take action accordingly. > > (Needless to say, all the programs in the CDP toolkit write and read the > PEAK chunk, and the play programs also perform the automatic rescaling > of over-range files.) > |
Date | 2012-12-18 21:02 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Csnd] Re: normalizing audio files |
> Long long ago... I added support for the PEAK chunk to Csound, initially > for all WAVE and AIFF formats. I think it subsequently got watered down > a bit, such that it is now only included when writing a floats file, > even though it is entirely relevant to integer files too. the idea then > was that when reading a file into Csound, it would read the PEAK chunk > if found and automatically rescale anything over-range (of course that > will only be the case for a floats file). > > If the original conception can be restored, all WAVE files (for example) > written by Csound would contain the PEAK chunk, and then a simple opcode > (such as an extension/adaptation of "filepeak") can read the per-channel > values (and frame positions) and take action accordingly. > > (Needless to say, all the programs in the CDP toolkit write and read the > PEAK chunk, and the play programs also perform the automatic rescaling > of over-range files.) > > Richard Dobson Peak chunks are written if requested |
Date | 2012-12-18 22:13 |
From | Richard Dobson |
Subject | Re: [Csnd] Re: normalizing audio files |
On 18/12/2012 21:02, jpff@cs.bath.ac.uk wrote: .. > > Peak chunks are written if requested > I am looking at v5.17, and it shows the -K flag for "Do not generate PEAK chunk"; but nothing specifically to request it. We need PEAK for all formats, not just floats. It looks like this is an unintended consequence of the switch to libsndfile, as Eric has understood it to be valid only in floating point files, which is not the case. Richard Dobson |
Date | 2012-12-18 23:29 |
From | Richard Dobson |
Subject | Re: [Csnd] Re: normalizing audio files |
On 18/12/2012 21:02, jpff@cs.bath.ac.uk wrote: .. > Peak chunks are written if requested > Indeed. The relevant doc page for libsndfile is here: http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_ADD_PEAK_CHUNK Eric suggests this should be enough to add a PEAK chunk to PCM files. Not something I can do myself; I am way behind the curve on modifying Csound code these days! Unless it has changed since Csound v5.17, we have a -K flag to turn off use of PEAK, but not a flag specifically to request it. I think that is the right way around; there can now be very little software these days which can't cope with added header chunks. Richard Dobson |
Date | 2012-12-19 01:14 |
From | Adam Puckett |
Subject | Re: [Csnd] Re: normalizing audio files |
What's CDP and what is the loudness war? On 12/18/12, Richard Dobson |
Date | 2012-12-19 01:20 |
From | peiman khosravi |
Subject | Re: [Csnd] Re: normalizing audio files |
Composers Desktop Project: http://www.composersdesktop.com Wishart has described his approach to sound composition in Audible Design (http://www.trevorwishart.co.uk/publ_bks.html#AUD) - a must read for anyone interested in sound.
P
On 19 December 2012 01:14, Adam Puckett <adotsdothmusic@gmail.com> wrote: What's CDP and what is the loudness war? |
Date | 2012-12-19 01:32 |
From | Justin Smith |
Subject | Re: [Csnd] Re: normalizing audio files |
http://en.wikipedia.org/wiki/Loudness_war On Tue, Dec 18, 2012 at 5:20 PM, peiman khosravi <peimankhosravi@gmail.com> wrote: Composers Desktop Project: http://www.composersdesktop.com |