Rade Kutil
Lehrveranstaltungen
VO+PS Audio Processing (SS24)

Documents for the VO

lecture notes

list of questions

PS-Exercises

Here is some guitar sound to use as test input, and also some speech sound.

Look at this demo program for how to program the exercises in Python. Send the solutions via email to me (rkutil‍@‍cs.sbg.ac.at) before Tuesday 22:00. Please do not send Jupyter notebooks, just send .py-scripts.

  1. Implement the bandpass filter with configurable \(f_c\) and \(f_d\).

  2. Implement a three-way equalizer by first splitting the input signal with a low- and a high-pass filter with the same cut-off frequency, and then splitting the high-pass signal again in the same way. Multiply each channel by some (maybe time-varying) factor and add them back together. Check (and maybe proof) whether the input signal would be unchanged if the factors are all equal to 1.

  3. Implement a phaser with only one allpass. Modulate \(f_c\) with a low-frequency oscillator.

  4. Extend the phaser to four allpasses with separate parameters for each allpass. Modulate the \(f_c\)-parameters independently with non-harmonic low-frequencies. Also try to implement the feedback loop. The result should sound like this.

  5. Implement a 4-fold Wah-Wah effect. Modulate \(f_c\) with a low-​frequency oscillator, and calculate \(f_d\) in a constant-q manner. The result should sound like this.

  6. Generate a 5 second sine tone (e.g. 2200Hz) and resample it to an almost similar sampling rate using linear, Lanczos and allpass-interpolation. See if you can hear any difference for high frequencies. (Test with a low sampling frequency, e.g. 5100Hz resampled to 5102Hz.)

  7. Implement a stereo rotary speaker effect. The result should sound like this.

  8. Implement a primitive vocoder based on the Hilbert transform: Read two sounds, e.g. guit3.wav and fox.wav. Transform both by a truncated Hilbert transform. Calculate the instantaneous amplitude of both (i.e. \(\sqrt{x^2+y^2}\), where \(x\) is the original signal, and \(y\) is the Hilbert transform). Then substitute the amplitude of guit3 by the amplitude of fox (divide by the one and multiply by the other). The result should sound like this (not great, but the idea counts …).

  9. Implement a compressor (limiter) that uses a squarer as detector and limits the level at -30dB. (Hints: The maximum level is 0dB. Below -30dB, r=0dB (no change), between -30dB and 0dB, r is linear; r(-30)=0 and r(0)=-30; you should be able to find the formula yourself.) To test it, read guit3.wav and fox.wav, and mix them together with guit3.wav divided by 10 (radio host situation). Normalize the result so that it is not too quiet. Experiment with attack- and release-time parameters. The result should sound like this.

    Some caveats: (1) The output of the squarer is converted to dB by 10*log10 because it is squared, otherwise it is 20*log10. (2) For the second averager, the role of attack and release are reversed.

  10. Implement the distortion transforms from the lecture notes (hard clipping, soft clipping, distortion), and test them on the guitar sound.

  11. Implement an octaver and apply it on fox.wav. To correctly find positive zero-crossings, use a negative amplitude follower \(x_n\): If the signal is less than \(x_n\) (negative peak reached), set it to the signal, else multiply it by 0.999. Also use two state variables, \(r\) (negative peak reached), and \(s\) (sound on). \(r\) is set when the signal becomes less than \(x_n\), and unset when it is set and the signal becomes positive. In the latter case, also flip \(s\) (on to off or off to on). Pass the signal to the output only when it is positive and \(s\) is set. The result should sound like this.

  12. Implement the vocoder effect (mutation, morphing) based on STFT. Use the same approach as with the Hilbert transform (real,imaginary part instead of x,y), or peek ahead in the lecture notes. The STFT (forward and inverse) is available in the scipy-library:


    from scipy import signal

    frameSize = 512
    hopSize = frameSize / 4
    _, _, X = signal.stft (x, fs, window='hann', nperseg=frameSize, noverlap=frameSize-hopSize)

    _, y = signal.istft (X, fs, window='hann', nperseg=frameSize, noverlap=frameSize-hopSize)

    See what happens if you change the frame size to 128 or 4096.

2024-04-24 15:12