hrtfreverb

hrtfreverb — A binaural, dynamic FDN based diffuse-field reverberator. The opcode works independently as an efficient, flexible reverberator.

Description

A frequency-dependent, efficient reverberant field is created based on low and high frequency desired reverb times. The opcode is designed to work with hrtfearly, ideally using its outputs as inputs. However, hrtfreverb can be used as a standalone tool. Stability is enforced.

It is, however, designed for use with hrtfearly to provide spatially accurate reverberation with user definable source trajectories. Accurate interaural coherence is also provided.

Syntax

aleft, aright, idel hrtfreverb asrc, ilowrt60, ihighrt60, ifilel, ifiler [,isr, imfp, iorder]

Initialization

ilowrt60 - low frequency reverb time.

ihighrt60 - high frequency reverb time.

ifilel - left HRTF spectral data file.

ifiler - right HRTF spectral data file.

[Note] Note

Spectral datafiles (based on the MIT HRTF database) are available in 3 different sampling rates: 44.1, 48 and 96 kHz and are labelled accordingly. Input and processing sr should match datafile sr. Files should be in the current directory or the SADIR (see Environment Variables).

[Note] Note

HRTF Data files for use with hrtfmove, hrtfmove2, hrtfstat, hrtfreverb, hrtfreverb were updated for Csound 5.15 and later (the code was updated and is more efficient). Old datafiles are now deprecated.

isr - optional, default 44.1kHz, legal values: 44100, 48000 and 96000.

imfp - optional, mean free path, defaults to that of a medium room. If used with hrtfearly, the mean free path of the room can be used to calculate the appropriate delay for the later reverb. Legal range: the mean free path of the smallest room allowed by hrtfearly (0.003876) 1.

iorder - optional, order of early reflection processing. If used with hrtfearly, the order of early reflections can be used to calculate the appropriate delay on the later reverb.

asrc - Input/source signal.

idel - if used with hrtfearly, the appropriate delay for the later reverb, based on the room and order of processing.

Examples

Here is an example of the hrtfearly and hrtfreverb opcodes. It uses the file hrtfearly.csd.

Example 404. Example of the htrfearly opcode.

<CsoundSynthesizer>
<CsOptions>

; Select flags here
; realtime audio out
 -o dac
; file ouput 
; -o hrtf.wav
  
</CsOptions>
<CsInstruments>

nchnls = 2

gasrc init 0	;global

instr 1		;a plucked string, distorted and filtered

  iamp = 15000
  icps = cpspch(p4)

  a1 pluck iamp, icps, icps, 0, 1
  adist distort1 a1, 10, .5, 0, 0
  afilt moogvcf2 adist, 8000, .5 
  aout linen afilt, 0, p3, .01
  
  gasrc = gasrc + aout

endin

instr 10	;uses output from instr1 as source
  
  ;simple path for source
  kx line 2, p3, 9

  ;early reflections, room default 1
  aearlyl,aearlyr, irt60low, irt60high, imfp hrtfearly gasrc, kx, 5, 1, 5, 1, 1, "hrtf-44100-left.dat", "hrtf-44100-right.dat", 1

  ;later reverb, uses outputs from above
  arevl, arevr, idel hrtfreverb gasrc, irt60low, irt60high, "hrtf-44100-left.dat", "hrtf-44100-right.dat", 44100, imfp

  ;delayed and scaled
  alatel delay arevl * .1, idel
  alater delay arevr * .1, idel

  outs	aearlyl + alatel, aearlyr + alater
  
  gasrc = 0

endin
  
</CsInstruments>
<CsScore>

; Play Instrument 1: a simple arpeggio
i1 0 .2 8.00 
i1 + .2 8.04
i1 + .2 8.07
i1 + .2 8.11
i1 + .2 9.02
i1 + 1.5 8.11
i1 + 1.5 8.07
i1 + 1.5 8.04
i1 + 1.5 8.00
i1 + 1.5 7.09
i1 + 4 8.00

; Play Instrument 10 for 13 seconds.
i10 0 13

</CsScore>
</CsoundSynthesizer>

See Also

hrtfearly hrtfmove, hrtfmove2, hrtfstat, hrtfer.

Credits

Author: Brian Carty
Maynooth
2011