From douglas at music.columbia.edu Mon Oct 1 00:00:01 2007 From: douglas at music.columbia.edu (douglas repetto) Date: Mon Oct 1 00:02:00 2007 Subject: [music-dsp] [admin] music-dsp FAQ Message-ID: <20071001040001.BA25F41DAD70@music.columbia.edu> Hi, Just a reminder that if you are new to the list you should read the music-dsp FAQ. It contains answers to both technical _and_ adminstrative questions that often come up on the list. If your question appears in the FAQ it is safe to assume that it has been discussed on the list many times in the past, and you should probably have a look through the list archives before posting your question to the list. http://music.columbia.edu/cmc/music-dsp/musicdspFAQ.html Also of interest to new and not-so-new list members: The music-dsp list archives http://music.columbia.edu/cmc/music-dsp/musicdsparchives.html The music-dsp source code archive http://www.musicdsp.org music-dsp books and reviews http://music.columbia.edu/cmc/music-dsp/dspbooks.html All this and more at: http://music.columbia.edu/cmc/music-dsp Hasta la pasta, douglas (this is an automated message sent out on the 1st and 15th of each month) From andylist at vellocet.com Mon Oct 1 09:16:22 2007 From: andylist at vellocet.com (Andrew Simper) Date: Mon Oct 1 09:19:17 2007 Subject: [music-dsp] test Message-ID: <4700F326.8040006@vellocet.com> Please don't bother replying to this, I'm just testing if my email now makes it through to the list since for some reason it hasn't been. Andrew From padawan12 at obiwannabe.co.uk Tue Oct 2 09:58:27 2007 From: padawan12 at obiwannabe.co.uk (Andy Farnell) Date: Mon Oct 1 21:40:55 2007 Subject: [music-dsp] Audio Mostly 2007 summary In-Reply-To: <20070912115301.82C9FEEA7A@ws6-1.us4.outblaze.com> References: <20070912115301.82C9FEEA7A@ws6-1.us4.outblaze.com> Message-ID: <20071002145827.17afff68.padawan12@obiwannabe.co.uk> I compiled a brief report on Audio Mostly 2007. Good conference with plenty of juicy bits on generative composition, spacialisation, and analysis. If anyone wants a particular paper PM me. The wavefield synthesis array kicks ass! http://www.obiwannabe.co.uk/html/news/news.html cheers, Andy From andylist at vellocet.com Tue Oct 2 04:16:14 2007 From: andylist at vellocet.com (Andrew Simper) Date: Tue Oct 2 04:16:48 2007 Subject: [music-dsp] Distortion algorithm query... Message-ID: <4701FE4E.30400@vellocet.com> Sorry for the late post, my original email never seemed to make it through so here it is again, ahh just realised it must have been to do with html posts not being allowed that thunderbird added: As Bogac pointed out there is no gain compensation in a regular guitar stomp box, but typically the drive is low pass filtered so for a guitar even though it sounds clean usually it's still driving quite a bit and only the harder strummed attacks get really distorted. For those that don't know, the exact shape of a diode clipper makes a huge difference to the sound, you cannot simply use a tanh or some other shape to get the same sound. I would suggest using spice to generate a table, or to use circuit theory to generate the implicit equations and solve them directly. A notes about the tube screamer circuit: The input and output transistors will add asymmetric distortion to the signal. The diodes will also be asymmetric, which effects the signal quite a lot and makes things growl more. From initial anaysis the feedback loop that contain the diodes also contain a fixed frequency high pass filter (around 720 Hz) and a variable frequency low pass filter from around 56KHz with no drive to around 5.6KHz with full drive. This low pass and high pass filter are unbuffered so interact with the twin diodes to change the drive shape. The gain of the is from around 20 dB to 40 dB. An approach I'm looking at to bandlimit hard clipping is the same approach I use to bandlimit oscillators. At the point of clipping you know the derivative is zero, and the output level is 1 (for the positive side). If you numerically compute the first and second order derivatives of the audio signal at the clipping point you can introduce a band limited corrective ramp and parabola which removes the first and second order derivative discontinuities introduced by the clipping. This means that hard clipping can be computed without oversampling, although some oversampling will be needed for other non-linearities in the model. Andrew Simper Bogac Topaktas wrote: > Hi Mike, > > >> What I am finding though is that to get a good guitar pedal style >> distortion, I need "drive" to be very high in-order to push it into >> the hard clipping section. >> > > It depends. If you are simulating a soft clipping overdrive pedal (i.e. Ibanez Tube Screamer) > you do not need to hard clip on the outset, see Figure 6 in the following article: > > http://www.bteaudio.com/articles/TSS/TSS.html > > If, on the other hand, you would like to simulate a high gain British style preamp/power amp > then you may need to clip harder. Just consider the following precautions before applying any nonlinearity > to your signal: > > http://ccrma.stanford.edu/~jos/pasp/Practical_Advice.html > > http://ccrma.stanford.edu/~jos/pasp/Nonlinear_Elements.html > > The amount of gain you apply before the clipping function will determine the amount of "drive" (i.e. the amount > of upper harmonics and sustain) you get. Both soft clipping functions and hard clipping functions generally do have > a maximum output value (Hard clippers have it by nature and soft clippers either have it by nature (like atan(x)) > or are followed by a supporting hard clipper). Therefore, just like in real amplifiers, users (usually) increase the > "master volume" while playing at "low drive" settings and decrease it while playing at "high drive" settings. > > There are three main parameters that affect the character of overdrive/distortion circuits/algorithms: > > 1) Hardness/softness of the clipping function. > > 2) Symmetry/asymmetry of the clipping function. > > 3) The amount of bass frequency harmonics allowed into the clipping function (i.e. the cutoff frequency of the > pre-clipping high pass filter). > > You need to consider all of them while simulating a particular hardware unit. > > bogac. > > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > From stober at iws.cs.uni-magdeburg.de Tue Oct 2 15:36:11 2007 From: stober at iws.cs.uni-magdeburg.de (Sebastian Stober) Date: Tue Oct 2 15:51:48 2007 Subject: [music-dsp] REMINDER: 2nd Int. Workshop on Learning the Semantics of Audio Signals (LSAS), Genova, December 5th, 2007 Message-ID: <47029DAB.1060800@iws.cs.uni-magdeburg.de> [Apologies if you receive multiple copies] This is a friendly reminder that the paper submission deadline for the 2nd Workshop on Learning the Semantics of Audio Signals (LSAS) is only a week away: *** OCTOBER 10th *** (next Wednesday). Authors can now submit their papers at: http://irgroup.cs.uni-magdeburg.de/lsas2007/conftool/ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2nd Workshop on Learning the Semantics of Audio Signals (LSAS) 2007 part of 2nd intl. conference on Semantics And digital Media Technology (SAMT) December 5th, 2007 Genova, Italy http://irgroup.cs.uni-magdeburg.de/lsas2007 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CALL FOR PAPERS The second international conference on Semantics And digital Media Technology (SAMT) will be held from December 5th-7th in Genova, Italy and targets to narrow the large disparity between the lowlevel descriptors that can be computed automatically from multimedia content and the richness and subjectivity of semantics in user queries and human interpretations of audiovisual media - The Semantic Gap. In the context of this conference the Workshop on Learning the Semantics of Audio Signals (LSAS) focuses especially on researchers that are working on semantics, description, representation and understanding of music with the goal to intensify the exchange of ideas between the different research communities involved, to provide an overview of current activities in this area and to point out connections between them. Therefore, the topics of interest include, but are not limited to the following aspects with respect to music information retrieval systems: - Audio signal processing and feature extraction - Content-based audio retrieval - Music perception, cognition, affect and emotions - Music structure analysis - Semantic audio description and analysis - Ontologies for music and sound description - Standards for audio content description - Machine learning methods for feature extraction and mapping - Personalization of music retrieval systems While our main focus is on music data, we are also interested on work related to other audio data such as speech. Important dates: - Deadline for paper submission: October 10th 2007 - Notification of acceptance: November 9th 2007 - Camera-ready paper submission: November 21st 2007 - Camera-ready workshop notes: November 28th 2007 For the full Call For Papers and further information on the workshop, please visit http://irgroup.cs.uni-magdeburg.de/lsas2007 Information on the SAMT 2007 conference can be found at http://samt2007.ge.imati.cnr.it/ From rossb-lists at audiomulch.com Wed Oct 3 03:12:15 2007 From: rossb-lists at audiomulch.com (Ross Bencina) Date: Wed Oct 3 03:12:28 2007 Subject: [music-dsp] Distortion algorithm query... References: <4701FE4E.30400@vellocet.com> Message-ID: <016c01c8058c$babce100$0201000a@rossmacbook> Andrew Simper wrote: > An approach I'm looking at to bandlimit hard clipping is the same approach > I use to bandlimit oscillators. At the point of clipping you know the > derivative is zero, and the output level is 1 (for the positive side). If > you numerically compute the first and second order derivatives of the > audio signal at the clipping point you can introduce a band limited > corrective ramp and parabola which removes the first and second order > derivative discontinuities introduced by the clipping. Hi Andy That sounds rather interesting, but I'm not sure I understand what the corrective ramp and parabola look like. So for example, in the ramp case, you know the gradient at the clipping boundary, so you could extend a ramp off to infinity to avoid a gradient discontinuity, but I guess that's not what you're doing... :-) so how does one construct a "bandlimited corrective ramp". Thanks! Ross. From bogac at bteaudio.com Wed Oct 3 12:13:50 2007 From: bogac at bteaudio.com (Bogac Topaktas) Date: Wed Oct 3 12:16:37 2007 Subject: [music-dsp] Distortion algorithm query... Message-ID: Ross Bencina wrote: > > > Andrew Simper wrote: > > An approach I'm looking at to bandlimit hard clipping is the same approach > > I use to bandlimit oscillators. At the point of clipping you know the > > derivative is zero, and the output level is 1 (for the positive side). If > > you numerically compute the first and second order derivatives of the > > audio signal at the clipping point you can introduce a band limited > > corrective ramp and parabola which removes the first and second order > > derivative discontinuities introduced by the clipping. > > Hi Andy > > That sounds rather interesting, but I'm not sure I understand what the > corrective ramp and parabola look like. > > So for example, in the ramp case, you know the gradient at the clipping > boundary, so you could extend a ramp off to infinity to avoid a gradient > discontinuity, but I guess that's not what you're doing... :-) so how does > one construct a "bandlimited corrective ramp". One elaborate method for the simulation of non-linear transfer functions which does not require a multi-rate system (i.e. upsampling before applying the non-linearity and then downsampling afterwards) is described in the following SOFTUBE AB ( www.softube.com ) patent: "A system and method for simulation of non-linear audio equipment" http://v3.espacenet.com/textdoc?DB=EPODOC&IDX=JP2005020740&F=0&RPN=EP1492081&DOC=cca34af198500bcb843bfab27a32d9a950&QPN=EP1492081 bogac. From andylist at vellocet.com Wed Oct 3 13:11:13 2007 From: andylist at vellocet.com (Andrew Simper) Date: Wed Oct 3 13:14:02 2007 Subject: [music-dsp] Distortion algorithm query... In-Reply-To: <016c01c8058c$babce100$0201000a@rossmacbook> References: <4701FE4E.30400@vellocet.com> <016c01c8058c$babce100$0201000a@rossmacbook> Message-ID: <4703CD31.2030700@vellocet.com> If you take the trivial step away from the band limited step and you are left with the corrective step, and you do the same thing for the ramp: you take the trivial ramp away from the band limited ramp, and you can do the same for higher orders as well. All the best, Andrew Ross Bencina wrote: > Andrew Simper wrote: >> An approach I'm looking at to bandlimit hard clipping is the same >> approach I use to bandlimit oscillators. At the point of clipping you >> know the derivative is zero, and the output level is 1 (for the >> positive side). If you numerically compute the first and second order >> derivatives of the audio signal at the clipping point you can >> introduce a band limited corrective ramp and parabola which removes >> the first and second order derivative discontinuities introduced by >> the clipping. > > Hi Andy > > That sounds rather interesting, but I'm not sure I understand what the > corrective ramp and parabola look like. > > So for example, in the ramp case, you know the gradient at the > clipping boundary, so you could extend a ramp off to infinity to avoid > a gradient discontinuity, but I guess that's not what you're doing... > :-) so how does one construct a "bandlimited corrective ramp". > > Thanks! > > Ross. > -- > dupswapdrop -- the music-dsp mailing list and website: subscription > info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp From rbj at audioimagination.com Wed Oct 3 16:10:30 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Wed Oct 3 16:14:07 2007 Subject: [music-dsp] Distortion algorithm query... Message-ID: <20071003201030.D97EC5481A2@ws6-6.us4.outblaze.com> > Ross Bencina wrote: > > Andrew Simper wrote: > >> An approach I'm looking at to bandlimit hard clipping is the same approach > >> I use to bandlimit oscillators. At the point of clipping you know the > >> derivative is zero, and the output level is 1 (for the positive side). If > >> you numerically compute the first and second order derivatives of the > >> audio signal at the clipping point you can introduce a band limited > >> corrective ramp and parabola which removes the first and second order > >> derivative discontinuities introduced by the clipping. ... > > > > That sounds rather interesting, but I'm not sure I understand what the > > corrective ramp and parabola look like. > > > > So for example, in the ramp case, you know the gradient at the clipping > > boundary, so you could extend a ramp off to infinity to avoid a gradient > > discontinuity, but I guess that's not what you're doing... :-) so how does > > one construct a "bandlimited corrective ramp". > > > > > If you take the trivial step away from the band limited step and you are left > with the corrective step, and you do the same thing for the ramp: you take > the trivial ramp away from the band limited ramp, and you can do the same for > higher orders as well. so now my question is, how much do you scale the corrective step (or corrective ramp)? based upon the last sample (or two) before clipping occurs? i cannot think of another basis for the scaling, but i also cannot see why such would be the case. if the clipping is modeled as an additive step and additive gated ramp, how do you know how big the hypothetical added step and ramp are? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From pfultz2 at yahoo.com Thu Oct 4 11:59:12 2007 From: pfultz2 at yahoo.com (paul Fultz) Date: Thu Oct 4 12:00:54 2007 Subject: [music-dsp] Waveshaping In-Reply-To: <20071003201030.D97EC5481A2@ws6-6.us4.outblaze.com> Message-ID: <52270.26657.qm@web90610.mail.mud.yahoo.com> i was wanting to implement some anti-aliased waveshaping, i first thought about upsampling and then downsampling, but i dont fully understand how to implement a good filter for decimation, so i thought about creating another way to do it without upsampling and i came up with this formula: where w(x) is the transfer function for waveshaping (w(x[n]) - w(x[n-1]))/2 + w((x[n] + x[n-1])/2) what do you think? when w(x) = ax then the formula returns a*x[n] but i dont know how well it smooths out aliasing maybe some people with better math skills than me can analyze it deeper, or maybe have a better formula. i know it doesnt get rid of all the aliasing, but maybe its moving in that direction. thanks, paul ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ From earlevel at earlevel.com Thu Oct 4 13:51:58 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Thu Oct 4 13:53:57 2007 Subject: [music-dsp] Waveshaping In-Reply-To: <52270.26657.qm@web90610.mail.mud.yahoo.com> References: <52270.26657.qm@web90610.mail.mud.yahoo.com> Message-ID: First, the part about not understanding how to do a good filter for decimation: The basics are simple--you just have to understand why, and you can make good choices. You have to restrict the frequency band to under half the new sample rate, then decimate. So, if you are downsampling by a factor of 2, and you have a source that is 96 kHz sample rate (giving you 48 kHz upper frequencies), you need to run it through a low-pass filter set to block everything above 24 kHz--then just throw away every other sample. (There are different kinds of filters, and different ways of optimizing, especially if the downsampling ratio is big enough to warrant multirate technique--I'm just talking fundamentals here.) Any frequencies that don't get removed in the filtering will reflect back into the audio band--just make sure the filter is good enough to get those reflections low enough in amplitude to satisfy your requirements, which will depend on the strength your original audio has in that area, the characteristics of the filter, and the quality required in the end result. For instance, if you know that your original audio will be down 40 dB at 24 kHz and dropping, you can get away with a simpler filter than if it has more powerful harmonics in that area. Now, in the rest of your post, you're trying to mitigate aliasing in the time domain--in a nutshell (looking at aliasing in the time domain), the position of sharp edges are the thing that suffers with lower sample rates. That is, you get a frequency-dependent ambiguity about where the sharp transition lands, when it would ideally land between samples. For instance, a square wave that's an exactly multiple of the sample period will sound fine, but one that's not will have a modulation of the edges that results in new frequencies-- aliasing. (Technically, you could say the one that's an exact multiple aliases as well, but the aliased frequencies all line up on harmonics and cancel each other.) So the smoother a wave, the less aliasing--this should be obvious, because you need higher frequencies to make sharp edges. This might help you make choices in sample rate conversion: http://www.earlevel.com/Digital%20Audio/RateConversion.html As noted on that page, make sure you read this first to lay the ground rules: http://www.earlevel.com/Digital%20Audio/Conversion.html On Oct 4, 2007, at 8:59 AM, paul Fultz wrote: > i was wanting to implement some anti-aliased > waveshaping, i first thought about upsampling and then > downsampling, but i dont fully understand how to > implement a good filter for decimation, so i thought > about creating another way to do it without upsampling > and i came up with this formula: > where w(x) is the transfer function for waveshaping > > (w(x[n]) - w(x[n-1]))/2 + w((x[n] + x[n-1])/2) > > > what do you think? when w(x) = ax then the formula > returns a*x[n] but i dont know how well it smooths out > aliasing maybe some people with better math skills > than me can analyze it deeper, or maybe have a better > formula. i know it doesnt get rid of all the aliasing, > but maybe its moving in that direction. > thanks, > paul From pfultz2 at yahoo.com Thu Oct 4 15:39:02 2007 From: pfultz2 at yahoo.com (paul Fultz) Date: Thu Oct 4 15:39:11 2007 Subject: [music-dsp] Waveshaping In-Reply-To: Message-ID: <271619.15255.qm@web90610.mail.mud.yahoo.com> thanks for the information, but what kind of filter do i use? most filters cause phase shifting and group delay. butterworth and bessel are too slow of cutoff, and chebyshev or elliptical cause ripples in the pass band. also if i use a polynomial waveshaper then i could filter for each term, right? for example if w(x) = x + x^2 + x^3, then i use a low pass at one-half of the nyquist frequency then calculate x^2 and i use a low pass at one-third of the nyquist frequency then calculate x^3 but use no filter for the first term x. also using linear interpolation and a simple 1-pole lowpass filter produces this formula: s1 = w(x[n]) s2 = w((x[n] + x[n-1])/2) a= 1 - e^(-pi) y[n] = a(s1 + s1) + (a^2)(y[n-1] - s2) + y[n-1] i think thats right, perhaps there is way to improve it. thanks, paul --- Nigel Redmon wrote: > First, the part about not understanding how to do a > good filter for > decimation: The basics are simple--you just have to > understand why, > and you can make good choices. You have to restrict > the frequency > band to under half the new sample rate, then > decimate. So, if you are > downsampling by a factor of 2, and you have a source > that is 96 kHz > sample rate (giving you 48 kHz upper frequencies), > you need to run it > through a low-pass filter set to block everything > above 24 kHz--then > just throw away every other sample. (There are > different kinds of > filters, and different ways of optimizing, > especially if the > downsampling ratio is big enough to warrant > multirate technique--I'm > just talking fundamentals here.) > > Any frequencies that don't get removed in the > filtering will reflect > back into the audio band--just make sure the filter > is good enough to > get those reflections low enough in amplitude to > satisfy your > requirements, which will depend on the strength your > original audio > has in that area, the characteristics of the filter, > and the quality > required in the end result. For instance, if you > know that your > original audio will be down 40 dB at 24 kHz and > dropping, you can get > away with a simpler filter than if it has more > powerful harmonics in > that area. > > Now, in the rest of your post, you're trying to > mitigate aliasing in > the time domain--in a nutshell (looking at aliasing > in the time > domain), the position of sharp edges are the thing > that suffers with > lower sample rates. That is, you get a > frequency-dependent ambiguity > about where the sharp transition lands, when it > would ideally land > between samples. For instance, a square wave that's > an exactly > multiple of the sample period will sound fine, but > one that's not > will have a modulation of the edges that results in > new frequencies-- > aliasing. (Technically, you could say the one that's > an exact > multiple aliases as well, but the aliased > frequencies all line up on > harmonics and cancel each other.) So the smoother a > wave, the less > aliasing--this should be obvious, because you need > higher frequencies > to make sharp edges. > > This might help you make choices in sample rate > conversion: > > http://www.earlevel.com/Digital%20Audio/RateConversion.html > > As noted on that page, make sure you read this first > to lay the > ground rules: > > http://www.earlevel.com/Digital%20Audio/Conversion.html > > > > On Oct 4, 2007, at 8:59 AM, paul Fultz wrote: > > i was wanting to implement some anti-aliased > > waveshaping, i first thought about upsampling and > then > > downsampling, but i dont fully understand how to > > implement a good filter for decimation, so i > thought > > about creating another way to do it without > upsampling > > and i came up with this formula: > > where w(x) is the transfer function for > waveshaping > > > > (w(x[n]) - w(x[n-1]))/2 + w((x[n] + x[n-1])/2) > > > > > > what do you think? when w(x) = ax then the formula > > returns a*x[n] but i dont know how well it smooths > out > > aliasing maybe some people with better math skills > > than me can analyze it deeper, or maybe have a > better > > formula. i know it doesnt get rid of all the > aliasing, > > but maybe its moving in that direction. > > thanks, > > paul > > -- > dupswapdrop -- the music-dsp mailing list and > website: > subscription info, FAQ, source code archive, list > archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > ____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 From bogac at bteaudio.com Thu Oct 4 18:04:09 2007 From: bogac at bteaudio.com (Bogac Topaktas) Date: Thu Oct 4 18:20:18 2007 Subject: [music-dsp] Waveshaping Message-ID: <9972e43221e474085c23e95d4603e6cc@bteaudio.com> Hi Paul, > thanks for the information, but what kind of filter do > i use? most filters cause phase shifting and group > delay. butterworth and bessel are too slow of cutoff, > and chebyshev or elliptical cause ripples in the pass > band. For achieving highest level of efficiency you may use either polyphase IIR or polyphase FIR filters. The pros(+) and cons(-) are: Polyphase IIR: Highest efficiency(+), lowest latency(+) and non-linear phase(-). Polyphase FIR: Slightly less efficiency (compared to polyphase IIR) (-), linear phase response(+) and latency (imposed by the linear phase requirement) (-). Online resources: i) Tutorials: Filter Design for Multirate Systems http://cnx.rice.edu/content/m12773/latest/ Multirate Filter Design - An Introduction http://www.mds.com/tech/filter/multirate_article.pdf Efficient Multirate Filter Structures http://cnx.org/content/m12800/latest/ Interpolation, Decimation, and Rate Changing by Integer Fractions http://cnx.rice.edu/content/m12801/latest/ Polyphase Interpolation http://cnx.rice.edu/content/m10431/latest/ Polyphase Decimation Filter http://cnx.rice.edu/content/m10433/latest/ Computational Savings of Polyphase Interpolation/Decimation http://cnx.rice.edu/content/m11008/latest/ WAVELETS, FILTER BANKS AND APPLICATIONS http://web.mit.edu/1.130/ ii) Polyphase IIR: HIIR : http://ldesoras.free.fr/src/hiir-1.00.zip http://ldesoras.free.fr/prod.html http://users.cscs.wmin.ac.uk/~krukowa/Poly.html http://users.cscs.wmin.ac.uk/~krukowa/ iii) Polyphase FIR: multirate_algs 1.3 : multirate_algs is a free and open collection of algorithms for implementing multirate Finite Impulse Response (FIR) filters in C. It is provided with ScopeFIR, which is a comprehensive FIR filter design program for Windows: http://www.iowegian.com/download/loadfir.htm > also if i use a polynomial waveshaper then i > could filter for each term, right? for example if w(x) > = x + x^2 + x^3, then i use a low pass at one-half of > the nyquist frequency then calculate x^2 and i use a > low pass at one-third of the nyquist frequency then > calculate x^3 but use no filter for the first term x. The oversampling factor is determined by the bandwidth expansion caused by the particular nonlinear waveshaping function that you utilize, see the practical advice given in: http://ccrma.stanford.edu/~jos/pasp/Practical_Advice.html Also the entire section on "Nonlinear Elements" provides all the essential theory: http://ccrma.stanford.edu/~jos/pasp/Nonlinear_Elements.html bogac. -----Original message----- From: paul Fultz pfultz2@yahoo.com Date: Thu, 04 Oct 2007 11:39:55 -0700 To: A discussion list for music-related DSP music-dsp@music.columbia.edu Subject: Re: [music-dsp] Waveshaping > thanks for the information, but what kind of filter do > i use? most filters cause phase shifting and group > delay. butterworth and bessel are too slow of cutoff, > and chebyshev or elliptical cause ripples in the pass > band. also if i use a polynomial waveshaper then i > could filter for each term, right? for example if w(x) > = x + x^2 + x^3, then i use a low pass at one-half of > the nyquist frequency then calculate x^2 and i use a > low pass at one-third of the nyquist frequency then > calculate x^3 but use no filter for the first term x. > also using linear interpolation and a simple 1-pole > lowpass filter produces this formula: > s1 = w(x[n]) > s2 = w((x[n] + x[n-1])/2) > a= 1 - e^(-pi) > y[n] = a(s1 + s1) + (a^2)(y[n-1] - s2) + y[n-1] > i think thats right, perhaps there is way to improve > it. thanks, > paul From aaron at hardwarehookups.com.au Fri Oct 5 03:44:02 2007 From: aaron at hardwarehookups.com.au (Aaron Oxford) Date: Fri Oct 5 03:46:38 2007 Subject: [music-dsp] Re: Waveshaping In-Reply-To: <20071004193922.0F876460D56D@music.columbia.edu> References: <20071004193922.0F876460D56D@music.columbia.edu> Message-ID: <20071005074631.A123247D1465@music.columbia.edu> Hi all, I am by no means an expert on oversampling, but FWIW I recently needed to upsample some stuff to between 4x and 16x from 'normal', and I found that a simple linear interpol upsample followed by a couple of passes through a bandpass (I wanted to remove DC also) worked well (and more importantly in my case was easy to write from first principles in C#). I didn't need to downsample but I'd imagine the same would work well in reverse - as someone else already suggested you can do the bandpass first and then just throw away samples, using the linear interpolation if you aren't doing a nice easy 'just throw away n-1of every n samples'-type downsample. I'm aware that there are far more advanced and accurate techniques, but again this worked well from first principles without very much effort. As for the technique you suggested yourself, I'm not sure if you're applying that equation to create intermediate samples or simply using that function to effectively create a smoothed waveform as your input (you're just applying the shaping function in the same step, right?). Either way, you'll probably find it works, but I've found that that particular 'filter' function is too severe for working with sound high in treble (e.g. a hihat sample) at 'normal' sample rates. Which brings me to my next point. This all depends on the sample rate you're working with to start with too - if you're working at 96 kHz or higher I'd say forget about aliasing - since only a discontinuous or 'extreme' shaping function would introduce aliasing to your already fairly highly 'oversampled' data (which we will blatantly assume is nicely bandlimited), and aliasing on the output can be dealt with by the output stages of whatever it is you're doing. Again, if you're working at 48 kHz or lower, I think that your filtering will be a bit too severe for certain sounds, so I'd suggest something a little less forceful, such as o[x] = f(0.9*i[x] + 0.1*o[x-1]). One of the smart people on this list might tell you what the low-pass cutoff and steepness of that transfer function is. :-D Anything more complex than that and you may as well be working out the coefficients for a 'proper' filter. Having said that I simply ripped off some 2p filter psuedo-code from this list's archive. :-) Hope this is helpful, Aaron. --------------------------------------------------------------------------------- Aaron Oxford - aaron+hardwarehookups .com .au Director, Innovative Computer Solutions (Aust) Pty. Ltd. 49 Maitland Rd, Mayfield, NSW 2304 Australia http://www.ic-solutions.com.au Developer, SourceForge project VioLet Composer http://sourceforge.net/projects/buzz-like From mdsp-erikd at mega-nerd.com Fri Oct 5 04:33:20 2007 From: mdsp-erikd at mega-nerd.com (Erik de Castro Lopo) Date: Fri Oct 5 04:35:20 2007 Subject: [music-dsp] Re: Waveshaping In-Reply-To: <20071005074631.A123247D1465@music.columbia.edu> References: <20071004193922.0F876460D56D@music.columbia.edu> <20071005074631.A123247D1465@music.columbia.edu> Message-ID: <20071005183320.3687da0d.mdsp-erikd@mega-nerd.com> Aaron Oxford wrote: > Hi all, > > I am by no means an expert on oversampling, but FWIW I recently > needed to upsample some stuff to between 4x and 16x from 'normal', > and I found that a simple linear interpol upsample followed by a > couple of passes through a bandpass (I wanted to remove DC also) > worked well (and more importantly in my case was easy to write from > first principles in C#). Please do not suggest linear interpolation without mention its rather severe limititions, in particular that the signal to noise ratio is signal dependant and appallingly bad under many normal situations. For instance, for upsampling a single sine wave from 44100Hz to 48000Hz result in the following SNRs: Sine freq SNR ========================== 333 Hz 146.0 dB 666 Hz 115.8 dB 1332 Hz 103.8 dB 2664 Hz 49.8 dB 5328 Hz 38.7 dB 10656 Hz 28.4 dB 21312 Hz 19.5 dB Signal to noise ratios worse than about 40db are unacceptable for most applications (ie only acceptable if you are *trying* to generate noisy signals). As you can see, linear interpolation worlk quite well when the maximum frequency component in the source signal is less than about 1/8 of the sample rate. > I didn't need to downsample but I'd imagine the same would work well > in reverse Please don't imagine. Measure. Its really not that hard. > As for the technique you suggested yourself, I'm not sure if you're > applying that equation to create intermediate samples or simply using > that function to effectively create a smoothed waveform as your input > (you're just applying the shaping function in the same step, right?). The original poster was talking about waveshaping synthesis: http://en.wikipedia.org/wiki/Waveshaper Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- C++ is a siren song. It *looks* like a HLL in which you ought to be able to write an application, but it really isn't." -- Alain Picard (comp.lang.lisp) From earlevel at earlevel.com Fri Oct 5 15:47:19 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Fri Oct 5 15:49:17 2007 Subject: [music-dsp] Waveshaping In-Reply-To: <9972e43221e474085c23e95d4603e6cc@bteaudio.com> References: <9972e43221e474085c23e95d4603e6cc@bteaudio.com> Message-ID: <6272EC9E-3616-47B2-9BE0-F6C120443BD3@earlevel.com> On Oct 4, 2007, at 3:04 PM, Bogac Topaktas wrote: > Polyphase FIR: Slightly less efficiency (compared to polyphase IIR) > (-), linear phase response(+) and latency (imposed by the linear > phase requirement) (-). Nice post--I just wanted to add that an FIR has linear phase if you *want* it to (that is, if it's symmetrical). From earlevel at earlevel.com Fri Oct 5 16:04:57 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Fri Oct 5 16:08:26 2007 Subject: [music-dsp] Re: Waveshaping In-Reply-To: <20071005074631.A123247D1465@music.columbia.edu> References: <20071004193922.0F876460D56D@music.columbia.edu> <20071005074631.A123247D1465@music.columbia.edu> Message-ID: <39EFC2D9-8FDE-4E80-880C-54B99450E464@earlevel.com> Linear interpolation is only a good choice if you're fairly oversampled to start with (that is, you don't have a lot of high frequency components. When upsampling by a factor of 4 or more, it's usually better to do it in multiple steps--you can use some tricks to gain a large advantage in efficiency. (You could even upsample with a high quality interpolator, then go to linear interpolation to go higher if you want and it meets your criteria.) As for the bandpass--it's more efficient to filter what you can at lower rates, so it would be best to block the DC first, then upsample, and put the effort into low-pass filters. As for "if you're working at 96 kHz or higher I'd say forget about aliasing"--you need to oversample by more than that for distortion algorithms (192 kHz is not enough either)--even if you source signal is heavily bandlimited (say, a guitar, even with the highs reduced). On Oct 5, 2007, at 12:44 AM, Aaron Oxford wrote: > Hi all, > > I am by no means an expert on oversampling, but FWIW I recently > needed to upsample some stuff to between 4x and 16x from 'normal', > and I found that a simple linear interpol upsample followed by a > couple of passes through a bandpass (I wanted to remove DC also) > worked well (and more importantly in my case was easy to write from > first principles in C#). > > I didn't need to downsample but I'd imagine the same would work > well in reverse - as someone else already suggested you can do the > bandpass first and then just throw away samples, using the linear > interpolation if you aren't doing a nice easy 'just throw away > n-1of every n samples'-type downsample. > > I'm aware that there are far more advanced and accurate techniques, > but again this worked well from first principles without very much > effort. > > As for the technique you suggested yourself, I'm not sure if you're > applying that equation to create intermediate samples or simply > using that function to effectively create a smoothed waveform as > your input (you're just applying the shaping function in the same > step, right?). Either way, you'll probably find it works, but I've > found that that particular 'filter' function is too severe for > working with sound high in treble (e.g. a hihat sample) at 'normal' > sample rates. > > Which brings me to my next point. This all depends on the sample > rate you're working with to start with too - if you're working at > 96 kHz or higher I'd say forget about aliasing - since only a > discontinuous or 'extreme' shaping function would introduce > aliasing to your already fairly highly 'oversampled' data (which we > will blatantly assume is nicely bandlimited), and aliasing on the > output can be dealt with by the output stages of whatever it is > you're doing. Again, if you're working at 48 kHz or lower, I think > that your filtering will be a bit too severe for certain sounds, so > I'd suggest something a little less forceful, such as o[x] = f(0.9*i > [x] + 0.1*o[x-1]). > > One of the smart people on this list might tell you what the low- > pass cutoff and steepness of that transfer function is. :-D > > Anything more complex than that and you may as well be working out > the coefficients for a 'proper' filter. Having said that I simply > ripped off some 2p filter psuedo-code from this list's archive. :-) > > Hope this is helpful, > > Aaron. > ---------------------------------------------------------------------- > ----------- > Aaron Oxford - aaron+hardwarehookups .com .au > Director, Innovative Computer Solutions (Aust) Pty. Ltd. > 49 Maitland Rd, Mayfield, NSW 2304 Australia > http://www.ic-solutions.com.au > Developer, SourceForge project VioLet Composer > http://sourceforge.net/projects/buzz-like From superbigio at yahoo.com Fri Oct 5 17:00:51 2007 From: superbigio at yahoo.com (Luigi Castelli) Date: Fri Oct 5 17:11:02 2007 Subject: [music-dsp] Cascaded biquad filter structures Message-ID: <192071.75191.qm@web34404.mail.mud.yahoo.com> Hi folks, I have a bank of cascaded biquad filters and they work very well so far. At this point I am looking to vectorize my code in order to use SSE instructions and speed things up a little bit. My question is: is it even possible to vectorize a cascaded structure ? Intuitively I would say no, given the fact that such a structure is in series by definition, but maybe there are some smart coding/mathematical techniques that I am not aware of. Comments anyone ? Thank you. - Luigi ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting From ebrombaugh at earthlink.net Fri Oct 5 17:38:06 2007 From: ebrombaugh at earthlink.net (Eric Brombaugh) Date: Fri Oct 5 17:39:58 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <192071.75191.qm@web34404.mail.mud.yahoo.com> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> Message-ID: <4706AEBE.1050502@earthlink.net> You can vectorize a cascade of biquads if you're willing to accept some transport delay - just insert pipelines between the stages to hold the previous results. A few years back I coded up an FIR and an IIR biquad in SSE. I got about 2x speed improvement in the FIR version over plain optimized GCC with floats, but the IIR implementation was about 70% slower in SSE than plain optimized GCC. My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was using vector operations to combine the adds & multiplies in one biquad. This may not be the most efficient way to do it. Perhaps recoding it for 4 simultaneous biquads would run faster. I lost interest in it though and haven't pursued it further. I'd be happy to share my source code though, and I'd be curious to learn your results if you try. Eric Luigi Castelli wrote: > Hi folks, > > I have a bank of cascaded biquad filters and they work very well so > far. > > At this point I am looking to vectorize my code in order to use SSE > instructions and speed things up a little bit. > > My question is: > is it even possible to vectorize a cascaded structure ? > Intuitively I would say no, given the fact that such a structure is in > series by definition, but maybe there are some smart > coding/mathematical techniques that I am not aware of. > > Comments anyone ? > > Thank you. > > - Luigi > > > ------------------------------------------------------------ > THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. > ------------------------------------------------------------ > > > > > ____________________________________________________________________________________ > Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. > http://smallbusiness.yahoo.com/webhosting > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > From laurent.de.soras.m1 at club-internet.fr Fri Oct 5 18:23:50 2007 From: laurent.de.soras.m1 at club-internet.fr (Laurent de Soras [Ohm Force]) Date: Fri Oct 5 18:22:30 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <192071.75191.qm@web34404.mail.mud.yahoo.com> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> Message-ID: <4706B976.7010603@club-internet.fr> Luigi Castelli wrote: > > is it even possible to vectorize a cascaded structure ? Two possibilities I know so far : 1. Decompose your filter into parallel sections. Check the paper "Decomposition Of IIR Transfer Functions Into Parallel Arbitrary-Order IIR Subfilters" I have not tried it, but I suspect it not to be that efficient. 2. Use a process-and-shift system. For each sample : - Shift the pipeline vector (it's not the filter state, but a vector containing inputs and outputs of each filter stage) - Copy your single input sample to the vector position 0. - Process the vector once. The vector positions correspond to each biquad. - Collect the sample at the vector position N-1, where N is your number of biquad sections. This is your filter output. This introduces a delay (N-1 samples), but you can cancel it with appropriate prologue and epilogue if you're doing block processing. -- Laurent de Soras | Ohm Force DSP developer & Software designer | Digital Audio Software http://ldesoras.free.fr | http://www.ohmforce.com From superbigio at yahoo.com Fri Oct 5 18:23:28 2007 From: superbigio at yahoo.com (Luigi Castelli) Date: Fri Oct 5 18:23:36 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <4706AEBE.1050502@earthlink.net> Message-ID: <95568.99025.qm@web34412.mail.mud.yahoo.com> I don't want to vectorize 1 single biquad structure. I know it could be done but - as your experiments confirm - it doesn't really work very well. I am interested in processing 4 biquad structures in parallel. In a bank of biquads in parallel the vectorization gives about a 3x speed up compared to scalar code. I am wondering if a similar optimization can be obtained even if the biquads are in series. What is discouraging to me is that in a cascaded structure you have to wait for the output of one biquad before being able to process the next, so apparently there's no way to process the filters in parallel. (i.e. vectorize them) Having said that, I would love to be proved wrong... - Luigi --- Eric Brombaugh wrote: > You can vectorize a cascade of biquads if you're willing to accept > some > transport delay - just insert pipelines between the stages to hold > the > previous results. > > A few years back I coded up an FIR and an IIR biquad in SSE. I got > about > 2x speed improvement in the FIR version over plain optimized GCC > with > floats, but the IIR implementation was about 70% slower in SSE than > plain optimized GCC. > > My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was > using vector operations to combine the adds & multiplies in one > biquad. > This may not be the most efficient way to do it. Perhaps recoding it > for > 4 simultaneous biquads would run faster. I lost interest in it though > > and haven't pursued it further. I'd be happy to share my source code > though, and I'd be curious to learn your results if you try. > > Eric > > Luigi Castelli wrote: > > Hi folks, > > > > I have a bank of cascaded biquad filters and they work very well so > > far. > > > > At this point I am looking to vectorize my code in order to use SSE > > instructions and speed things up a little bit. > > > > My question is: > > is it even possible to vectorize a cascaded structure ? > > Intuitively I would say no, given the fact that such a structure is > in > > series by definition, but maybe there are some smart > > coding/mathematical techniques that I am not aware of. > > > > Comments anyone ? > > > > Thank you. > > > > - Luigi > > > > > > ------------------------------------------------------------ > > THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT > AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY > UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. > IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL > AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL > MESSAGE. WITHOUT PREJUDICE UCC1-207. > > ------------------------------------------------------------ > > > > > > > > > > > ____________________________________________________________________________________ > > Building a website is a piece of cake. Yahoo! Small Business gives > you all the tools to get online. > > http://smallbusiness.yahoo.com/webhosting > > -- > > dupswapdrop -- the music-dsp mailing list and website: > > subscription info, FAQ, source code archive, list archive, book > reviews, dsp links > > http://music.columbia.edu/cmc/music-dsp > > http://music.columbia.edu/mailman/listinfo/music-dsp > > > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book > reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more! http://tv.yahoo.com/collections/3658 From mdsp at flak.clara.co.uk Fri Oct 5 19:04:00 2007 From: mdsp at flak.clara.co.uk (Chris Warwick) Date: Fri Oct 5 19:03:58 2007 Subject: [music-dsp] Cascaded biquad filter structures References: <95568.99025.qm@web34412.mail.mud.yahoo.com> Message-ID: <000d01c807a4$043a74f0$0100000a@bert> ----- Original Message ----- From: "Luigi Castelli" To: "A discussion list for music-related DSP" Sent: Friday, October 05, 2007 11:23 PM Subject: Re: [music-dsp] Cascaded biquad filter structures >I am wondering if a similar optimization can be obtained even if the >biquads are in series. What is discouraging to me is that in a cascaded >structure you have to wait for the output of one biquad before being >able to process the next, so apparently there's no way to process the >filters in parallel. (i.e. vectorize them) Having said that, I would >love to be proved wrong... You can put a one sample delay between each biquad. That will break the dependancy and allow them to be done in paralell. Asumming you can live with the extra delay. From rbj at audioimagination.com Fri Oct 5 19:20:40 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Fri Oct 5 19:25:01 2007 Subject: [music-dsp] Cascaded biquad filter structures Message-ID: <20071005232040.BD18916ECFD@ws6-8.us4.outblaze.com> "Luigi Castelli" writes: > > I am interested in processing 4 biquad structures in parallel. > In a bank of biquads in parallel the vectorization gives about a 3x > speed up compared to scalar code. > > I am wondering if a similar optimization can be obtained even if the > biquads are in series. What is discouraging to me is that in a cascaded > structure you have to wait for the output of one biquad before being > able to process the next, not if you're willing to put up with some pipeline delay. the output of the one biquad goes into a delay line at least as long as your vector length. the input of the next biquad comes from the output of that delay line. this delay line is actually two vectors and you ping-pong them at the process vector start time, swapping their roles between "output of one" and "input to next". i think they call this "double buffering". i dunno. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From lanceboyle at qwest.net Fri Oct 5 19:26:26 2007 From: lanceboyle at qwest.net (Jerry) Date: Fri Oct 5 19:26:32 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <192071.75191.qm@web34404.mail.mud.yahoo.com> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> Message-ID: One other responder mentioned this but I'm going to say it too, for emphasis. This is important and will solve all of your problems. Re-write your transfer function as a _sum_ of biquads instead of a product. Do this by applying a partial fraction expansion on your transfer function. You are still left with the flexibility of how you implement each resulting biquad. As I recall, the numerator of each section is first order, not second order. The outputs of all the sections are summed. You can implement each biquad in parallel with the others (which is what I think you mean by vectorizing). My reference is Oppenheim & Schafer, 1975, p. 153. I have done this and it works perfectly. Jerry On Oct 5, 2007, at 2:00 PM, Luigi Castelli wrote: > Hi folks, > > I have a bank of cascaded biquad filters and they work very well so > far. > > At this point I am looking to vectorize my code in order to use SSE > instructions and speed things up a little bit. > > My question is: > is it even possible to vectorize a cascaded structure ? > Intuitively I would say no, given the fact that such a structure is in > series by definition, but maybe there are some smart > coding/mathematical techniques that I am not aware of. > > Comments anyone ? > > Thank you. > From ianlewis at microsoft.com Fri Oct 5 19:38:40 2007 From: ianlewis at microsoft.com (Ian Lewis) Date: Fri Oct 5 19:38:51 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <192071.75191.qm@web34404.mail.mud.yahoo.com> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> Message-ID: Depends which SSE set you're targeting. The horizontal add (SSSE3) and dot product (SSE4) instructions can come in handy, depending on how you lay out your filter. I use two 4-element dot products per sample to implement RBJ's cookbook filters. I'd guess you could get that down to one per sample for a biquad. Even if you don't have horizontal instructions, you can take advantage of vector instructions by processing multiple channels at once. Ian -----Original Message----- From: music-dsp-bounces@music.columbia.edu [mailto:music-dsp-bounces@music.columbia.edu] On Behalf Of Luigi Castelli Sent: Friday, October 05, 2007 2:01 PM To: music-dsp@music.columbia.edu Subject: [music-dsp] Cascaded biquad filter structures Hi folks, I have a bank of cascaded biquad filters and they work very well so far. At this point I am looking to vectorize my code in order to use SSE instructions and speed things up a little bit. My question is: is it even possible to vectorize a cascaded structure ? Intuitively I would say no, given the fact that such a structure is in series by definition, but maybe there are some smart coding/mathematical techniques that I am not aware of. Comments anyone ? Thank you. - Luigi ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp From ianlewis at microsoft.com Fri Oct 5 19:46:18 2007 From: ianlewis at microsoft.com (Ian Lewis) Date: Fri Oct 5 19:46:31 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <4706AEBE.1050502@earthlink.net> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> <4706AEBE.1050502@earthlink.net> Message-ID: A few years back SSE didn't have horizontal operations. In my experience that makes the difference. But my experience is on the PowerPC, so YMMV. Ian -----Original Message----- From: music-dsp-bounces@music.columbia.edu [mailto:music-dsp-bounces@music.columbia.edu] On Behalf Of Eric Brombaugh Sent: Friday, October 05, 2007 2:38 PM To: A discussion list for music-related DSP Subject: Re: [music-dsp] Cascaded biquad filter structures You can vectorize a cascade of biquads if you're willing to accept some transport delay - just insert pipelines between the stages to hold the previous results. A few years back I coded up an FIR and an IIR biquad in SSE. I got about 2x speed improvement in the FIR version over plain optimized GCC with floats, but the IIR implementation was about 70% slower in SSE than plain optimized GCC. My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was using vector operations to combine the adds & multiplies in one biquad. This may not be the most efficient way to do it. Perhaps recoding it for 4 simultaneous biquads would run faster. I lost interest in it though and haven't pursued it further. I'd be happy to share my source code though, and I'd be curious to learn your results if you try. Eric Luigi Castelli wrote: > Hi folks, > > I have a bank of cascaded biquad filters and they work very well so > far. > > At this point I am looking to vectorize my code in order to use SSE > instructions and speed things up a little bit. > > My question is: > is it even possible to vectorize a cascaded structure ? > Intuitively I would say no, given the fact that such a structure is in > series by definition, but maybe there are some smart > coding/mathematical techniques that I am not aware of. > > Comments anyone ? > > Thank you. > > - Luigi > > > ------------------------------------------------------------ > THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. > ------------------------------------------------------------ > > > > > ____________________________________________________________________________________ > Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. > http://smallbusiness.yahoo.com/webhosting > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp From ebrombaugh at earthlink.net Fri Oct 5 20:00:14 2007 From: ebrombaugh at earthlink.net (Eric Brombaugh) Date: Fri Oct 5 20:02:07 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: References: <192071.75191.qm@web34404.mail.mud.yahoo.com> <4706AEBE.1050502@earthlink.net> Message-ID: <4706D00E.1030704@earthlink.net> That's interesting. I was just looking at the source again and it's basically load, shuffle, multiply & add operations. A dot product or MAC-type operation would be handy to reduce the number of instructions. I'm running an Athlon64 X2 with SSE3 now - I wonder if it supports the instructions you mentioned. Maybe it's time to revisit this project. I did vectorize the same filter for a Mac G4 w/ Altivec - I think that gave more of an improvement than the x86 version. Eric Ian Lewis wrote: > A few years back SSE didn't have horizontal operations. In my experience that makes the difference. But my experience is on the PowerPC, so YMMV. > Ian > > -----Original Message----- > From: music-dsp-bounces@music.columbia.edu [mailto:music-dsp-bounces@music.columbia.edu] On Behalf Of Eric Brombaugh > Sent: Friday, October 05, 2007 2:38 PM > To: A discussion list for music-related DSP > Subject: Re: [music-dsp] Cascaded biquad filter structures > > You can vectorize a cascade of biquads if you're willing to accept some > transport delay - just insert pipelines between the stages to hold the > previous results. > > A few years back I coded up an FIR and an IIR biquad in SSE. I got about > 2x speed improvement in the FIR version over plain optimized GCC with > floats, but the IIR implementation was about 70% slower in SSE than > plain optimized GCC. > > My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was > using vector operations to combine the adds & multiplies in one biquad. > This may not be the most efficient way to do it. Perhaps recoding it for > 4 simultaneous biquads would run faster. I lost interest in it though > and haven't pursued it further. I'd be happy to share my source code > though, and I'd be curious to learn your results if you try. > > Eric > > Luigi Castelli wrote: >> Hi folks, >> >> I have a bank of cascaded biquad filters and they work very well so >> far. >> >> At this point I am looking to vectorize my code in order to use SSE >> instructions and speed things up a little bit. >> >> My question is: >> is it even possible to vectorize a cascaded structure ? >> Intuitively I would say no, given the fact that such a structure is in >> series by definition, but maybe there are some smart >> coding/mathematical techniques that I am not aware of. >> >> Comments anyone ? >> >> Thank you. >> >> - Luigi >> >> >> ------------------------------------------------------------ >> THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. >> ------------------------------------------------------------ >> >> >> >> >> ____________________________________________________________________________________ >> Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. >> http://smallbusiness.yahoo.com/webhosting >> -- >> dupswapdrop -- the music-dsp mailing list and website: >> subscription info, FAQ, source code archive, list archive, book reviews, dsp links >> http://music.columbia.edu/cmc/music-dsp >> http://music.columbia.edu/mailman/listinfo/music-dsp >> > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > From ianlewis at microsoft.com Fri Oct 5 20:16:21 2007 From: ianlewis at microsoft.com (Ian Lewis) Date: Fri Oct 5 20:16:37 2007 Subject: [music-dsp] Cascaded biquad filter structures In-Reply-To: <4706D00E.1030704@earthlink.net> References: <192071.75191.qm@web34404.mail.mud.yahoo.com> <4706AEBE.1050502@earthlink.net> <4706D00E.1030704@earthlink.net> Message-ID: The Xbox 360 supports a dot product instruction which reduces the number of ops. More importantly, it reduces the number of *dependent* operations, which is the real key to performance. Ian -----Original Message----- From: music-dsp-bounces@music.columbia.edu [mailto:music-dsp-bounces@music.columbia.edu] On Behalf Of Eric Brombaugh Sent: Friday, October 05, 2007 5:00 PM To: A discussion list for music-related DSP Subject: Re: [music-dsp] Cascaded biquad filter structures That's interesting. I was just looking at the source again and it's basically load, shuffle, multiply & add operations. A dot product or MAC-type operation would be handy to reduce the number of instructions. I'm running an Athlon64 X2 with SSE3 now - I wonder if it supports the instructions you mentioned. Maybe it's time to revisit this project. I did vectorize the same filter for a Mac G4 w/ Altivec - I think that gave more of an improvement than the x86 version. Eric Ian Lewis wrote: > A few years back SSE didn't have horizontal operations. In my experience that makes the difference. But my experience is on the PowerPC, so YMMV. > Ian > > -----Original Message----- > From: music-dsp-bounces@music.columbia.edu [mailto:music-dsp-bounces@music.columbia.edu] On Behalf Of Eric Brombaugh > Sent: Friday, October 05, 2007 2:38 PM > To: A discussion list for music-related DSP > Subject: Re: [music-dsp] Cascaded biquad filter structures > > You can vectorize a cascade of biquads if you're willing to accept some > transport delay - just insert pipelines between the stages to hold the > previous results. > > A few years back I coded up an FIR and an IIR biquad in SSE. I got about > 2x speed improvement in the FIR version over plain optimized GCC with > floats, but the IIR implementation was about 70% slower in SSE than > plain optimized GCC. > > My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was > using vector operations to combine the adds & multiplies in one biquad. > This may not be the most efficient way to do it. Perhaps recoding it for > 4 simultaneous biquads would run faster. I lost interest in it though > and haven't pursued it further. I'd be happy to share my source code > though, and I'd be curious to learn your results if you try. > > Eric > > Luigi Castelli wrote: >> Hi folks, >> >> I have a bank of cascaded biquad filters and they work very well so >> far. >> >> At this point I am looking to vectorize my code in order to use SSE >> instructions and speed things up a little bit. >> >> My question is: >> is it even possible to vectorize a cascaded structure ? >> Intuitively I would say no, given the fact that such a structure is in >> series by definition, but maybe there are some smart >> coding/mathematical techniques that I am not aware of. >> >> Comments anyone ? >> >> Thank you. >> >> - Luigi >> >> >> ------------------------------------------------------------ >> THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. >> ------------------------------------------------------------ >> >> >> >> >> ____________________________________________________________________________________ >> Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. >> http://smallbusiness.yahoo.com/webhosting >> -- >> dupswapdrop -- the music-dsp mailing list and website: >> subscription info, FAQ, source code archive, list archive, book reviews, dsp links >> http://music.columbia.edu/cmc/music-dsp >> http://music.columbia.edu/mailman/listinfo/music-dsp >> > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp From aaron at hardwarehookups.com.au Fri Oct 5 20:42:38 2007 From: aaron at hardwarehookups.com.au (Aaron Oxford) Date: Fri Oct 5 20:45:30 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071005200831.E3A5B49D3EF2@music.columbia.edu> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> Message-ID: <20071006004524.844F84AC04C8@music.columbia.edu> Hi again, At 06:08 AM 6/10/2007, Erik wrote: > As you can see, linear interpolation worlk quite >well when the maximum frequency component in the source signal is >less than about 1/8 of the sample rate. Thanks for the quantitative info, although I did already touch on that, I thought. Could you provide as a reference the SNR of those signals when sampled to, say, 48kHz? It isn't fair to say I'm generating *all* this noise just with my algorithm, is it? I'm happy to be proven wrong here since I've never analysed oversampling like that, but I would have thought that with a Nyquist limit of 24kHz your tone at ~21 is going to be pretty poorly described when you give it to me. Is there a table somewhere, like the one you provided, but covering different interpolation algos such as cubic or sinc? Preferrably with pseudocode/equations for the algos themselves. :-) > > I didn't need to downsample but I'd imagine the same would work well > > in reverse > >Please don't imagine. Measure. Its really not that hard. Duly noted, but for me the goal of the excercise was simply to have really smooth curvy data to fit wavelets to. As I said, I know I'm not really trying very hard here, but the results sound OK with test signals like hihats, so I'm happy. I do apologise for clouding the issue but I thought the bandpass would help clear up some of that noise. And in fact someone else did suggest the reverse of my process for downsampling, they just avoided the interpolation issue by assuming the downsampling ratio was an integer. While we're on it, what is the SNR of using a sine table (ie how do you measure it when presumably each entry in the table is correct)? What resolutions do people use for that sort of thing? Besides what would be left for you to do if I was thorough to begin with? :-) As much as I'd like to now, if I did attempt the measurements you suggested using my hazy remembrings from uni you'd all spend the next few weeks explaining where I got *that* wrong. :-D >The original poster was talking about waveshaping synthesis: > > http://en.wikipedia.org/wiki/Waveshaper Hence the focus on downsampling rather than upsampling. I get it now. Can anyone suggest a good *free* tool (I'm using Goldwave 4 LOL) for generating test signals, measuring SNR and things like that? I've always wanted a sound editor that leaned more towards DSP than multitrack sound editing but haven't found one yet. Oh God, please don't say MATLAB! Seriously, I want to hear my results, not make graphs of them. :-D Have a good weekend, Aaron. --------------------------------------------------------------------------------- Aaron Oxford - aaron+hardwarehookups .com .au Director, Innovative Computer Solutions (Aust) Pty. Ltd. 49 Maitland Rd, Mayfield, NSW 2304 Australia http://www.ic-solutions.com.au Developer, SourceForge project VioLet Composer http://sourceforge.net/projects/buzz-like From mdsp-erikd at mega-nerd.com Fri Oct 5 22:15:36 2007 From: mdsp-erikd at mega-nerd.com (Erik de Castro Lopo) Date: Fri Oct 5 22:15:48 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071006004524.844F84AC04C8@music.columbia.edu> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> <20071006004524.844F84AC04C8@music.columbia.edu> Message-ID: <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> Aaron Oxford wrote: > Thanks for the quantitative info, although I did already touch on > that, I thought. Could you provide as a reference the SNR of those > signals when sampled to, say, 48kHz? I calculated them. > It isn't fair to say I'm > generating *all* this noise just with my algorithm, is it? Yes, linear interpolation performs extremely poorly when the source signal contains any frequencies above about 1/8 of the sampling frequency. > I'm happy > to be proven wrong here since I've never analysed oversampling like > that, but I would have thought that with a Nyquist limit of 24kHz > your tone at ~21 is going to be pretty poorly described when you give it to me. But a sinc based resampler does a proper job of it. > Is there a table somewhere, like the one you provided, but covering > different interpolation algos such as cubic or sinc? Preferrably with > pseudocode/equations for the algos themselves. :-) Polynomial interpolators are not vastly better than linear interpolators. Sinc based interpolators, or interpolators which use proper linear filtering are the only ones that do a proper job. See this comparison: http://src.infinitewave.ca/ There is one linear interpolator there "Secret Rabbit Code 0.1.2 (Linear)". Compare it with the some of the bext converters (iZotope, r8brain) and some of the bad ones (GoldWave 5.18, Sadie, Sony Vegas 7.0, Waveburner 1.2) In the interests of full disclosure, I am the author of SecretRabbitCode and I wrote a blog entry on how those graphs are generated: http://www.mega-nerd.com/erikd/Blog/CodeHacking/SecretRabbitCode/index.html > > The original poster was talking about waveshaping synthesis: > > > > http://en.wikipedia.org/wiki/Waveshaper > > Hence the focus on downsampling rather than upsampling. I get it now. Digital wavshaping usually involves upsampling, then the waveshaping and then downsampling. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- The word "Windows" is a word out of an old dialect of the Apaches. It means: "White man staring through glass-screen onto an hourglass..." From didid at skynet.be Sat Oct 6 02:19:11 2007 From: didid at skynet.be (Didier Dambrin) Date: Sat Oct 6 02:19:32 2007 Subject: [music-dsp] Cascaded biquad filter structures References: <192071.75191.qm@web34404.mail.mud.yahoo.com> <4706AEBE.1050502@earthlink.net> Message-ID: <00ff01c807e0$cfe18030$0301a8c0@GOLAMD> SSE is what makes you think that processing interlaced stereo signals isn't a so bad choice these days. Especially considering that IIRs are often implemented in double precision, SSE2 fits perfectly IIR processing of interlaced stereo. (I still don't really advise using interlaced stereo, too often I wish I didn't start with such a mistake) ----- Original Message ----- From: "Eric Brombaugh" To: "A discussion list for music-related DSP" Sent: Friday, October 05, 2007 11:38 PM Subject: Re: [music-dsp] Cascaded biquad filter structures > You can vectorize a cascade of biquads if you're willing to accept some > transport delay - just insert pipelines between the stages to hold the > previous results. > > A few years back I coded up an FIR and an IIR biquad in SSE. I got about > 2x speed improvement in the FIR version over plain optimized GCC with > floats, but the IIR implementation was about 70% slower in SSE than plain > optimized GCC. > > My SSE biquad wasn't vectorizing 4 parallel biquads. Instead it was using > vector operations to combine the adds & multiplies in one biquad. This may > not be the most efficient way to do it. Perhaps recoding it for 4 > simultaneous biquads would run faster. I lost interest in it though and > haven't pursued it further. I'd be happy to share my source code though, > and I'd be curious to learn your results if you try. > > Eric > > Luigi Castelli wrote: >> Hi folks, >> >> I have a bank of cascaded biquad filters and they work very well so >> far. >> >> At this point I am looking to vectorize my code in order to use SSE >> instructions and speed things up a little bit. >> >> My question is: >> is it even possible to vectorize a cascaded structure ? >> Intuitively I would say no, given the fact that such a structure is in >> series by definition, but maybe there are some smart >> coding/mathematical techniques that I am not aware of. >> >> Comments anyone ? >> >> Thank you. >> >> - Luigi >> >> >> ------------------------------------------------------------ >> THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY >> CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED >> REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT >> THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT >> SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. >> WITHOUT PREJUDICE UCC1-207. >> ------------------------------------------------------------ >> >> >> >> >> ____________________________________________________________________________________ >> Building a website is a piece of cake. Yahoo! Small Business gives you >> all the tools to get online. >> http://smallbusiness.yahoo.com/webhosting -- >> dupswapdrop -- the music-dsp mailing list and website: subscription info, >> FAQ, source code archive, list archive, book reviews, dsp links >> http://music.columbia.edu/cmc/music-dsp >> http://music.columbia.edu/mailman/listinfo/music-dsp >> > > -- > dupswapdrop -- the music-dsp mailing list and website: subscription info, > FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: > 269.14.1/1051 - Release Date: 05/10/2007 12:27 > > From earlevel at earlevel.com Sat Oct 6 14:40:10 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Sat Oct 6 14:43:14 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> <20071006004524.844F84AC04C8@music.columbia.edu> <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> Message-ID: I feel a little cheap whenever I defend linear interpolation, because it's not very good, and these days the processing isn't very costly to get much better results, but it does have it's uses. First, I want to point out to people that the s/n figures can be a little misleading, in that most people will think in terms of analog gear where you're usually talking about broadband noise. With linear interpolation, the noise is signal dependent, and the main problem linear interpolators it aliases terribly (along with the high frequency droop). Just looking at your s/n table, it looks indeed as though it's useless for audio unless you're already oversampled by, say, eight times, as you suggest. If this were strictly true, though, most of the sample-based instruments ever made would never have been built. One example where linear interpolation is a useful tool in the dsp designer's kit is in fractional sample rate conversion. Sinc based (bandlimited) interpolation is cheap enough to often be a no-brainer choice for quality conversion, but it's usually not a great choice for entirely arbitrary conversion rations in real time. This is because you lose the ability to use sinc tables (for integer conversion ratios) directly, and have to compute the sinc values for each conversion point. But by combining linear interpolation with the sinc-based interpolation, you can get the best of both--a high- quality interpolator that can easily handle any ratio. That is, you can use the linear interpolator to give you arbitrary resolution from an oversampled sinc table used for bandlimited interpolation, or linearly interpolate the output of the sinc-based (or other) interpolator, depending on the situation. On Oct 5, 2007, at 7:15 PM, Erik de Castro Lopo wrote: > Aaron Oxford wrote: > >> Thanks for the quantitative info, although I did already touch on >> that, I thought. Could you provide as a reference the SNR of those >> signals when sampled to, say, 48kHz? > > I calculated them. > >> It isn't fair to say I'm >> generating *all* this noise just with my algorithm, is it? > > Yes, linear interpolation performs extremely poorly when the source > signal contains any frequencies above about 1/8 of the sampling > frequency. > >> I'm happy >> to be proven wrong here since I've never analysed oversampling like >> that, but I would have thought that with a Nyquist limit of 24kHz >> your tone at ~21 is going to be pretty poorly described when you >> give it to me. > > But a sinc based resampler does a proper job of it. > >> Is there a table somewhere, like the one you provided, but covering >> different interpolation algos such as cubic or sinc? Preferrably with >> pseudocode/equations for the algos themselves. :-) > > Polynomial interpolators are not vastly better than linear > interpolators. > Sinc based interpolators, or interpolators which use proper linear > filtering > are the only ones that do a proper job. > > See this comparison: > > http://src.infinitewave.ca/ > > There is one linear interpolator there "Secret Rabbit Code 0.1.2 > (Linear)". > Compare it with the some of the bext converters (iZotope, r8brain) and > some of the bad ones (GoldWave 5.18, Sadie, Sony Vegas 7.0, > Waveburner 1.2) > > In the interests of full disclosure, I am the author of > SecretRabbitCode > and I wrote a blog entry on how those graphs are generated: > > http://www.mega-nerd.com/erikd/Blog/CodeHacking/ > SecretRabbitCode/index.html > >>> The original poster was talking about waveshaping synthesis: >>> >>> http://en.wikipedia.org/wiki/Waveshaper >> >> Hence the focus on downsampling rather than upsampling. I get it now. > > Digital wavshaping usually involves upsampling, then the > waveshaping and > then downsampling. > > Erik > -- > ----------------------------------------------------------------- > Erik de Castro Lopo > ----------------------------------------------------------------- > The word "Windows" is a word out of an old dialect of the > Apaches. It means: "White man staring through glass-screen > onto an hourglass..." > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book > reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp From bogac at bteaudio.com Sat Oct 6 15:09:24 2007 From: bogac at bteaudio.com (Bogac Topaktas) Date: Sat Oct 6 15:09:32 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling Message-ID: > Is there a table somewhere, like the one you provided, but covering > different interpolation algos such as cubic or sinc? Preferrably with > pseudocode/equations for the algos themselves. :-) "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio" by Olli Niemitalo http://yehar.com/dsp/deip.pdf From rbj at audioimagination.com Sat Oct 6 16:13:09 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 16:13:22 2007 Subject: [music-dsp] Cascaded biquad filter structures Message-ID: <20071006201309.77A399ECDE@ws6-2.us4.outblaze.com> > ----- Original Message ----- > From: Jerry > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Cascaded biquad filter structures > Date: Fri, 5 Oct 2007 16:26:26 -0700 > > > One other responder mentioned this but I'm going to say it too, for > emphasis. This is important and will solve all of your problems. > > Re-write your transfer function as a _sum_ of biquads instead of a product. but that is hard, at least in the case of time-varying filters (which i think would be likely in the case of music). you have to solve for the numerator coefficients and doing that in closed form (in terms of the filter parameters, both static and time-varying) is a male offspring of a female canine. at least the female canine. i mean, i think i identify with the OP's opening spec: "Cascaded..." Parallel might not be in the cards. > Do this by applying a partial fraction expansion on your transfer function. > You are still left with the flexibility of how you implement each resulting > biquad. As I recall, the numerator of each section is first order, not > second order. The outputs of all the sections are summed. You can implement > each biquad in parallel with the others (which is what I think you mean by > vectorizing). i'm not sure, but i thought from the context of a "vector processor" (i don't even remember the old acronyms they had for the vector processors in the Pentiums and PPCs), it meant lining up the data in such a way that the output samples are computed quickly as dot products of vectors in some tight loop. i dunno, do i have that wrong? so, for the OP, is the problem that when you line up the biquad section input and output data as: time ---> n+1->n x0[n-2] n+1->n x0[n-1] x0[n-2] (x0[n]) x0[n-1] x0[n-2] y0[n-2] (x0[n]) x0[n-1] y0[n-1] y0[n-2] (x0[n]) (y0[n]) y0[n-1] y0[n-2] y1[n-2] (y0[n]) y0[n-1] y1[n-1] y1[n-2] (y0[n]) (y1[n]) y1[n-1] y1[n-2] y1[n-2] (y1[n]) y1[n-1] ... ... ... | | biquad sections v keep in mind that yN[n] = xM[n] for N = M+1 and that the quantities in parenths are placed there explicitly as the input to the whole cascaded biquad (x[n]), or as the output of the Nth section (yN[n]). now if you can swap in coefficients into your vector processor for no extra cost, this should be as efficient as you can get (you can just proceed to compute a bunch of 5x5 dot products as you stride down the memory). but if you cannot cheaply swap in the coefficents for the (N+1)th section as you are computing the Nth section, then one might be tempted to process the Nth section for many samples before proceeding to the (N+1)th. in that case, the above alignment scheme does not work. is this the basic issue the OP has? or did i miss it? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From rbj at audioimagination.com Sat Oct 6 16:16:22 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 16:18:01 2007 Subject: [music-dsp] Cascaded biquad filter structures Message-ID: <20071006201622.AFE6154817D@ws6-6.us4.outblaze.com> > ----- Original Message ----- > From: "robert bristow-johnson" > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Cascaded biquad filter structures > Date: Sat, 6 Oct 2007 16:13:09 -0400 > made a mistake in: > time ---> > > n+1->n > x0[n-2] n+1->n > x0[n-1] x0[n-2] > (x0[n]) x0[n-1] x0[n-2] > y0[n-2] (x0[n]) x0[n-1] > y0[n-1] y0[n-2] (x0[n]) > (y0[n]) y0[n-1] y0[n-2] > y1[n-2] (y0[n]) y0[n-1] > y1[n-1] y1[n-2] (y0[n]) > (y1[n]) y1[n-1] y1[n-2] > y1[n-2] (y1[n]) y1[n-1] > ... ... ... > > | > | biquad sections > v meant to say: time ---> n+1->n x0[n-2] n+1->n x0[n-1] x0[n-2] (x0[n]) x0[n-1] x0[n-2] y0[n-2] (x0[n]) x0[n-1] y0[n-1] y0[n-2] (x0[n]) (y0[n]) y0[n-1] y0[n-2] y1[n-2] (y0[n]) y0[n-1] y1[n-1] y1[n-2] (y0[n]) (y1[n]) y1[n-1] y1[n-2] y2[n-2] (y1[n]) y1[n-1] ... ... ... | | biquad sections v -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From earlevel at earlevel.com Sat Oct 6 18:10:53 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Sat Oct 6 18:11:30 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> <20071006004524.844F84AC04C8@music.columbia.edu> <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> Message-ID: <5039DF90-5C14-4ACC-8CC7-15954421ABA8@earlevel.com> I should add one more example... It's true that linear interpolators perform "extremely poorly when the source signal contains any frequencies above about 1/8 of the sampling frequency"--8x oversampled--as you say, they start to get useful starting at around 2x oversampled. At that point you're still clear of the roll-off in the high frequencies, first of all. Second, most of the "noise" in that poor s/n is in aliasing towards the high end of the band. You can take advantage of that, particularly in application that have addition downstream filtering anyway, where you can strip it out it it's objectionable. On Oct 5, 2007, at 7:15 PM, Erik de Castro Lopo wrote: > Yes, linear interpolation performs extremely poorly when the source > signal contains any frequencies above about 1/8 of the sampling > frequency. From rbj at audioimagination.com Sat Oct 6 21:22:28 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 21:22:43 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling Message-ID: <20071007012228.3EE7D2F92F@ws6-3.us4.outblaze.com> > ----- Original Message ----- > From: "Nigel Redmon" > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Re: Waveshaping -> SNR and resampling > Date: Sat, 6 Oct 2007 15:10:53 -0700 > > > I should add one more example... It's true that linear interpolators perform > "extremely poorly when the source signal contains any frequencies above > about 1/8 of the sampling frequency"--8x oversampled--as you say, i would say that is 4x oversampled. also (i realize that this would not be typical), but if the content had *signficant* frequencies up to 1/4 Nyquist (or Fs/8), it would still sound not so good. but if the lion's share of the energy was at the bottom 5 or 6 octaves (stuff above 1 kHz was much less portion of the total energy than what is below 1 kHz), linear might not be so bad at Fs = 48 kHz. and that's not unusual for some musical instrument sounds. this observation that resampling with linear interpolation didn't sound so bad and even sounded better than polyphase using a Parks-McClellan LPF (with a simple maximum stopband gain) was something that Dave Rossum observed and led to a paper where he suggests to design the polyphase LPF using something other than the simple P-McC where there are deep notches in the LPF at integer multiples of Fs (except no notch at 0*Fs). one thing that linear had going for it (and why it sounds better for increasing oversampling factor) was that it put these deep notches in the middle of all these images before it was resampled. linear interpolation in the time domain is convolving with a triangle function (two samples wide) in the time domain which is multiplying by (sinc(f/Fs))^2 in the frequency domain. resampling can fold those filtered images back into the baseband, but if the sinc^2 frequency response really killed those images because most of the energy of the images lived very close to n*Fs (for n integer and not = 0), then linear does well. it does very, very well (120 dB SNR) if you are oversampled by a factor of 512. you can combine this linear interpolation with polyphase (with an upsampling factor of 512, which means you only need 512 sets of FIR coefs) and interpolate to *any* fractional sample time (or resample by any arbitrary ratio). in a non-ASIC context (regular CPU or DSP with a decent amount of memory to run out of), 512 sets of coefs is not so bad. 8K or 16K word. if you are upsampling by a constant factor (for the purposes of waveshaping), then all you need are the coefs for the fractional sample times that you need. maybe upsampling by a factor 4 or 8 is enough, then waveshape (at the higher Fs), then LPF (at the higer Fs), then downsample by simply picking the samples out of the oversampled stream of the LPF (decimating). if you represent or implement your waveshaping as a finite order polynomial, the required oversampling ratio is the same as the order of the waveshaping polynomial, if your pre-decimation LPF is very good. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From rbj at audioimagination.com Sat Oct 6 21:31:51 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 21:31:56 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling Message-ID: <20071007013151.BCBBC16EC16@ws6-8.us4.outblaze.com> forgot to mention an important caveat... > ----- Original Message ----- > From: "robert bristow-johnson" > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Re: Waveshaping -> SNR and resampling > Date: Sat, 6 Oct 2007 21:22:28 -0400 > ... > this observation that resampling with linear interpolation didn't sound so > bad and even sounded better (for a bunch of sounds that were sorta oversampled and had nearly all of their energy at the bottom of the spectrum) > than polyphase using a Parks-McClellan LPF (with > a simple maximum stopband gain) was something that Dave Rossum observed and > led to a paper where he suggests to design the polyphase LPF using something > other than the simple P-McC where there are deep notches in the LPF at > integer multiples of Fs (except no notch at 0*Fs). ... -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From rbj at audioimagination.com Sat Oct 6 21:42:06 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 21:42:18 2007 Subject: [music-dsp] Cascaded biquad filter structures Message-ID: <20071007014206.3858FEEA46@ws6-1.us4.outblaze.com> piss! i made another screwup where i said exactly opposite of what i meant to say. (sorta like the "Wicked Bible".) ----- Original Message ----- From: "robert bristow-johnson" To: "A discussion list for music-related DSP" Subject: Re: [music-dsp] Cascaded biquad filter structures Date: Sat, 6 Oct 2007 16:13:09 -0400 ... time ---> n+1->n x0[n-2] n+1->n x0[n-1] x0[n-2] (x0[n]) x0[n-1] x0[n-2] y0[n-2] (x0[n]) x0[n-1] y0[n-1] y0[n-2] (x0[n]) (y0[n]) y0[n-1] y0[n-2] y1[n-2] (y0[n]) y0[n-1] y1[n-1] y1[n-2] (y0[n]) (y1[n]) y1[n-1] y1[n-2] y2[n-2] (y1[n]) y1[n-1] y2[n-1] y2[n-2] (y1[n]) (y2[n]) y2[n-1] y2[n-2] ... ... ... | | biquad sections v keep in mind that yN[n] = xM[n] for M = N+1 and that the quantities in parenths are placed there explicitly as the input to the whole cascaded biquad (x[n]), or as the output of the Nth section (yN[n]). now if you can swap in coefficients into your vector processor for no extra cost, this should be as efficient as you can get (you can just proceed to compute a bunch of 5x5 dot products as you stride down the memory). but if you cannot cheaply swap in the coefficents for the (N+1)th section as you are computing the Nth section, then one might be tempted to process the Nth section for many samples before proceeding to the (N+1)th. ... -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From earlevel at earlevel.com Sat Oct 6 22:44:22 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Sat Oct 6 22:44:34 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071007012228.3EE7D2F92F@ws6-3.us4.outblaze.com> References: <20071007012228.3EE7D2F92F@ws6-3.us4.outblaze.com> Message-ID: On Oct 6, 2007, at 6:22 PM, robert bristow-johnson wrote: >> about 1/8 of the sampling frequency"--8x oversampled--as you say, > i would say that is 4x oversampled. LOL--oops, my bad--been a rough week (AES). From rbj at audioimagination.com Sat Oct 6 23:32:55 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sat Oct 6 23:37:53 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling Message-ID: <20071007033255.38549548155@ws6-6.us4.outblaze.com> > ----- Original Message ----- > From: "Nigel Redmon" > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Re: Waveshaping -> SNR and resampling > Date: Sat, 6 Oct 2007 19:44:22 -0700 > > > On Oct 6, 2007, at 6:22 PM, robert bristow-johnson wrote: > >> about 1/8 of the sampling frequency"--8x oversampled--as you say, > > i would say that is 4x oversampled. > > LOL--oops, my bad--been a rough week (AES). i'm jealous. i can't make it this year (which is the exception, not the rule for me regarding the U.S. AES conventions) and would have been pleased to meet you at an AES, Nigel. maybe next year in SF? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From akbutler at tiscali.co.uk Sun Oct 7 07:36:52 2007 From: akbutler at tiscali.co.uk (andy butler) Date: Sun Oct 7 07:36:45 2007 Subject: [music-dsp] Resampling, Interpolation In-Reply-To: <20071007033810.524C74E8A518@music.columbia.edu> References: <20071007033810.524C74E8A518@music.columbia.edu> Message-ID: <4708C4D4.4070509@tiscali.co.uk> Here's a little demo I made. www.andybutler.com/mp3/lin.wav Started with a 1kHz sine tone (made in audition) of 2s duration (repeated 2x) ...at 44100Hz sample rate Resampled the first repeat using linear interpolation, so that pitch drops linearly down to zero over the 2s There's audible artifacts. I'd call it aliasing, but not sure if it 100% matches the technical description. If, as seems to be stated on this list, linear interpolation is good for 8x oversampled signals then the 1000Hz tone sampled at 44100Hz wouldn't give aliasing when re-sampled. Surely, this demonstrates something interesting. Either that, or I misunderstood what was being said ;-) To prove that the artefacts are the linear interpolation, and not some quirk of my programming the second repeat is shifted using identical software apart from the interpolation (Mathons Chopitch). andy butler Mathons From earlevel at earlevel.com Sun Oct 7 14:30:41 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Sun Oct 7 14:30:45 2007 Subject: [music-dsp] Resampling, Interpolation In-Reply-To: <4708C4D4.4070509@tiscali.co.uk> References: <20071007033810.524C74E8A518@music.columbia.edu> <4708C4D4.4070509@tiscali.co.uk> Message-ID: On Oct 7, 2007, at 4:36 AM, andy butler wrote: > If, as seems to be stated on this list, linear interpolation is > good for 8x oversampled signals The 8x was my mistake--I incorrectly ready Erik's 1/8 spec as being 1/8 the bandwidth, but it was in fact 1/8 the sample rate. My personal rule of thumb is to start thinking about the possibility of linear at 2x oversampled, but I prefer 4x, or at least that the 2x context is dealing with weakening harmonics towards the top end. BTW, it's rare that I'd use linear for sample rate conversion in general-- more typically I'd use it to get fractional delays out of delay lines (say, when I want some wow & flutter on a simulated tape delay, or to sweep the delay time on same), or for arbitrary sample rate conversion (interpolating an oversampled sinc table--credit JOS: http://ccrma.stanford.edu/~jos/resample/). > then the 1000Hz tone sampled at 44100Hz wouldn't give aliasing when > re-sampled. It's not that it doesn't, it's how much and where in the audio band it lies. It's it high enough, for instance, you may later have a later filter stage that wipes it out for free, or it's simply down far enough to be undetectable in the intended application. (For instance, a single instrument versus high-quality conversion for end products.) It's easy enough to make most commercial synths sound awful if you try, but in the general case they sound pretty good, especially in the entire musical context. We rarely use these instruments to record music consisting of naked and full amplitude sine sweeps. From earlevel at earlevel.com Sun Oct 7 14:39:30 2007 From: earlevel at earlevel.com (Nigel Redmon) Date: Sun Oct 7 14:39:35 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071007033255.38549548155@ws6-6.us4.outblaze.com> References: <20071007033255.38549548155@ws6-6.us4.outblaze.com> Message-ID: <8BC7FE23-D990-4EAB-BA61-E4F7F7239D5F@earlevel.com> On Oct 6, 2007, at 8:32 PM, robert bristow-johnson wrote: >> LOL--oops, my bad--been a rough week (AES). > > i'm jealous. i can't make it this year (which is the exception, > not the rule for me regarding the U.S. AES conventions) and would > have been pleased to meet you at an AES, Nigel. maybe next year in > SF? Don't be--I'm not there. I got features/changes laid on me as late as Wednesday eve, for setup on Thursday. By Friday eve, it was clear everything was in order, but at that point jumping on a red-eye to hit the show for the weekend wasn't very appealing after those late nights. SF I'll try to make, and sincerely hope to meet you Robert. (Do you attend NAMM?) From rbj at audioimagination.com Sun Oct 7 22:04:43 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Sun Oct 7 22:07:48 2007 Subject: [music-dsp] Resampling, Interpolation Message-ID: <20071008020443.2121A9EDB0@ws6-2.us4.outblaze.com> > ----- Original Message ----- > From: "andy butler" > To: music-dsp@music.columbia.edu > Subject: [music-dsp] Resampling, Interpolation > Date: Sun, 07 Oct 2007 12:36:52 +0100 > > > > If, as seems to be stated on this list, linear interpolation is good for 8x > oversampled signals then the 1000Hz tone sampled at 44100Hz wouldn't > give aliasing when re-sampled. people were stating the sorta "rules of thumb" from their experience. it depends on how good is "good for 8x oversampl[ing]". the paper by Olli Niemitalo, http://yehar.com/dsp/deip.pdf and one that i piddled around on tried to add some quantitative language to how good Mx oversampling is when interpolating with a piecewise polynomial. it does depend on the interpolation polynomial and some are better than others. but generally, for drop-sample (piecewise-constant) you gained 6 dB SNR for every octave of oversampling (before resampling at an arbitrary ratio), 12 dB/octave for piecewise-linear, 24 dB/octave for piecewise-cubic. the difference between cubic Lagrange (3rd-order polynomial goes through the 4 neighboring points, 2 on each side), Hermite (3rd-order polynomial goes through the 2 neighboring points with additional constraint that the first derivative is continuous), and B-spline (3rd-order polynomial that is the convolution of the triangular pulse with another) were that of a constant offset in the dB SNR vs. octaves of oversampling curve (B-spline was best). all 3rd-order polynomials were eventually 24 dB/octave. in general it's 6*(N+1) dB SNR per octave of oversampling (plus some constant) where N is the order of your interpolation polynomial. so, for linear interpolation, and 8x oversampling, you get about 12*3 + 12 = 48 dB SNR. 48 dB is not so good. if you want really good SNR with oversampling combined with linear interpolation, you need to oversample by 256x or 512x or there abouts. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From jchandjr at bellsouth.net Sun Oct 7 22:34:44 2007 From: jchandjr at bellsouth.net (James Chandler Jr) Date: Sun Oct 7 22:35:31 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> <20071006004524.844F84AC04C8@music.columbia.edu> <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> Message-ID: <1B248822-C6E0-4971-A796-3870816ABCAD@bellsouth.net> Erik, do you know what software the infinitewave.ca site used to generate the pretty (and informative) plots? Especially the spectral plots are very easy to evaluate. It would be a neat tool to have available for code testing. When I've worked with SRC, would play SRC slow sine sweeps in Audition, watching the FFT window in 'animated real time' to watch which alias frequencies pop up, and how high. Which works, but those infinitewave plots are much easier to study. Thanks jcjr On Oct 5, 2007, at 10:15 PM, Erik de Castro Lopo wrote: > See this comparison: > > http://src.infinitewave.ca/ From mdsp-erikd at mega-nerd.com Mon Oct 8 04:01:15 2007 From: mdsp-erikd at mega-nerd.com (Erik de Castro Lopo) Date: Mon Oct 8 04:01:23 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling In-Reply-To: <1B248822-C6E0-4971-A796-3870816ABCAD@bellsouth.net> References: <20071005200831.E3A5B49D3EF2@music.columbia.edu> <20071006004524.844F84AC04C8@music.columbia.edu> <20071006121536.65ab869f.mdsp-erikd@mega-nerd.com> <1B248822-C6E0-4971-A796-3870816ABCAD@bellsouth.net> Message-ID: <20071008180115.d0186edb.mdsp-erikd@mega-nerd.com> James Chandler Jr wrote: > Erik, do you know what software the infinitewave.ca site used to > generate the pretty (and informative) plots? No I don't. > Especially the spectral plots are very easy to evaluate. It would be > a neat tool to have available for code testing. Like you, I was rather impressed with those plots. So impressed that I wrote some code to do it, there is ans example plot here: http://www.mega-nerd.com/tmp/speex_resampled_q10.png The code uses libsndfile for reading the file, fftw for the spectral analysis and libcairo for generating the PNG file. That means it should compile and run on any Unix, including MacOSX. Windows should also be possible, but probably very much more difficult. I've been meaning to release this code for some time but never quite managed to get around to it :-). I'll see if I can get it out over the next weekor so. Cheers, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "I am astonished by President Bush when he claims there is nothing in the Koran that justifies jihad violence in the name of Islam. Is he some kind of Islamic scholar? Has he ever actually read the Koran? -- Abu Qatada, Islamic Jihadist From andylist at vellocet.com Mon Oct 8 06:21:37 2007 From: andylist at vellocet.com (Andrew Simper) Date: Mon Oct 8 06:24:19 2007 Subject: [music-dsp] Distortion algorithm query...Re: [music-dsp] Distortion algorithm query... Message-ID: <470A04B1.4090400@vellocet.com> For hard clip there is no change in level, only a change in derivative of the function. You first have to work out numerically the fraction of a sample the signal intersects with your clip level, and then work out numerically the derivative of the signal at this fraction of a sample. The derivative of a constant clip level is of course zero, so you take the difference between the two and use that as the scale for the band limited corrective ramp. Since you are not usually working with the ideal signal but some already part bandlimited signal with wobbles then working out numerically what the original signal level and derivative is not trivial, but I think you should get decent enough results regardless, and hopefully it will use way less cpu than oversampling. Andrew robert bristow-johnson wrote: >> Ross Bencina wrote: >> >>> Andrew Simper wrote: >>> >>>> An approach I'm looking at to bandlimit hard clipping is the same approach >>>> I use to bandlimit oscillators. At the point of clipping you know the >>>> derivative is zero, and the output level is 1 (for the positive side). If >>>> you numerically compute the first and second order derivatives of the >>>> audio signal at the clipping point you can introduce a band limited >>>> corrective ramp and parabola which removes the first and second order >>>> derivative discontinuities introduced by the clipping. >>>> > ... > >>> That sounds rather interesting, but I'm not sure I understand what the >>> corrective ramp and parabola look like. >>> >>> So for example, in the ramp case, you know the gradient at the clipping >>> boundary, so you could extend a ramp off to infinity to avoid a gradient >>> discontinuity, but I guess that's not what you're doing... :-) so how does >>> one construct a "bandlimited corrective ramp". >>> >>> >> If you take the trivial step away from the band limited step and you are left >> with the corrective step, and you do the same thing for the ramp: you take >> the trivial ramp away from the band limited ramp, and you can do the same for >> higher orders as well. >> > > so now my question is, how much do you scale the corrective step (or corrective ramp)? based upon the last sample (or two) before clipping occurs? i cannot think of another basis for the scaling, but i also cannot see why such would be the case. > > if the clipping is modeled as an additive step and additive gated ramp, how do you know how big the hypothetical added step and ramp are? > > -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge." > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > From stober at iws.cs.uni-magdeburg.de Mon Oct 8 09:25:34 2007 From: stober at iws.cs.uni-magdeburg.de (Sebastian Stober) Date: Mon Oct 8 09:27:14 2007 Subject: [music-dsp] DEADLINE EXTENDED: 2nd Int. Workshop on Learning the Semantics of Audio Signals (LSAS), Genova, December 5th, 2007 Message-ID: <470A2FCE.9070700@iws.cs.uni-magdeburg.de> [Apologies if you receive multiple copies] Due to popular demand, the deadline for paper submission has been extended to October 21st, 2007 (Sunday). Please note, that this is a sharp deadline, i.e. there will be no further extension. Authors can submit their contributions using the ConfTool conference system at http://irgroup.cs.uni-magdeburg.de/lsas2007/conftool/ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2nd Workshop on Learning the Semantics of Audio Signals (LSAS) 2007 part of 2nd intl. conference on Semantics And digital Media Technology (SAMT) December 5th, 2007 Genova, Italy http://irgroup.cs.uni-magdeburg.de/lsas2007/ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CALL FOR PAPERS The second international conference on Semantics And digital Media Technology (SAMT) will be held from December 5th-7th in Genova, Italy and targets to narrow the large disparity between the low-level descriptors that can be computed automatically from multimedia content and the richness and subjectivity of semantics in user queries and human interpretations of audiovisual media - The Semantic Gap. In the context of this conference the Workshop on Learning the Semantics of Audio Signals (LSAS) focuses especially on researchers that are working on semantics, description, representation and understanding of music with the goal to intensify the exchange of ideas between the different research communities involved, to provide an overview of current activities in this area and to point out connections between them. Therefore, the topics of interest include, but are not limited to the following aspects with respect to music information retrieval systems: - Audio signal processing and feature extraction - Content-based audio retrieval - Music perception, cognition, affect and emotions - Music structure analysis - Semantic audio description and analysis - Ontologies for music and sound description - Standards for audio content description - Machine learning methods for feature extraction and mapping - Personalization of music retrieval systems While our main focus is on music data, we are also interested on work related to other audio data such as speech. Important dates: - Deadline for paper submission: EXTENDED to October 21st 2007 - Notification of acceptance: November 9th 2007 - Camera-ready paper submission: November 21st 2007 - Camera-ready workshop notes: November 28th 2007 For the full Call For Papers and further information on the workshop, please visit http://irgroup.cs.uni-magdeburg.de/lsas2007/ Information on the SAMT 2007 conference can be found at http://samt2007.ge.imati.cnr.it/ From rbj at audioimagination.com Mon Oct 8 12:57:46 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Mon Oct 8 13:00:13 2007 Subject: [music-dsp] Re: Waveshaping -> SNR and resampling Message-ID: <20071008165746.CAEF9EEA7E@ws6-1.us4.outblaze.com> > ----- Original Message ----- > From: "Nigel Redmon" > To: "A discussion list for music-related DSP" > Subject: Re: [music-dsp] Re: Waveshaping -> SNR and resampling > Date: Sun, 7 Oct 2007 11:39:30 -0700 > > > > On Oct 6, 2007, at 8:32 PM, robert bristow-johnson wrote: > >> LOL--oops, my bad--been a rough week (AES). > > > > i'm jealous. i can't make it this year (which is the exception, not the > > rule for me regarding the U.S. AES conventions) and would have been > > pleased to meet you at an AES, Nigel. maybe next year in SF? > > Don't be--I'm not there. I got features/changes laid on me as late as > Wednesday eve, for setup on Thursday. By Friday eve, it was clear everything > was in order, but at that point jumping on a red-eye to hit the show for the > weekend wasn't very appealing after those late nights. SF I'll try to make, > and sincerely hope to meet you Robert. (Do you attend NAMM?) i haven't been to a NAMM since the 80s when they had one at McCormick Place in Chicago. but now that i am working in the MI industry (which is new, none of these other audio companies i worked at were MI), NAMM might start to be on my list. but AES is more important (despite that i skipped it this year), and i want to add DAFx to the "regular" list and get back to attending the IEEE Mohonk conferences. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From superbigio at yahoo.com Fri Oct 12 12:45:29 2007 From: superbigio at yahoo.com (Luigi Castelli) Date: Fri Oct 12 13:06:24 2007 Subject: [music-dsp] Filter design question Message-ID: <131772.40705.qm@web34407.mail.mud.yahoo.com> Hi, the transform function of a high order IIR lowpass filter is given by: H(z) = { [ (1 - alpha) / 2 ] * [ (1 + z^-1) / (1 - alpha*z^-1) ] }^K where K is the filter order, alpha is the filter parameter which can be determined by the 3dB cutoff frequency wc, i.e. |H(wc)|^2 = 0.5 How do I derive the close-form formula for alpha ? Thank you. - Luigi ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ From rbj at audioimagination.com Fri Oct 12 13:26:59 2007 From: rbj at audioimagination.com (robert bristow-johnson) Date: Fri Oct 12 13:29:51 2007 Subject: [music-dsp] Filter design question Message-ID: <20071012172659.D3DE4EEAA8@ws6-1.us4.outblaze.com> > ----- Original Message ----- > From: "Luigi Castelli" > To: music-dsp@music.columbia.edu > Subject: [music-dsp] Filter design question > Date: Fri, 12 Oct 2007 09:45:29 -0700 (PDT) > > > Hi, > > the transform function of a high order IIR lowpass filter is given by: > > H(z) = { [ (1 - alpha) / 2 ] * [ (1 + z^-1) / (1 - alpha*z^-1) ] }^K > > where K is the filter order, alpha is the filter parameter which can be > determined by the 3dB cutoff frequency wc, i.e. |H(wc)|^2 = 0.5 > > How do I derive the close-form formula for alpha ? plug & chug! plug: z^-1 = e^(-jw) = cos(w) - j*sin(w) collect real terms together and imag terms together. then get an expression for |H(e^(jw))|^2 and then set it to 1/2. if you apply some common trig identities, you'll see that the sin(w) terms get squared and and added to cos^2(w) terms (go to 1) and you'll be left with only cos(w) terms that you can solve for. fortunately the ^K power is applied to *both* numerator and denominator, otherwise you would have a bitch of a time solving a high order polynomial. the magnitude of the stuff inside the {..}^K gets set to (1/2)^(1/K), so a closed form solution is still doable. > Thank you. i hope pointers are acceptable in lieu of just doing this for you. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." From superbigio at yahoo.com Fri Oct 12 14:47:00 2007 From: superbigio at yahoo.com (Luigi Castelli) Date: Fri Oct 12 14:47:05 2007 Subject: [music-dsp] Filter design question In-Reply-To: <20071012172659.D3DE4EEAA8@ws6-1.us4.outblaze.com> Message-ID: <362182.40589.qm@web34411.mail.mud.yahoo.com> > i hope pointers are acceptable in lieu of just doing this for you. Absolutely. Pointer are more than acceptable but I'll be back with more questions if I get stuck... ;-) Thanks Robert. - Luigi --- robert bristow-johnson wrote: > > > ----- Original Message ----- > > From: "Luigi Castelli" > > To: music-dsp@music.columbia.edu > > Subject: [music-dsp] Filter design question > > Date: Fri, 12 Oct 2007 09:45:29 -0700 (PDT) > > > > > > Hi, > > > > the transform function of a high order IIR lowpass filter is given > by: > > > > H(z) = { [ (1 - alpha) / 2 ] * [ (1 + z^-1) / (1 - alpha*z^-1) ] > }^K > > > > where K is the filter order, alpha is the filter parameter which > can be > > determined by the 3dB cutoff frequency wc, i.e. |H(wc)|^2 = 0.5 > > > > How do I derive the close-form formula for alpha ? > > plug & chug! > > plug: z^-1 = e^(-jw) = cos(w) - j*sin(w) > > collect real terms together and imag terms together. > > then get an expression for > > |H(e^(jw))|^2 > > and then set it to 1/2. if you apply some common trig identities, > you'll see that the sin(w) terms get squared and and added to > cos^2(w) terms (go to 1) and you'll be left with only cos(w) terms > that you can solve for. fortunately the ^K power is applied to > *both* numerator and denominator, otherwise you would have a bitch of > a time solving a high order polynomial. the magnitude of the stuff > inside the {..}^K gets set to (1/2)^(1/K), so a closed form solution > is still doable. > > > Thank you. > > i hope pointers are acceptable in lieu of just doing this for you. > > -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge." > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book > reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. http://tv.yahoo.com/ From superbigio at yahoo.com Sat Oct 13 14:48:16 2007 From: superbigio at yahoo.com (Luigi Castelli) Date: Sat Oct 13 15:14:45 2007 Subject: [music-dsp] Filter design question In-Reply-To: <20071012172659.D3DE4EEAA8@ws6-1.us4.outblaze.com> Message-ID: <893344.61309.qm@web34403.mail.mud.yahoo.com> ok, when I plug: z^-1 = e^(-jw) I get: H(w) = { [ (1 - alpha) / 2 ] * [ (1 + cos(w) - jsin(w) ) / (1 - alpha * cos(w) + alpha * jsin(w) ) ] }^K where do I go from here ? - Luigi --- robert bristow-johnson wrote: > > > ----- Original Message ----- > > From: "Luigi Castelli" > > To: music-dsp@music.columbia.edu > > Subject: [music-dsp] Filter design question > > Date: Fri, 12 Oct 2007 09:45:29 -0700 (PDT) > > > > > > Hi, > > > > the transform function of a high order IIR lowpass filter is given > by: > > > > H(z) = { [ (1 - alpha) / 2 ] * [ (1 + z^-1) / (1 - alpha*z^-1) ] > }^K > > > > where K is the filter order, alpha is the filter parameter which > can be > > determined by the 3dB cutoff frequency wc, i.e. |H(wc)|^2 = 0.5 > > > > How do I derive the close-form formula for alpha ? > > plug & chug! > > plug: z^-1 = e^(-jw) = cos(w) - j*sin(w) > > collect real terms together and imag terms together. > > then get an expression for > > |H(e^(jw))|^2 > > and then set it to 1/2. if you apply some common trig identities, > you'll see that the sin(w) terms get squared and and added to > cos^2(w) terms (go to 1) and you'll be left with only cos(w) terms > that you can solve for. fortunately the ^K power is applied to > *both* numerator and denominator, otherwise you would have a bitch of > a time solving a high order polynomial. the magnitude of the stuff > inside the {..}^K gets set to (1/2)^(1/K), so a closed form solution > is still doable. > > > Thank you. > > i hope pointers are acceptable in lieu of just doing this for you. > > -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge." > > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book > reviews, dsp links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp > ------------------------------------------------------------ THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207. ------------------------------------------------------------ ____________________________________________________________________________________ Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more! http://tv.yahoo.com/collections/3658 From czhenry at gmail.com Sat Oct 13 16:56:21 2007 From: czhenry at gmail.com (Charles Henry) Date: Sat Oct 13 16:56:31 2007 Subject: [music-dsp] Filter design question In-Reply-To: <893344.61309.qm@web34403.mail.mud.yahoo.com> References: <20071012172659.D3DE4EEAA8@ws6-1.us4.outblaze.com> <893344.61309.qm@web34403.mail.mud.yahoo.com> Message-ID: <518fe7b20710131356y32812c9ve12b5d7cefb66a0d@mail.gmail.com> On 10/13/07, Luigi Castelli wrote: > ok, > > when I plug: z^-1 = e^(-jw) I get: > > H(w) = { [ (1 - alpha) / 2 ] * [ (1 + cos(w) - jsin(w) ) / (1 - alpha * > cos(w) + alpha * jsin(w) ) ] }^K > > where do I go from here ? At the cutoff frequency, you're only looking for magnitude, right? So, you take the magnitude of the top and bottom separately. The real/imaginary parts give the phase response: so, it becomes |H(w)|^2={ [ (1 - alpha) / 2 ] * [ (1 + cos(w))^2 + sin(w)^2 ) / ((1 - alpha *cos(w))^2 + (alpha * sin(w) )^2 ] }^K -3dB mean half power ( |H(w)|^2=0.5) so you get 0.5^(-K)=[(1-alpha)/2] * [ 2 + 2cos(w)]/[1+alpha^2-2*alpha*cos(w)] now, keep in mind that in this version of things, w is valid between (-pi,pi) Good luck solving! Chuck > > - Luigi > > > > > --- robert bristow-johnson wrote: > > > > > > ----- Original Message ----- > > > From: "Luigi Castelli" > > > To: music-dsp@music.columbia.edu > > > Subject: [music-dsp] Filter design question > > > Date: Fri, 12 Oct 2007 09:45:29 -0700 (PDT) > > > > > > > > > Hi, > > > > > > the transform function of a high order IIR lowpass filter is given > > by: > > > > > > H(z) = { [ (1 - alpha) / 2 ] * [ (1 + z^-1) / (1 - alpha*z^-1) ] > > }^K > > > > > > where K is the filter order, alpha is the filter parameter which > > can be > > > determined by the 3dB cutoff frequency wc, i.e. |H(wc)|^2 = 0.5 > > > > > > How do I derive the close-form formula for alpha ? > > > > plug & chug! > > > > plug: z^-1 = e^(-jw) = cos(w) - j*sin(w) > > > > collect real terms together and imag terms together. > > > > then get an expression for > > > > |H(e^(jw))|^2 > > > > and then set it to 1/2. if you apply some common trig identities, > > you'll see that the sin(w) terms get squared and and added to > > cos^2(w) terms (go to 1) and you'll be left with only cos(w) terms > > that you can solve for. fortunately the ^K power is applied to > > *both* numerator and denominator, otherwise you would have a bitch of > > a time solving a high order polynomial. the magnitude of the stuff > > inside the {..}^K gets set to (1/2)^(1/K), so a closed form solution > > is still doable. > > > > > Thank you. > > > > i hope pointers are acceptable in lieu of just doing this for you. > > > > -- > > > > r b-j rbj@audioimagination.com > > > > "Imagination is more important than knowledge." > > > > -- > > dupswapdrop -- the music-dsp mailing list and website: > > subscription info, FAQ, source code archive, list archive, book > > reviews, dsp links > > http://music.columbia.edu/cmc/music-dsp > > http://music.columbia.edu/mailman/listinfo/music-dsp > > > > > > ------------------------------------------------------------ > THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPI