~20ms delay? How do I do it?

Started by xorophone, November 28, 2016, 03:54:48 PM

Previous topic - Next topic

xorophone

Hello! I'm looking for a relatively simple circuit that will take an input (in this case from an RCA jack), add ~20ms of delay and then output only the delayed signal (not repeats like in a delay pedal.) I've been googling around for a while now but I just can't seem to find any really good explanation on how to do it. It sounds like it should be really simple to do. This circuit is going to be used to delay a subwoofer so I want to keep the sound quality as high as possible and isolate as much noise as possible.

Is it possible to make this circuit passive? If so, what are the downsides?
What's the most simple way of doing this while keeping the audio quality as high as possible?

Bonus points if a trimpot can be added to adjust the delay to your liking. (Maybe within a range of about 0-50ms.)

Thanks!

induction

#1
Most delay circuits split the input signal (after an input buffer) into clean and wet paths. The clean path goes straight to the output mixer, the wet path goes into the delay mechanism (e.g. PT2399). After the delay is applied, the wet signal path splits again. One path is fed back to the delay mechanism input for multiple repeats, the other is sent to the output mixer.

What you want is pretty simple to achieve. Input buffer -> delay mechanism -> output buffer. Study any standard delay circuit (like this one) to understand how the delay path works, then copy the parts you need. You can copy the input buffer from the existing circuit, and then copy it again for the output buffer (the output mixer in a full delay circuit is more complicated than you need if you don't have a dry path).

With the PT2399, the delay time is set by a variable resistor. Build your circuit on the breadboard and experiment with fixed resistors and low-value trimpots to find the ones that give you the delay time you want.

You should also study how filtering is achieved in delay circuits. High frequency are usually filtered out of the repeats because the repeats are kind of noisy, especially with longer delay times. If you want to use this circuit for a subwoofer, such filtering shouldn't bother you. On the other hand, with such short delay times the noise will be less prevalent, so you can probably adjust the filtering more for EQ'ing purposes than noise reduction.

Happy breadboarding.

Edit:
I missed the part about passive options. I know of no reasonable way to passively delay a signal.

I also neglected to mention that the circuits we deal with are powered by 9V supplies, and assume that the input signal is pretty small (1V amplitude would be considered very large for our purposes). This is especially true for PT2399 circuits, which require voltage regulation down to 5V for the positive chip supply voltage. This means you have to be careful with input levels if you're using line level signals (which I suspect mainly because subwoofers are very uncommon in guitar rigs). You may have to attenuate before the delay circuit, and amplify afterward to avoid clipping.

samhay

You might find this helpful regarding the PT2399:
http://sound.whsites.net/project26a.htm

However, note that you cannot get less than ~25 ms delay from the PT2399.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

robthequiet

MN3007

Maybe get with Steve at Small Bear for availability -- this chip does short time periods and the circuit would be about as complex as a PT2399 circuit.

A forum search might be a good idea.

GGBB

In addition to the MN3007, the MN3207, MN3009, and MN3209 will do 20ms. SAD512, SAD1024, RD5106, and RD5107 as well. Search for the datasheets to find out ranges. But with all of those the problem is availability and price. The MNs tend to be the easiest to find, plus there are clones of the MN32XXs still being made.
  • SUPPORTER

mth5044

In one of the FX-X compitions, someone had a 10 part count delay that I believe was around 20ms.

PRR

#6
You need a "thing" to store sound without tangle.

A jar won't work. Neither will wires (not for reasonable length*).

You can put it on magnetic tape and play it later. EchoPlex did it this way. But at 15ips tape speed you may have trouble getting the record and play heads that close together (0.3").

Back in 1977 we thought BBD chips were wonderful. 20mS is not a long delay (after we moved from 256-stage to 512-stage BBDs). The delay can be electrically adjusted. Much better delays should be a sub-function of a $99 pedal from the guitar shop.

I said a jar won't work, but a pipe will. Hollar in one end of a 20 foot garden hose. The sound comes out about 20mS later. You do need a speaker and mike. You need HARD hose or the sound is absorbed. This may rule-out trombone-like slide adjustment. However mikes and hose are cheap, you can coil a 10 a 20 and a 40 into a box and select delay by switching mikes. But hoses also echo, and suck highs.

A clean delay would be a fine audio-grade ADC, a tiny amount of digital memory (like 10K bytes), a DAC, and a processor to diddle the process.

*3,780 miles of perfect wire would be a 20mS delay. Real wire is "slow" and we may need less than 3,000 miles. As we know from the Transcontinental Phone (100 years ago) such a line needs many hundreds of booster amplifiers to combat line loss. In the dying years of analog phone, I do recall some odd long-echo sounds. We probably should have recorded them before that technology vanished.
  • SUPPORTER

midwayfair

Leave it to PRR to explain in several paragraphs that the simplest way to create a 20mS delay is to move 6 meters back!
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

Transmogrifox

Probably the reason 20ms delay is wanted electronically is because there is a physical separation of 20 feet between speakers.

I don't consider the PT2399 or BBD chips to be hi-fi solutions.  Decent audio quality, but something I would reserve only for guitar FX use and venues where the music is loud and all people hear is loud thumps and noise anyway.

The easiest is to buy a commercial delay module.

However, if what you want is a project where you learn something then I would vote for PRR's suggestion for using an ADC/DAC and some memory.  I'll bet there is some kind of arduino project out there that can do this with decent fidelity. 

I am currently running digital guitar effects on my raspberry pi.  The audio quality is all a matter of what USB audio interface you choose. The choices for audio interfaces for the pi give you a wide range to balance desired audio quality with cost ...not to mention you also have the options of using sonic maximizer plugins, compressors, expander, EQ.  You could make the system work as an active crossover and delay processor all-in-one.

trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

wavley

PRR is pretty much describing the Cooper Time Cube, apparently it uses SM57 capsules as both the driver and pickup.  If I remember correctly there are several folks that have done this DIY on teh webz.

From an image search...

New and exciting innovations in current technology!

Bone is in the fingers.

EccoHollow Art & Sound

eccohollow.bandcamp.com

ElectricDruid

Since this is for a sub-woofer application, I don't see why MN3207/V3207/other equivalents shouldn't be a reasonable solution. Ok, in general, you won't get full-range audio. But here, that's not the name of the game.

Let's assume the highest frequency going to this subwoofer is 500Hz. Let's put our BBD filtering at 1KHz, just because.
Let's be similarly cautious with our clock frequency, and assume that we need 5x the maximum signal frequency (usually people use x3 for BBDs, and the theory says x2).

Our 1024-stage BBD would give us the following:

Delay (secs) = 1024 / (2 x clock freq)

Assuming our worst-case, which is a 5KHz clock frequency, we get:

Delay = 1024 / 2 x 5000 = 0.1024 = 102 msecs

This is twice what we need, even allowing for the desired "variable delay". So we can double the clock frequency (to x10 the max signal) and still provide 2.5msec to 50msec variable delay.

Executive summary: Yes, it's do-able, and using technology from the 1970s!

HTH,
Tom



samhay

^but headroom may be a problem for (sub)bass unless you pad the signal down before feeding it into a 9V BBD or 5V PT2399. This can be improved upon with companding, but that starts to get more complicated again.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

PRR

> this is for a sub-woofer application

Missed that. Even the idle-hiss of BBD won't be a big deal for this.

But there are some very fancy digital speaker processors with crossover EQ and even delay. Prices are come way down. I'm a cap coil tape and hose man myself, but for serious work I sure would be looking at modern toys. Once they have jacks and a screen, amazing things are possible in a DSP.
  • SUPPORTER

wavley

Quote from: PRR on November 29, 2016, 03:08:32 PM
> this is for a sub-woofer application

Missed that. Even the idle-hiss of BBD won't be a big deal for this.

But there are some very fancy digital speaker processors with crossover EQ and even delay. Prices are come way down. I'm a cap coil tape and hose man myself, but for serious work I sure would be looking at modern toys. Once they have jacks and a screen, amazing things are possible in a DSP.

I missed it too.  Behringer active crossovers will do what you need.
New and exciting innovations in current technology!

Bone is in the fingers.

EccoHollow Art & Sound

eccohollow.bandcamp.com

Ice-9

I'm not too sure if this solution is what you are looking for but over at the Spinsemi website there is a bit of code written by Keith Barr for the FV-1 which is an active crossover. It looks like it could be used to do the job, it has a delay which can be adjusted in the code. This may just fit what you need with a bit of tinkering with the code and building the rest of the circuit around the FV-1 is pretty much as simple as it gets.

If it is just a 20ms delay you wanted then the FV-1 code to do this would be very simple

Keith's code from the spin site is copied below.


;XOVER and response compensation for powered loudspeaker
;Crossover for 2-way system
;Mono input, HF and LF outputs
;24dB/oct crossover (Linkwitz-Riley)
;Tweeter delay in ~1/4" increments (Fs=48KHz)
;7 band parametric EQ for speaker matching
;Shelving low pass for bass boosting

;Equations for setting EQ bands:

;kp(x) = peak/dip; range from -1 (inf notch) to +1.9999 (+6dB)
;kf(x) = sqrt((4*kts)/(1+(kt/q)+kts))
;kq(x) = (1-(kt/q)+kts)/(1+(kt/q)+kts)
;kg(x) = (kt/q)/(1+(kt/q)+kts)

;where:
;kt=tan(pi*f/Fs)
;kts=kt^2
;f=center frequency
;Fs=sample rate
;q=Q of filter peak

mem del1 1000 ;tweeter delay, floating point storage
mem del2 1000 ;tweeter delay, FP error storage

equ lf1a reg0 ;reg for low freq XOVER
equ lf1b reg1 ;reg for low freq XOVER
equ lf2a reg2 ;reg for low freq XOVER
equ lf2b reg3 ;reg for low freq XOVER (output)
equ hf1a reg4 ;reg for high freq XOVER
equ hf1b reg5 ;reg for high freq XOVER
equ hf2a reg6 ;reg for high freq XOVER
equ hf2b reg7 ;reg for high freq XOVER
equ temp reg8 ;reg high freq XOVER output and temp store
equ delout reg9 ;reg for tweeter delay output
equ eqin reg10 ;mono input signal to EQ section
equ b1a reg11
equ b1b reg12
equ b2a reg13
equ b2b reg14
equ b3a reg15
equ b3b reg16
equ b4a reg17
equ b4b reg18
equ b5a reg19
equ b5b reg20
equ b6a reg21
equ b6b reg22
equ b7a reg23
equ b7b reg24
equ loext reg25 ;extend low end with shelving low pass

;standard system setup variables:

equ del 0 ;samples of delay in tweeter path
equ kfl 0.48 ;XOVER low freq
equ kql 0.5 ;XOVER low q
equ kfh 0.6 ;XOVER high freq
equ kqh 0.85 ;XOVER high q
equ kflext 0.01 ;bass extension frequency
equ kshext -0.5 ;bass extension shelf

;custom EQ variables:

equ ampl 1.0 ;woofer amplitude
equ amph 1.0 ;tweeter amplitude
;EQ params will depend on driver set.
equ kf1 0 ;band frequency
equ kq1 0 ;band Q
equ kp1 0 ;band peak (+6dB max), dip (-inf)
equ kg1 0

equ kf2 0
equ kq2 0
equ kp2 0
equ kg2 0

equ kf3 0
equ kq3 0
equ kp3 0
equ kg3 0

equ kf4 0
equ kq4 0
equ kp4 0
equ kg4 0

equ kf5 0
equ kq5 0
equ kp5 0
equ kg5 0

equ kf6 0
equ kq6 0
equ kp6 0
equ kg6 0

equ kf7 0
equ kq7 0
equ kp7 0
equ kg7 0

;sum inputs to temp register:

rdax adcr,0.5
rdax adcl,0.5
wrax eqin,0

;Equalizer to correct amplitude variations.
;input to filter bank is in toeq, output will be input
;plus fractions of each band filter:

;EQ band 1:

rdax eqin,kg1
rdax b1b,-kf1
rdax b1a,1
wrax temp,kq1
rdax eqin,kg1
wrax b1a,0
rdax temp,kf1
rdax b1b,1
wrax b1b,0
rdax eqin,1
rdax temp,kp1
wrax eqin,kg2

rdax b2b,-kf2
rdax b2a,1
wrax temp,kq2
rdax eqin,kg2
wrax b2a,0
rdax temp,kf2
rdax b2b,1
wrax b2b,0
rdax eqin,1
rdax temp,kp2
wrax eqin,kg3

rdax b3b,-kf3
rdax b3a,1
wrax temp,kq3
rdax eqin,kg3
wrax b3a,0
rdax temp,kf3
rdax b3b,1
wrax b3b,0
rdax eqin,1
rdax temp,kp3
wrax eqin,kg4

rdax b4b,-kf4
rdax b4a,1
wrax temp,kq4
rdax eqin,kg4
wrax b4a,0
rdax temp,kf4
rdax b4b,1
wrax b4b,0
rdax eqin,1
rdax temp,kp4
wrax eqin,kg5

rdax b5b,-kf5
rdax b5a,1
wrax temp,kq5
rdax eqin,kg5
wrax b5a,0
rdax temp,kf5
rdax b5b,1
wrax b5b,0
rdax eqin,1
rdax temp,kp5
wrax eqin,kg6

rdax b6b,-kf6
rdax b6a,1
wrax temp,kq6
rdax eqin,kg6
wrax b6a,0
rdax temp,kf6
rdax b6b,1
wrax b6b,0
rdax eqin,1
rdax temp,kp6
wrax eqin,kg7

rdax b7b,-kf7
rdax b7a,1
wrax temp,kq7
rdax eqin,kg7
wrax b7a,0
rdax temp,kf7
rdax b7b,1
wrax b7b,0
rdax eqin,1
rdax temp,kp7
wrax eqin,1 ;keep value in accumulator


;write to delay (for tweeter) and get delayed output:

wra del1,1 ;write fp value to del1
rda del1,-1 ;subtract FP value from real value
wra del2,0 ;write error value to del2

rda del1+del,1 ;read delayed FP value
rda del2+del,1 ;add delayed error value
wrax delout,0 ;wrtie value to delay output register.

;do crossover, 24dB Linkwitz-Riley alignment
;Low pass filter for woofer:

rdax lf1a,kfl
rdax lf1b,1
wrax lf1b,-kfl
rdax lf1a,kql
rdax eqin,0.05
wrax lf1a,0

rdax lf2a,kfl
rdax lf2b,1
wrax lf2b,-kfl
rdax lf2a,kql
rdax lf1b,1
wrax lf2a,0

;high pass filter for tweeter:

rdax hf1a,kfh
rdax hf1b,1
wrax hf1b,1
rdax delout,0.25
rdax hf1a,kqh
wrax delout,1
sof -kfh,0
rdax hf1a,1
wrax hf1a,0

rdax hf2a,kfh
rdax hf2b,1
wrax hf2b,1
rdax delout,0.3
rdax hf2a,kqh
wrax delout,1
sof -kfh,0
rdax hf2a,1
wrax hf2a,0

;take outputs from crossover:

rdax lf2b,-2
rdfx loext,kflext ;bass extension shelving filter
wrlx loext,kshext ;shelf
sof -2,0
sof ampl,0 ;scale woofer amplitude
wrax dacl,0 ;output woofer through left channel

rdax delout,-2
sof -2,0
sof amph,0 ;scale tweeter amplitude
wrax dacr,0 ;output tweeter through right channel



www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

EBK

#15
Quote from: PRR on November 29, 2016, 12:22:20 AM

*3,780 miles of perfect wire would be a 20mS delay. Real wire is "slow" and we may need less than 3,000 miles. As we know from the Transcontinental Phone (100 years ago) such a line needs many hundreds of booster amplifiers to combat line loss. In the dying years of analog phone, I do recall some odd long-echo sounds. We probably should have recorded them before that technology vanished.

Someone apparently created a 350-microsecond delay using a shoebox sized container with 38 miles of fiber optic cable:
http://mobile.nytimes.com/2014/04/06/magazine/flash-boys-michael-lewis.html

Edit: I believe I should call that optical fiber rather than fiber optic cable.

20ms would just need to be a *tad* bigger (2,171 miles).   :icon_wink:
  • SUPPORTER
Technical difficulties.  Please stand by.

Transmogrifox

Quote from: EBK on November 29, 2016, 06:54:35 PM
Someone apparently created a 350-microsecond delay using a shoebox sized container with 38 miles of fiber optic cable:
http://mobile.nytimes.com/2014/04/06/magazine/flash-boys-michael-lewis.html
Propagation velocity of light through glass (fiber) is actually significantly slower than conduction through copper.  The other benefit is the diameter of the stuff is so small you can actually make a long spool of it in a relatively small space.  Where I work we have a 2 km spool for testing fiber optic transceiver circuits. The down side is it's very expensive so the only reason you would use this is for the "coolness" factor.  Making a high fidelity optic transmitter and receiver would be nontrivial unless it were a digital transmission.

Quote from: Ice-9 on November 29, 2016, 05:24:46 PM
If it is just a 20ms delay you wanted then the FV-1 code to do this would be very simple
I had failed to consider the FV-1.  It is starting to seem like the most viable DIY choice for this application.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

PRR

> 350-microsecond delay using a shoebox sized container with 38 miles of fiber optic cable:

That's 0.35 milliSecond. We were asked for 57 times longer. So 57*38mi is over 2,000 miles.

As Trans says, optic media is lower velocity than free space or even copper. The light bounces zig-zag. (This opens opportunity for overhead microwave links in very high-speed stock trades.) I didn't realize it was "that close" to copper, I'd expected a factor more like a 1.4 diagonal.

Repeaters are still needed.

Longer delays by bouncing off satellites or the Moon.

Actually, if I put bits in the internet and just send them to the next state, that can be 20mS on a good day. If I could contrive a path off the next city, that might be 20mS round-trip. But basically I do the ADC/DAC and use the ISP's routers as my storage. And on bad days the bits don't arrive.
  • SUPPORTER

xorophone

Thanks for all the great replies! :) I haven't had time to read them all yet but I'll get around to doing it soon.

Beo

This thread is the epitome of why this forum is the best on the net. I get smarter just by reading this site. If only I could apply it better in real life. :)