Vinyl record scratch effecthttp://forum.devmaster.net/t/vinyl-record-scratch-effect/16622
Hi,
For my fun musical hobby projects to continue my adventure into the world of audio programming I want to simulate a vinyl record scratch effect with the mouse using some sound data I have loaded from a WAV file.
I have it so I take the mouse start and end position and times and with a lerp stretch the samples into an audio output buffer. At the moment I am just point sampling.
It kind of sounds like a scratch sound but isn't quite right. I really just want something efficient that sounds good (I don't really want a whole physical simulation of a turntable) but I am not sure which areas I should be concentrating on to improve this?
Any help appreciated!
Thanks!
Tue, 14 Jul 2009 23:42:20 +0000soundVinyl record scratch effectno-reply@example.com (@Nils_Pipenbrinck Nils Pipenbrinck)@Nils_Pipenbrinck wrote:

You don't take the RIAA equalization into account.

In a nutshell on a vinyl recording the bass frequencies are damped by up to 20db. The reason for this is among other things that strong bass-signals would cause the needle to jump out of the grove.

During playback the exact reverse filering is done to the signal (e.g. the bass is boosted by 20db).

In a normal playback situation the two filters cancel out and you hear the original recording (well - kinda.. the curves are always a bit off).

If you however play back the record at a wrong speed the filters don't match up anymore and you get a filtering response that's all over the place. This is part of the fat sound that you'll hear when you slow down the turn-table. In the extreme case you'll get up to 40db boost on the lowest frequencies that way.

To get a better scratch effect you have to apply the high pass filter to the raw .wav signal, and after playback (at whatever speed you want) you apply the inverse filter.

Make sure that you have a way to deal with *very* high signal levels. Inside the turn table the preamplifier will go into soft saturation.

You can simulate this if you just route the signal through a saturation function like tanh.

This will simulate a overdriven transistor pair almost perfectly. Adjust the amount of saturation to taste and you'll get a much better scratch effect.

It does sound fairly noisy at the moment though so which is why I wonder about filtering. I have been reading that I should maybe use a sinc FIR filter sin(x)/x but I am not sure how I should design the number of coefficients etc.

When you said you altered the playback speed to catch up do you mean you changed the speed so it was such that it match the velocity between the start and end scratch points given the time delta? Also would this effectively give you filtering for free by the sound card I wonder? (I use my own wrapper around XAudio2 and OpenAL presently). Also if you did that did you have time period after the scratch ended when the speed would gradually adjust back to the normal speed I assume?

I coded this, all i did for this was to change the playback speed to catch up to where the mouse cursor was at (even to play backwards of course), it sounds like a scratch, but its a "digital scratch" it doesnt take into account of the pin scratching sound.

As far as that goes, its still useful and saleable already, I dont think its expected you to go to the lengths to get exactly the same sound as a vynil turntable.

Maybe you just shouldn't do pointsampling. Perhaps using some kind of mipmapping scheme where you recursively downsample the soundbuffer in half, and then based on the speed of the mouse selecting one of the "mipmaps" to sample from would make it sound better.

Also I have been reading a little on FIR filters and it seems depending if the scratch causes a stretch I should fill the new gap samples with a zero and then run a FIR filter, or if it shrinks it run an FIR filter and then discard any samples to be skipped over.

If you move the zipper on a jacket or backpack quickly it can sound a lot like a scratch (depending on the zipper - smaller ones are better). Maybe you can record a few zippers and process them into something you can use.

For my fun musical hobby projects to continue my adventure into the world of audio programming I want to simulate a vinyl record scratch effect with the mouse using some sound data I have loaded from a WAV file.

I have it so I take the mouse start and end position and times and with a lerp stretch the samples into an audio output buffer. At the moment I am just point sampling.

It kind of sounds like a scratch sound but isn't quite right. I really just want something efficient that sounds good (I don't really want a whole physical simulation of a turntable) but I am not sure which areas I should be concentrating on to improve this?