Skip to content

Instantly share code, notes, and snippets.

@christhompson
Created March 21, 2010 05:10
Show Gist options
  • Save christhompson/339111 to your computer and use it in GitHub Desktop.
Save christhompson/339111 to your computer and use it in GitHub Desktop.
<CsoundSynthesizer>
<CsOptions>
; non-realtime output
-o hrtf.wav
</CsOptions>
<CsInstruments>
sr = 44100 ; standard sample rates
kr = 4410
ksmps = 10
nchnls = 2 ; final output is stereo
instr 10
kaz line 0, p3, 180 ; move azimuth from front around right to back
kelev line 50, p3, -30 ; move elevation in arc from 50 to -30 deg
; (above you to below you)
ain soundin "fast_tone.wav" ; input sound
; set left and right channels to results of the hrtfmove2 opcode
; this has less clicking, especially when used for real-time synthesis
; this processes ain, with azimuth 0, the predefined elevation arc,
; and the two HRTF data files (that contain the impule responses)
; aleft,aright hrtfmove2 ain, 0, kelev, "hrtf-44100-left.dat","hrtf-44100-right.dat"
; This does the same, but with the predefined azimuth arc and an
; elevation of zero.
aleft,aright hrtfmove2 ain, kaz, 0, "hrtf-44100-left.dat","hrtf-44100-right.dat"
outs aleft, aright
endin
</CsInstruments>
<CsScore>
i10 0 20 ; play for 20 seconds
e
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment