[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference napalm::commusic_v1

Title:* * Computer Music, MIDI, and Related Topics * *
Notice:Conference has been write-locked. Use new version.
Moderator:DYPSS1::SCHAFER
Created:Thu Feb 20 1986
Last Modified:Mon Aug 29 1994
Last Successful Update:Fri Jun 06 1997
Number of topics:2852
Total number of notes:33157

2816.0. "Cleaning up a SAMPLE - Distortion/Clipping" by DWOVAX::ROSENBERG (Blew my Supreme Court Nomination) Thu Jan 09 1992 18:53

    Hello fellow noters.  Remember me?  I was the guy last year who wired a
    doorbell trigger to a DRUMKAT/EPS SAMPLER for Halloween, and scared a
    bunch of tiny tots with sampled ghoulish sounds, thanks to your help.

    * WELL, I'M BACK *  And keeping with the recently discussed tradition of
    an eclectic conference, har har, I have yet another project at hand:  
    I sampled a bunch of friends at a recent party shouting my name:
		"K E N  R O S E N B E R G ! ! !",
    and am in the process of transferring this to my voicemail personal name!

    Problem is:  I recorded it on El Cheapo Radio Shack recorder, and the
    recording is clipped.  Not too badly, but there is noticable distortion
    on all the accents (KEN, RO, BERG), as well as some background rhythmic
    raspyness.  The distortion occurred during recording, and not during the 
    transfer to my sampler.

    I have ALCHEMY at my disposal, and have tried several waveform editing
    techniques, which I will list shortly, but don't know quite what I'm
    looking in the sample which will indicate clipping or distortion.
    I'll take any advice you can offer.   

    So far I did the following:

    o	Looked at the entire sample (2 seconds).  I can see some amplitude 
	spikes in the waveform where the distortion/clipping occurs, but when 
        I zoom in on these spots, the amplitude doesn't look that high, and
	the wave doesn't look square.  (Again, I don't know what I'm looking
	for).  A harmonic analysis of these spots shows frequencies such as 
        18K, 24K etc.  This is most likely not part of the original recording
        since the darn cassette recorder doesn't have those kinds of specs.  
	(I transferred the recording to an EPSm sampler at 39K, then imported 
	it to an ALCHEMY file on the Macintosh).

	BTW, if I do a harmonic analysis of a larger slice, I do not see these
	24K frequencies listed anymore.  Glitches?   Or is that how harmonic
	analysis works?

    ATTEMPT 1
    o   I tried filtering the HIGHs above 15K, using a HIGH PASS (or is it
        LOW PASS filter) which sorta works, and then scaled the amplitude of 
	the entire sound to a larger percentage.  This 	worked o.k., but it 
	now sounds like some important highs are missing.  BTW, is that called
	called a LOW PASS, or HIGH PASS filter?  
	
	I also tried a notch filter starting at 20K with a width of 5K.  All
	my filtering attempts were set to reduce things -30db.

    ATTEMPT 2
    o	I tried modifying the pitch of the sample to be about 3 octaves lower
	(allowing the duration to stretch as well).  I then listened to this
	sound, which showed the distortion much better.  But it almost sounds
	if some Frequency Modulation occurred, which I find very hard to 
	eliminate.  Also, the "bad noise" is noise (like white noise),
	and so there are many harmonics to notch out.  I can't seem to
	pinpoint the pattern.  I did try to filter the highs on this, past 6K, 
	then sped the sample back up 3 octaves.  About the same results as my 
	first filter attempt.

    ATTEMPT 3
    o   Finally, I tried the PENCIL option, and went through the entire sample,
	"cleaning up" the scratchy looking waves into smoother ones.  This
	seemed to make the sound even scratchier!  Maybe I was zoomed in too
	close, and my corrections were not big enough.

    That is not a very important project, (although it might be considered
    eclectic). However, I am approaching this task from an academic 
    standpoint, so I'd appreciate any information you can provide. What should
    I be looking for to indicate that a sound is "clipped", and do you have
    any other techniques on how to fix it?   I guess if all else
    fails, I can always throw another party and sample it over again.  :-)

    Final note:  ALCHEMY has a limit of 32767 wavesamples for a harmonic
    		 analysis, so I couldn't analyze the whole waveform.  The cool
		 thing about the harmonic analysis is that you can then adjust
		 the results and do a resynthesis, but this only works on
		 the section which was analyzed.   Alternatively, the EQ
		 option has a notch filter, which although painstaking, could
		 be used repetitively to notch many specific frequencies out 
		 of the waveform.  (This can be done in all at once with 
		 the resynthesis option.)

    Thanks in advance.

    K.R.


P.S.  One other thought.  Could I resample the waveform with a different 
      resolution, higher or lower, to remove the badness?  Just a thought.
T.RTitleUserPersonal
Name
DateLines
2816.1Why didn't you think of this?COMET::BELLMJThu Jan 09 1992 23:038
    Dude, like throw another party or two and record it on the EPS!
    
    Jeez, I actually came up with a solution...am I getting more proficient
    at this notesfile or what?
    
    
    ;-)
    -=mikie=-
2816.2;-) ;-) ;-)AUSSIE::SULLIVANsw still runs on hwFri Jan 10 1992 05:493
    re .0
    
    Sure you didn't write all that while you were still AT the party???
2816.3Sure it's clipping?MANTHN::EDDDaze of the weak...Fri Jan 10 1992 06:3414
    You used a LOW PASS filter. (STop the highs, let the lows past).
    
    You may have aliasing noise, caused by trying to sample source
    frequencies that are over 1/2 the sample rate. To sample a 10Khz
    sound, you need a sample rate of at least 20K. (Actually a bit more,
    but ABSOLUTELY at least 2X.) This may explain why the 3 8va down sample
    sounded scratchier, as the aliasing noise came down into more audible
    range.
    
    To avoid aliasing try (a) a low pass filter (steep, like 7 poles!) on
    the input to the sampler or (b) sample faster ("Outta my way honey,
    I've only got 30 seconds") by increasing the sample rate.
    
    Edd
2816.4AUSSIE::SULLIVANsw still runs on hwFri Jan 10 1992 07:1718
>	BTW, if I do a harmonic analysis of a larger slice, I do not see these
>	24K frequencies listed anymore.  Glitches?   Or is that how harmonic
>	analysis works?
    
    Actually, that would be expected. The high frequency components are
    introduced as a result of the finite length of sound that you are
    analysing. The longer the slice, the more accurate the results. 
    Because the analysis treats the slice  AS IF it were a periodic signal,
    the two 'ends' of the slice, which have been abruptly/sharply cut off,
    introduce the extra harmonics. Imagine you are analysing a slice of a
    sine wave - nice & smooth everywhere - EXCEPT at the end points.
    (unless the slice just happens to contain an integral number of
    cycles). There are methods to reduce this effect (window functions),
    which 'smooth' out the edges (I have no idea whether ALCHEMY does this
    or not).
    
    Greg.
    
2816.5Waveform editing, etcTALK::HARRIMAN'Politically Correct' is an oxymoronFri Jan 10 1992 12:0221

	Couple of things I'd try:

	1) as Edd said, lowpass filtering of the signal will clamp down on
	   high-order harmonics introduced in the recording. There may not
	   be much you can do on low (1Khz-6Khz) order harmonics generated
	   by tape overloading. Call it "analog warmth" or something ;^)

	2) Alchemy, the sample editor, should allow you to see the waveform
	   you have sampled. Distortion would probably show up as square
	   edges on the outsides of the waveform. You *might* be able to 
	   edit out the more nasty looking square edges, providing that your
	   sample rate was high enough (this is tedious). I use SampleMaker
	   for that occasionally, to "round out" edges. 

	3) you might try limiting (or compressing at least) the signal out
	   of the tape deck on the way to the sampler. Might help normalize
	   the signal.

	/pjh
2816.6RE: Response so far.DWOVAX::ROSENBERGBlew my Supreme Court NominationFri Jan 10 1992 13:5765
    Thanks to all of you for your suggestions.  Some comments on what I've
    heard.
    
    RE: .3
     
    	I don't think that aliasing noise is the problem, since I sampled
    at 39K, and as I mentioned before, the tape recorder is el cheapo, and
    probably doesn't have any specs past 15K.  Also, the distortion is in
    the recording itself.  I played it on another tape deck just to make 
    sure.
    
    	However, I don't know if distortion would show up as higher
    harmonics which might cause aliasing, so I will try using a LOW PASS
    filter on the EPS and resample.
    
    RE: .4
    
    	My harmonic analysis was always done from the x axis to the x axis,
    i.e. the 0 db crossing point (at least I think so).  I had the option 
    turned on in ALCHEMY which tries to set my selection on these points.
    
    	However, if what you say is true, then I should be able to do a
    harmonic analysis of as much as I can (32767 waves), and see what the
    highest frequency is which has some DB to it, then filter above this.
    I'll give it a whirl.
    
    RE: .5
    
	> Alchemy, the sample editor, should allow you to see the waveform
	> you have sampled. Distortion would probably show up as square
	> edges on the outsides of the waveform. 

    When I look at the real bad spots (on the ACCENTED WORDS), I notice
    that the waves are faily dense with black, even at the closest zoom.
    I.E., you can sort of see a bigger wave comprised of tiny sawtooth
    waves.  The big waves also look a bit square. As I said earlier, I tried 
    a pencil function, but maybe I didn't do such a good job smoothing 
    things.  I would guess that filtering (or notching the very high 
    harmonics here would also help smooth the glitchy waves out.)  Last 
    night I tried removing them altogether, but I was in a hurry and took 
    out too many.  This kind of work requires patience.
    
	> you might try limiting (or compressing at least) the signal out
	> of the tape deck on the way to the sampler. Might help normalize
	> the signal.
    
    There is an ALCHEMY function which does compression, I think.  The ICON
    looks like:		/\
    		       /  \/\
    		      /	/\   \
    		     / /  \/\ \
    		    / /      \ \
                   / /        \ \
    Wonder if I could use this?  Time to reread the manual.
    
    Thanks again for all your help on this matter of Vital National Interest. 
    	;-)  ;-)  ;0)    <-- (Looks like Clarence from 
    				"It's a Wonderful Life")
    
    
    Ken
    
    P.S.   Is this topic considered Elitist?
    P.P.S  Good thing *I* didn't invent MUZAK, but if I keep working at it, 
    	      I might come up with something just as good!
2816.7Yes, it *is* tediousTALK::HARRIMAN&#039;Politically Correct&#039; is an oxymoronFri Jan 10 1992 14:2834

	....which is why a good quality sound bite in the first place makes
	the most sense.

	Compression on the input signal is different from compression of the
	sampled wave, in that it makes for a better initial wavesample. Digitally
	manipulating the wavesample is, in general, much harder than getting
	a good sample in the first place. I always try to get the bast quality
	audio on the way into the sampler, since there is less tedium involved.


>    When I look at the real bad spots (on the ACCENTED WORDS), I notice
>    that the waves are faily dense with black, even at the closest zoom.
>    I.E., you can sort of see a bigger wave comprised of tiny sawtooth
>    waves.  The big waves also look a bit square. As I said earlier, I tried 
>    a pencil function, but maybe I didn't do such a good job smoothing 
>    things.  I would guess that filtering (or notching the very high 
>    harmonics here would also help smooth the glitchy waves out.)  Last 
>    night I tried removing them altogether, but I was in a hurry and took 
>    out too many.  This kind of work requires patience.


	uh huh. the "dense with black" is hiss and other assorted noise. The
	"big square" waveforms are what I was talking about, although the fact
	that they were big and square is probably what caused the harmonics
	that show up in the wavesample as tiny sawtooth waves.

	A very steep digital filter at, say, 12KHz would be about right. You
	only have one "ess" (or "zeh") in your name, right? ;^)

	good luck.

	/pjh
2816.8SALSA::MOELLERSome dissembling required.Fri Jan 10 1992 15:335
    sounds like you're using as state-of-the-pocketbook tools as anyone
    else in here.. I second the suggestion that you collect some friends
    and re-record.
    
    karl
2816.9The Whitman Sampler is more fun.DWOVAX::ROSENBERGBlew my Supreme Court NominationFri Jan 10 1992 18:5230
    RE .8
    
    > sounds like you're using as state-of-the-pocketbook tools as anyone
    > else in here.. I second the suggestion that you collect some friends
    > and re-record.
    
    	What kind of fun is that, when I can waste numerous hours
    filtering, resampling, and compressing a 2 second sample, and in the
    process, bother my significant other with infinite repetitions on a
    theme, "K E N   R O S E N B E R G ! ! !".    :*)
    
    	Actually, the sample is quite usable, so I felt I could easily
    clean up some of the distortion.  So far, it's been quite easy... NOT!
    
        
    ANOTHER QUESTION
    ================
    
    	Is there any fellow noters who have ALCHEMY and a DIGIDESIGN
    Accellerator card?  (Especially, anyone who had ALCHEMY first, then
    later got the card).  I'm very interested in discussing performance
    differences, as well as some other questions about sample size, virtual
    memory, etc.
    
    Thanks once again for all the help.
    
    Ken