How to emulate Vinyl Scratch effect in Audio Processing?
Asked Answered
A

3

5

I'm trying to make a simple "virtual scratcher" but I don't know the theory behind it. Since I've found nothing useful on google I'm asking it here:

  • What happen when I scratch (move the track forward)? Do I raise the pitch and/or rate of the sample?
  • How can I emulate this phenomena with audio processing algorithms?

Sample code / tutorials would be reeeally appreciated :-)

Aspia answered 7/5, 2012 at 16:59 Comment(4)
Q: How are you editing your audio tracks now? What software are you using? I would just mix in some "scratch", "hiss" or "pop" effects as needed. For example: free-loops.com/5174-short-record-scratch.htmlAbatis
I'm using Java since I'm developing it as Android application. I still don't know if I should use default Java audio-processing or OpenSL. This depends if emulating "scratch" means changing pitch/rate or other functions that Java doesn't have. EDIT: my app will let the user have control of the track like a real vinyl. Letting him moving it forward/backward while playing and acquire the "scratch" effectAspia
You might find that a bit difficult, since Android won't let you have direct access to your audio samples (disclaimer: I'm not an Android dev, this is just what I've heard. I may be wrong about this). That said, the specific effect you're looking for is called "Varispeed", which should give you enough info to start researching. You'll probably want to add some extra noise as well to complete the effect.Depurative
@user1118094 did you end up programming that scratch effect?Pushover
E
7

What happen when I scratch (move the track forward)? Do I raise the pitch and/or rate of the sample?

Think about what is actually happening: A record contains audio data. The record needle reads the audio data from the record. As the record spins, the playback position changes. (It's very similar to watching the playhead move through an audio file in a digital audio editor.)

When you physically spin the record faster, you are increasing the playback rate. The audio is both quicker and higher in pitch. Increase the playback rate by two and the audio will playback an octave higher.

When you physically spin the record slower, you are decreasing the playback rate. The audio is both slower and lower in pitch. Decrease the playback rate by two and the audio will playback an octave lower.

Records can only modify the audio playback by speeding up or slowing down the physical record, this effects both pitch and playback rate together. Some audio software can change the pitch and rate independently. Record players can not.

(Get a record player and experiment to hear what it sounds like.)

How can I emulate this phenomena with audio processing algorithms?

To emulate a DJ scratching a record you need to be able to adjust the playback rate of the audio as the user is "scratching".

When the user speeds up the record, speed up the playback rate. When the user slows the record, slow the playback rate.

When the user stops the record, stop playback altogether.

When the user spins the record in reverse, reverse the playback.

You don't need to change the pitch of the audio. Changing the playback rate will do that automatically. Any further adjustments to the pitch will sound incorrect.

I don't have any advice with regard to libraries but something like this isn't too difficult to implement if you take your time.

Eyeopening answered 9/5, 2012 at 8:38 Comment(0)
N
1

When you scratch, you're just moving the record back and forth under the needle. So it's equivalent to looping forward and backwards repeatedly over the same part of the audio file. I would guess that the speed is somewhere between a sine wave and a triangle wave. You'll need to do linear interpolation on the sample.

For a mobile app, I'd start by mapping one axis of the screen to a time range in the audio file. Keep a buffer containing the last MotionEvent. When the next MotionEvent arrives, calculate the mapped start and end positions based on the (X,Y) coordinates. Then, calculate the elapsed time between the two MotionEvents. This gives you enough information to play from the file at the right position and speed, constantly updating with each motion event.

You might need to do some kind of smoothing on the data, but this is a starting point.

Noella answered 7/5, 2012 at 17:43 Comment(0)
D
1

A variable rate resampler might be appropriate. This will speed up the play rate and increase the pitch by the same ratio.

You would track ratio between the angular velocity of the "scratch" movement and the normal rate of platter rotation, and use that as the local resampling ratio.

There are a lot better (higher audio quality) DSP methods of doing rate resampling than linear interpolation, such as using a variable width Sinc interpolation kernel.

Democratize answered 7/5, 2012 at 18:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.