DSP

Properties of the ROC for the z-transform

Following our tricky problem in class, a non-causal system which had undefined behavour \(z=\infty\):

\[H(z)=\frac{z^2-0.25}{z+{\frac{99999999}{100000000}}}\]

This caused confusion, in fact even the examiner "got it wrong".

Oppenheim/Schafer succinctly say:

PROPERTY 4: If \(x[n]\) is a right-sided sequence, i.e. a sequence that is zero for \(n<N_1<\infty\), the ROC extends outward from the outermost (i.e., largest magnitude) finite pole in \(X(z)\) to (and possibly including) \(z=\infty\).

...(next page tells us what exactly affects \(z=\infty\) being in the ROC or not)...

If a right-sided sequence begins at \(n=N_1<0\), then the ROC will not include \({\mid}z{\mid}=\infty\).

So once the sequence starts before 0, i.e. non-causal, \(z=\infty\) is not included in the ROC. If the sequence starts at or after 0, i.e. causal, \(z=\infty\) is included in the ROC.

(From Discrete Time Signal Processing. z-Transform chapter. Section 2)

Mathematica

Simultaneous equations for zero coefficients

For one zero filter, given two magnitude matching points G0 and G1 find b0 and b1:

w = 0
eqn0 = G0^2 == b0^2 + b1^2 + 2*b0*b1*Cos[w]
Solve[eqn0, b0]

Back substitute the answer

b0 = -b1 + G0
w = Pi / 2
eqn1 = G1^2 == b0^2 + b1^2 + 2*b0*b1*Cos[w]
Solve[eqn1, b1]

See JOS for magnitude formulae.

Clear current variables

Easiest to:

C++, JUCE etc.

Plugin end-user does not require MSVC++ runtime redist installed

In Projucer project Config tab

View C-style array contents in Xcode debugger

From here. Enter the following at the (lldb) prompt:

memory read -t int -c8 `array_name`

Specific example with WDL style heap buffer:

(lldb) memory read -t float -c4 'imp.impulses[1].m_hb.m_buf'
(float) 0x100809a00 = 2
(float) 0x100809a04 = 0
(float) 0x100809a08 = 0
(float) 0x100809a0c = 0

Of course, it might just give you junk.

Using 3rd party library via git subtree

Taken from here

To use the Aidio library in a JUCE plugin:

Remember to use backslashes for Windows.

Updating git subtree library to the latest version

or

git subtree pull --prefix Dependencies/Aidio ../Aidio/.git master --squash
git subtree pull --prefix Source/Judio ../Judio/.git master --squash

Push changes back to subtree library from parent project.

git subtree push --prefix Source/Judio ../Judio/.git subtree-branch

Then in subtree library directory (presumably git master branch)

git merge subtree-branch

...will merge the branch changes into master.

 Using Gamma DSP library in a JUCE plugin

Rez error in Xcode when trying to build JUCE plugin

/Applications/Xcode.app/Contents/Developer/usr/bin/Rez failed with exit code 3

AUCarbonViewBase Semantic Issue error when trying to build JUCE plugin

Automatically launch Reaper for plugin debug using Xcode

Write log message from JUCE

void prepareToPlay (int samplesPerBlockExpected,
                    double sampleRate) override
{
    String message;
    message << "Preparing to play audio...\n";
    message << " samplesPerBlockExpected = "
        << samplesPerBlockExpected << "\n";
    message << " sampleRate = " << sampleRate;
    Logger::getCurrentLogger()->writeToLog (message);
}

Logarithmic slider in JUCE

addAndMakeVisible (frequencySlider);
frequencySlider.setRange (50.0, 5000.0);
frequencySlider.setSkewFactorFromMidPoint (500.0);
frequencySlider.addListener (this);

Interpolate parameter changes during blocks in JUCE

void getNextAudioBlock (const AudioSourceChannelInfo&
                                bufferToFill) override
{
const float level = 0.125f;
float* const buffer =
    bufferToFill.buffer->getWritePointer (0,
                              bufferToFill.startSample);

const double localTargetFrequency = targetFrequency;

if (localTargetFrequency != currentFrequency)
{
    const double frequencyIncrement =
        (localTargetFrequency - currentFrequency) /
        bufferToFill.numSamples;

    for (int sample = 0;
         sample < bufferToFill.numSamples;
         ++sample)
    {
        const float currentSample =
            (float) std::sin (currentAngle);
        currentFrequency += frequencyIncrement;
        updateAngleDelta();
        currentAngle += angleDelta;
        buffer[sample] = currentSample * level;
    }

    currentFrequency = localTargetFrequency;
} else {
    for (int sample = 0;
        sample < bufferToFill.numSamples;
        ++sample)
    {
        const float currentSample =
            (float) std::sin (currentAngle);
        currentAngle += angleDelta;
        buffer[sample] = currentSample * level;
    }
}

The format of this code uses a typically pattern for DSP code. We avoid conditional statements in the inner for() loop, if possible. Instead, having the condition tested outside the loop, and we use two different, but quite similar loops depending upon whether the parameter is changing.

Pure Data

Adding to PureData path within .app package on mac

Misc misc

Output g++ errors to a files from make

make 2> errors.log

gcc g++ compilers: Changing versions

Update version with these (Note just use the main version number i.e. gcc-6 not gcc-6.3.1)

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 g++-6

See this for info on how to point your gcc/g++ command to the new compilers

Expected text file behaviour for OSX spacebar QuickLook

See this.

And this if you want the text to be selectable.

Rotate layer and export action in Photoshop

See this.

My action for 3 degree rotation: (Set to F12 key)

Stitch images vertically for filmstrip knob with Imagemagick

convert *.png -append filmstrip.png

Composite two images using Imagemagick

composite \
  rotateMarker/markerFilmstrip.png \
  rotateTexture/textureFilmstrip.png \
  filmstrip.png

Shrink PNG size preserving transparancy using Pngquant

pngquant filmstrip.png

Slightly larger filesize than TinyPng.com but less posterisation/higher quality.

Pandoc template

These webpages written in Markdown and converted to responsive HTML using this Pandoc template. Feel free to use or adapt. View webpage source files by changing URLs from '.html' to '.md'.

The command I use is:

pandoc \
  --standalone \
  --template 000-pandoc-template.html \
  -f markdown+hard_line_breaks \
  -f markdown-implicit_figures \
  NAME.md -o NAME.html

--standalone : creates full HTML document -f markdown+hard_line_breaks : removes the Markdown requirement of a double space at line end for a line break. -f markdown-implicit_figures : removes alt-text captions from below images.