Audio DSP algorithms - Page 1
Forum section: electronics / general

author: hamster_nz
author_rank: Super Contributor
timestamp: October 28, 2019, 09:47:45 pm
content: Does anybody know of an archive or reference for interesting audio DSP algorthims, for tone, EQ and other effects?Or a link for a particularly strong book in the area?ThanksMike

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 28, 2019, 11:58:52 pm
content: https://onlinelibrary.wiley.com/doi/book/10.1002/9781119991298

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 29, 2019, 02:04:59 am
content: This may be of interest,https://www-users.cs.york.ac.uk/~fisher/mkfilter/Note that any analog filter chain can be transformed into a discrete-time equivalent. While high-order filters can be used, they are terribly unstable*, and cascades of 2nd-order filters are completely general**. A typical solution, AFAIK, is the biquad architecture, for IIR filters; or for FIR filters, any method will do.FIR filters are completely stable -- no feedback term. The payback is, the filter needs to be very high-order (as many delay elements as the lowest frequency of interest, relative to the sample rate) to do its job. (Accuracy doesn't need to be particularly great, but you won't want to round off too aggressively; keeping some extra bits will help reduce noise.)*A consequence of the transformation, and the general instability of polynomial roots. Passive analog filters are pretty well behaved, and indeed cannot have any poles in the right half-plane (region of instability). (Active filters can**.) In the Z domain, stability is within the unit circle, so it doesn't take much error in coefficients for a pole to push outside of that region, and this puts great demands on the number of bits needed for a given filter (width of coefficients and MAC operations).**Active filters can be unstable, and can also be very sensitive, at least at high orders. However, they are typically designed in much the same way as digital filters are, in cascades of two-pole stages that do not interact with each other -- and for very similar reasons!As for effects, eh, sky's the limit! Basic guitar pedal effects include distortion (clipping), envelope control (mixing*, compression, expansion, noise gating, vibrato, etc.), time-variable filters (phasers,*In the RF mixer sense; a multiplier. Analog switches and double-balanced mixers (ring modulator?) are typical here.The really crazy stuff happens when you get into spectral analysis. Do an FFT of the input, do something to the spectrum, then FFT back. You can do simple stuff like rescaling (pitch bending, autotuning, time shifting), noise removal (spectra below X threshold is zeroed?), or crazy stuff like completely replacing an instrument (pitch detect (find peaks), rescale new sample to match pitch).Note you need to buffer thousands of samples, to do this, which incurs some delay as a result. The samples are usually windowed so the hard ends of the buffer are weighted less. The process should ideally be repeated in parallel at a modest time shift (like sliding over 1/2 or 1/4 of the buffer at a time), to get a smoother result. If you've ever noticed the strange droning sound or choppiness of severely pitch-shifted audio -- especially when sharp (impulsive) sounds are present -- this is why, it's expensive to do it well.Needless to say, filtering is relatively trivial on spectra (a once-through vector product, rather than a per-sample convolution), so you gain a certain economy of scale once you've cross over that threshold.Can also consider emulating physical models, to various ends. Want to make the Star Wars "pew pew" sound? Make a dispersive transmission line (the original sound was recorded on a stretched-out Slinky(R) -- the velocity of sound in the spring varies with frequency!). Want to emulate a guitar string, for plucking or filtering effects? Read Karplus and Strong. Want to emulate the Leslie speaker? (Supposedly this was a particularly hard one, due to its combination of effects?) Put together some reflection and propagation, Doppler, and channel fading.Of course for the most advanced effects, you might just want a powerful CPU instead (your average PC is quite capable here). Effects can be mapped in real time. Good way to develop effects I would think. Then when you've developed a particularly pleasing palette of effects, you can figure out their FPGA implementation, and add whatever muxes are necessary for enabling and routing them as you see fit.Tim

author: coppice
author_rank: Super Contributor
timestamp: October 29, 2019, 02:30:39 am
content: You could tryhttps://ccrma.stanford.edu, especially the material there from Julius O Smith, andhttp://musicdsp.org. Googling for music DSP drags up a number of other useful resources.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 29, 2019, 03:30:53 am
content: Quote from: T3sl4co1l on October 29, 2019, 02:04:59 amYes... awesome! That is several months worth of experimentation there...

author: colorado.rob
author_rank: Frequent Contributor
timestamp: October 29, 2019, 06:27:38 pm
content: My favorite tool for DSP experimentation is Python & SciPy signal.https://docs.scipy.org/doc/scipy/reference/signal.htmlAnd audio file IO with SciPy IO.https://docs.scipy.org/doc/scipy-0.14.0/reference/io.htmlFor record/playback in Python I use python-sounddevice, but this is one area that can be finicky.I have been playing around with Pynq and doing DSP acceleration in FPGA while driving and analyzing the results in Python.

author: legacy
author_rank: Super Contributor
timestamp: October 29, 2019, 08:16:39 pm
content: The only thing close to DSP and me is my attempt to use DSPs and SoundForge to filter and improve my voice in order to impress a Swedish girl met on Twitter. Technology (and discrete math) can help where your natural voice sucks. A lot. I mean, sound-effects like Duft Punk's can give you a chance for a date on the roadmap of next trips planned from here to the arctic pole (in November)-Anyway, regarding DSPs&C, I happen to have a copy of "Introduction To Signal Processing", with some code example in C and Matlab. Do you want them? I can upload somewhere, even (if there is enough space) on the DTB's FTP.Unfortunately, I don't happen to have a pdf for the book. It's a paper copy bought years ago.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 29, 2019, 08:28:05 pm
content: Quote from: legacy on October 29, 2019, 08:16:39 pmI hope you are only planning a road trip to the to the Arctic Circle, not the pole...Thanks for the offer - does it cover more audio effects rather than FIR/IIR/DFT stuff? I've put together & tested my first attempt at a DSP in the signal path board, and now want to "fiddle" with stuff.

author: legacy
author_rank: Super Contributor
timestamp: October 30, 2019, 01:52:07 am
content: Code:1-f_Noise_Generator.cA-D_Converter.cAudio_Allpass_Reverberator.cAudio_Lowpass_Reverberator.cAudio_Plain_Reverberator.cBandpass-Bandstop_Butterworth_Design.mBandpass_Chebyshev_Type-2_Design.mBandstop_Chebyshev_Type-2_Design.mBlock_Convolution.cCanonical_Realization_1.cCanonical_Realization_2.cCanonical_Realization_3.cCascade_Realization.cCascade_Realization.mCascade_to_Canonical.cCascade_to_Canonical.mChebyshev_Polynomial_Evaluator.cCircular-Buffer_Canonical_Realization_1.cCircular-Buffer_Canonical_Realization_2.cCircular-Buffer_Cascade_Realization_1.cCircular-Buffer_Cascade_Realization_2.cCircular-Buffer_FIR_Filter_1.cCircular-Buffer_FIR_Filter_2.cCircular-Buffer_FIR_Filter_3.cCircular-Buffer_Pointer_Wrapping_1.cCircular-Buffer_Pointer_Wrapping_2.cCircular-Buffer_Second-Order_Section_1.cCircular-Buffer_Second-Order_Section_2.cCircular_Buffer_FIR_Filter_in_Direct_Form.mCircular_Delay-Line.mCircular_Delay-Line_1.cCircular_Delay-Line_2.cCircular_Delay-Line_Tap_Outputs_1.cCircular_Delay-Line_Tap_Outputs_2.cCircular_Delay-Line_Wrapping.mConvolution.cCorrelation.cD-A_Converter.cDFT.cDFT_Merging.cDTFT.mDTFT_at_Single_Frequency.cDTFT_over_Frequency_Range.cDelay_Line.cDirect_Form_Realization_1.cDirect_Form_Realization_2.cDot_Product.cFFT.cFFT_Bit_Reversed_Index.cFFT_Complex_Arithmetic.cFFT_Complex_Arithmetic.hFFT_Modulo-N_Reduction.cFFT_Shuffling.cFFT_Swapping.cFIR_Filter_in_Direct_Form_1.cFIR_Filter_in_Direct_Form_2.cFIR_Filter_in_Direct_Form_3.cGaussian_Random_Number_Generator.cGeneralized_Circular_Delay_Wavetable.cIdeal_Bandpass_Filter_Iimpulse_Response.mIdeal_Differentiator_Impulse_Response.mIdeal_Hilbert_Transformer_Impulse_Response.mIdeal_Lowpass-Highpass_Filter_Impulse_Response.mInterpolated_Circular_Delay-Line_Tap_Outputs_1.cInterpolated_Circular_Delay-Line_Tap_Outputs_2.cInverse_FFT.cJ._Audio_Eng._Soc.,_vol.45,_444 (1997).mKaiser_Bandpass_Design.mKaiser_Differentiator_Design.mKaiser_Hilbert_Transformer_Design.cKaiser_Lowpass-Highpass_Design.cKaiser_Lowpass-Highpass_Design.mKaiser_Window.mKaiser_Window_Parameters_for_Filter_Design.mKaiser_Window_Parameters_for_Spectral_Analysis.mLinear_Buffer_Delay.mLinear_Buffer_FIR_Filter_in_Direct_Form.mLinearly_Interpolated_Generator.cLow-Frequency_Hold_Generator.cLowpass-Highpass_Butterworth_Design.mLowpass-Highpass_Chebyshev_Type-1_Design.mLowpass-Highpass_Chebyshev_Type-2_Design.mModified_Bessel_Function.cModified_Bessel_Function.mParametric_Comb-Notch_Equalizer_Design.mParametric_Equalizer_Design.mSavitzky-Golay_Filter_Design.mSavitzky-Golay_Filtering.mSecond-Order_Section.cSecond-Order_Section.mSignal_Averaging.mSimulated_ECG_Waveform_Generator.mSinusoidal_Wavetable.cSquare_Wavetable.cTrapezoidal_Wavetable.cUniform_Random_Number_Generator.cUnit_Impulse.cUnit_Step.cWavetable_Generator_(Interpolation).cWavetable_Generator_(Rounding).cWavetable_Generator_(Truncation).cthe archive contains this stuff

author: hamster_nz
author_rank: Super Contributor
timestamp: October 30, 2019, 02:55:19 am
content: Quote from: legacy on October 30, 2019, 01:52:07 amNice. yes please. I shall PM you.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 31, 2019, 06:41:43 pm
content: Quote from: legacy on October 29, 2019, 08:16:39 pmDid it work?