Skip to content

Instantly share code, notes, and snippets.

@joslloand
joslloand / wavetableSizeTest.scd
Created January 25, 2023 20:50
reproducer for: CtkBuffer: *collection appears to drop the last item

/* TEST:

wavetable size / precision

CtkBuffer:*collection appears to drop the last item, as a result of setting numFrames to size - 1 rather than size

With the Ctk test below, the returned \b_setn message is:

[ 'b_setn', 0, 0, 15.0, -0.70710676908493, 0.70710676908493, 0.41421353816986, 0.29289323091507, 1.2928931713104, -0.29289323091507, 1.4142135381699, -0.70710676908493, 0.70710676908493, -0.70710676908493, -0.41421353816986, -0.29289323091507, -1.2928931713104, 0.29289323091507, -1.4142135381699, 0.70710676908493 ]

@joslloand
joslloand / preisMeasures.scd
Created September 21, 2022 21:18
Preis measures

/* Phase Distortion and Phase Equalization in Audio Signal Processing-A Tutorial Review Author: Preis, Douglas Affiliation: Tuffs University, Department of Electrical Engineering, Medford, MA JAES Volume 30 Issue 11 pp. 774-794; November 1982 Publication Date: November 1, 1982 https://secure.aes.org/forum/pubs/journal/?elib=3810

Linear Distortion Author: Preis, Douglas

@joslloand
joslloand / lineArrayHoa.scd
Created June 24, 2022 00:59
HOA line array example
@joslloand
joslloand / lineArrayFoa1.scd
Created June 24, 2022 00:40
three FOA line array examples

// -------------------------------------- /*

  1. match energy across front stage ( 0 & pi/2)

custom five channel "line array" decoder / ~pantoNumChannels = 8; ~pantoOrientation = \point; // need a center speaker / for discussion on decoder k, see this:

/* example of weighting window across the sphere / / note: after truncation rV < 1 for HOA1 */

// same order for decoding / re-encoding

~sourceOrder = 5 ~radius = 1.0 ~sourceHoa5 // source signal

~beamOrder = 1

~theta = 0 ~phi = 0

// 5th order beam

// NRT example
(
~score = CtkScore.new;
/*
http://www.matthiaskronlachner.com/?p=1910
*/
// must set automateParams to true for NRT
~vst = HoaVST.new('mcfx_gain_delay4', numVSTs: 1, vstChannels: 4, automateParams: true);
// ~vst = HoaVST.new('mcfx_gain_delay8', numVSTs: 1, vstChannels: 8, automateParams: true);

/* Zoom H3-VR source recordings - convert to FOA & rotate

Requires use of HoaVST: https://gitlab.com/dxarts/projects/hoavst.quark

These recordings were made with the device facing away from the performer.

NOTE: we're going to FOA as the reference radius for FOA is inf */

/* Compare sclang inbuilt fft with SignalBox rfft - refactor of tests by @spluta

What we're seeing is that sclang's complex fft is by far the fastest.

Relatedly, if a real fft (+freqs only) is desired, the quickest approach is to discard -freqs, and then use rfftToFft to create a mirrored spectrum for resynthesis via ifft.

It would be worth investigating refactoring the algorithms found in SignalBox, keeping in mind preserving the current interface(s).