Digital filtering(upsampling) of complex sine signals (music) - diyAudio
Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 14th July 2008, 08:52 PM   #1
percy is offline percy  United States
diyAudio Member
 
Join Date: Apr 2004
Location: MN
Default Digital filtering(upsampling) of complex sine signals (music)

Do you think zero stuffing followed by low pass filtering (and that too 2 or 3 times in a row), no matter how good and precise the filter is, is capable of faithfully following the original shape of a complex sine signal, like music, that is rich in harmonic content ?

For one lonesome sine wave/tone yes I agree that it works great and the charts on the datasheets look great too, but what about music ?
Knowing what little I know about digital filtering I am just not able to accept the fact that this two-step process called upsampling(again, done 2-3 times over) can really be applied to music signals. Maybe its just in my mind. Maybe its just a difficult concept to understand (atleast to my mind) and its just a misconception that I have, but in any case, can anyone please help clear it up for me (preferably with charts and data to back it up) as to whether upsampling works for music signals or not.

Thoughts anyone ?
  Reply With Quote
Old 14th July 2008, 10:35 PM   #2
Javin5 is offline Javin5  Switzerland
diyAudio Member
 
Join Date: Mar 2006
Location: Switzerland
Of course it works. It is immaterial if the signal is music or speech or noise or anything else, as long as it is properly bandlimited to less than half the sampling frequency. Any college course on signal theory teaches this and there are countless textbooks. I can understand however, that these concepts may be somewhat difficult to understand for those who have never been exposed to the basics.

Although the theory is flawless, the practical implementation is not trivial. A CD-player implementation will only approximate what needs to be done to recover the audio signal from the CD. How close this approaches the ideal, depends on cost and available technology. The technology is still progressing and only now are we starting to really exploit the full quality of a good mastered CD.

Oversampling and upsampling are signal processing steps that convert the signal to higher sampling rates for easier filtering. Properly done (e.g. with high enough arithmetic precision) they are not affecting the original content of the signal, again be it sine waves, music or whatsoever. However, they make the process of postfiltering much easier.

If you go through this forum, you may find several threads that deal with these issues.
  Reply With Quote
Old 14th July 2008, 10:44 PM   #3
diyAudio Member
 
analog_sa's Avatar
 
Join Date: Aug 2002
Location: Sofia
Default Re: Digital filtering(upsampling) of complex sine signals (music)

Quote:
Originally posted by percy
Maybe its just a difficult concept to understand

Not if you understand the difference between "complex sine" and "lonesome sine"
  Reply With Quote
Old 15th July 2008, 12:40 AM   #4
percy is offline percy  United States
diyAudio Member
 
Join Date: Apr 2004
Location: MN
here's a typicaly frequency spectrum of a couple of piano keys -
I am sure other musical instruments have the same kind of freq spectra.

now lets say a stream of 44.1Khz digital data of this spectrum is sent thru a digital filter to upsample it to 352.8Khz(8x), then are you saying the spectrum of the resulting digital data stream would be exactly same ? and I dont mean by extreme DSP using a filter that costs $10000 with 10000 taps, but just those chips accessible to the common man that do 8x using 169+24+17 taps.


Click the image to open in full size.


Click the image to open in full size.
  Reply With Quote
Old 15th July 2008, 02:23 AM   #5
percy is offline percy  United States
diyAudio Member
 
Join Date: Apr 2004
Location: MN
in case those pics dont show up go to http://www.kettering.edu/~drussell/Piano/Dynamics.html and click on the images.
  Reply With Quote
Old 15th July 2008, 04:50 AM   #6
diyAudio Member
 
Join Date: Nov 2007
Fourier showed that just about any function can be decomposed into a bunch of sine functions.

You accept that a single frequency sine wave can go through a filter, no problem. Consider the case of two sine waves. How about three? Now think of lots and lots of sines going through all at the same time.

This is the beauty of superposition in a linear system.
  Reply With Quote
Old 15th July 2008, 05:48 AM   #7
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
Javin5 hit the nail on the head.

Yes, it is possible to achieve the performance you cite with the technology specified. I am doing similar things on a $400 dev kit. I test my filters by passing MLS, a pseudorandom noise that has every frequency in it and it passes quite faithfully.

Now, whether manufacturer 'X's implementation achieves the performance is a different question all together.
  Reply With Quote
Old 15th July 2008, 11:19 AM   #8
diyAudio Member
 
Join Date: Nov 2007
Upsampling is just a interpolation. According to sampling theorem an ideal interpolation result is obtained by replacing each sample by a SINC function. This is just what convolution with long sinc shaped FIR does.

If in some implementation 8x upsampling is done using 169+24+17 taps, they probable have been using special halfband FIR filters, which have all even coefficients zero value. Drawback of this is a very small passband ripple.
  Reply With Quote
Old 17th July 2008, 10:46 PM   #9
percy is offline percy  United States
diyAudio Member
 
Join Date: Apr 2004
Location: MN
ok I seem to be coming to terms with the 'complex/multiple' sines but here's really where my mental-block is about this - (hear me out, please).

To better ask my question let's take two examples of 10 seconds worth of audio data -
One is repetitive signal (say a multiple tone sine) ,
and the other is something non-repetitive - like real music.

If I understand correctly how digital a LPF works, then the newly calculated value of the sample at the output of the filter depends on some 'M' number of samples ahead of that sample. So if M=100 then the new value of sample#1 depends on the values of sample#1 thru sample#100.

Now in the repetitive signal, no matter how many samples you take(50 or 500) the batch of samples will always have the same frequency content.
Think of this as an FFT on those samples. you will always get the same fft spectrum whether you run the fft against 50 or 500 samples.

In the music signal however, I would imagine that the frequency content between say sample# 1 to 500 could be very different from the freq content of the same samples but now broken up into two batches of 1 to 250 and then 250 to 500. I mean the music content between sample# 1 to 250 could be very different from sample# 250 to 500.
Thinking in terms of FFT again, you could get a very different spectrum from samples 1 to 250 v/s samples 250 to 500.
So wouldn't using 500 samples to derive the value of the one sample give a wrong result, or atleast a result that deviates from the most accurate result ?

I realize that the rolloff of the filter depends directly on M, so too few a samples and you compromise the rolloff, too many samples and you might influence the value of the output sample by a sample that is too far away!

If thats true then how would you determine what is the optimum number of samples to send as input to the filter ? There doesn't seem to be any clear direction on that.
That's where I am stuck. Maybe I am not thinking this through correctly, if so I just need help to clear this up in my mind.
  Reply With Quote
Old 17th July 2008, 11:42 PM   #10
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
Quote:
what is the optimum number of samples to send as input to the filter ?
...the least number necessary to meet the filter requirements. Generally, the more complex the filter, the higher order (more samples) it needs to be. A simple 6dB/octave low pass can be achieved with as little as two samples (a simple biquad) As you specify steeper slopes, more complex response you need more samples to work with.

Another factor is time-frequency duality. A small number of samples (a small time window) doesn't contain any information about low frequencies so it's hard to manipulate low frequencies with a short filter. 1Hz at 44100S/s isn't really defined until you have 44100 samples (1 cycle). This re-appears in FFTs where you need a long record length to resolve the frequencies into small bins - a 44100 sample FFT would resolve to 1Hz bins.

Quote:
So wouldn't using 500 samples to derive the value of the one sample give a wrong result, or atleast a result that deviates from the most accurate result ?
Don't forget the filter coefficients. These "weights" are used to combine the different samples in a unique combination to produce the output response and typically the samples in the middle of the window have bigger weights. You can make the same filter response with 10 taps (samples) or 100 taps. The accuracy of the output sample would be the same in each case but the coefficients would be different.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Digital active filtering using PC manu27 Digital Line Level 3 27th August 2010 02:19 PM
Price-no-object design for dynamic/complex music ? FlorianO Multi-Way 81 23rd January 2009 01:03 AM
CDROM Digital Signals glt Digital Source 0 2nd December 2008 08:16 AM
Combining digital Coax Signals Darkeyce Digital Source 2 14th February 2006 07:29 AM


New To Site? Need Help?

All times are GMT. The time now is 05:43 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2