Csound Csound-dev Csound-tekno Search About

Re: csound surround module

Date1999-08-20 21:37
FromRichard Dobson
SubjectRe: csound surround module
Convolution is used to apply sampled impulse responses of an acoustic
space, recorded ambisonically, to a sourse cound, just as it is used for
reverb.  The main exponent of this technique is Angelo Farina, whose
website is:

http://pcfarina.eng.unipr.it

However, basic B-Format encoding and decoding of a monophonic source is
not hard, as  shown by Dave Malham's own Csound examples. As these can
be a little difficult to track down, I give them here:

B Format encoding example, rotating around the listener; you could just
as easily substitute  soundin from a file for the oscillator:

;bformat.orc
sr = 44100
kr = 441
ksmps = 100
nchnls = 4

instr 1
	kone	line	p6,p3,p7
	ktwo	line	p8,p3,p7
	kenv	linen	p5,0.008,p3,0.02
	a5	oscili	kenv,cpspch(p4),1
	
	kca	=	cos(kone)
	ksa	=	sin(kone)
	kcb	=	cos(ktwo)
	ksb	=	sin(ktwo)
	ax	=	a5 * kca *kcb
	ay	=	a5 * ksa * kcb
	az	=	a5 * ksb
	aw	=	a5 * 0.707
	outq		ax,ay,az,aw

endin

;bformat.sco
; p4 = pitch
; p6 = start angle from centre front
; p7 = end angle
; p8 = start angle from horizontal
; p9 = end angle


f1 0 1024 10 1 .7 .7 .7 .7 .7 .7 .7 .7 .7 .4 .4 .4 .4  .3 .3 .3 .3 .2 .2
.2 .2

;p1	p2	p3	p4	p5	p6	p7	p8	p9
i1	0.0	10.0	5.07	15000	0	6.2832	0	0
i1	+	5.0	.	.	.	.	.	.
i1	+	0.16	.	.	0	0	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	>	>	.	.
i1	+	.	.	.	6.2832	6.2832	.	.
e

And to decode the resulting b-format file (horizontal only) into four
channels:

;abfdcode.orc

sr = 44100
kr = 441
ksmps = 100
nchnls = 4

instr 2
	ax,ay,az,aw 	soundin 1

	a1	=	aw + (ax * 0.707) - (ay * 0.707)
	a2	=	aw + (ax * 0.707) + (ay * 0.707)
	a3	=	aw - (ax * 0.707) + (ay * 0.707)
	a4	=	aw - (ax * 0.707) - (ay * 0.707)

	outq		a1,a2,a3,a4

endin

periphonic decoding with height requires more than four channels,
typically eight, in a cube arrangement. I don't have any csound examples
for this, unfortunately. Of course, to play such quad files, a true
multi-channel sourncartd is essential, not least because any
synchronisation errors between the channels would be disastrous.

Also, FWIW, I took the liberty a while back of defining a custom
sub-format of the new WAVE-FORMAT_EXTENSIBLE, for B-Format audio.
Details are on my website; the format is used in the CDP Multi-Channel
Toolkit, which includes a play program which decodes (horizontally) a
B-Format file in the new format. There is a large example file  (some 5
MBytes) on Angelo's website. Angelo is working on a Windows GUI
decoder/player, which I am hoping he will post publicly soon.

Anyone really interested in ambisonics should subscribe to the sursound
discussion group, details of which are on Dave Malham's pages at York,
and also on Richard Elen's ambisonic website:
http://www.ambisonic.net/


Richard Dobson


Torsten Anders wrote:
> 
> Hi,
> 
> sounds really interesting. But how is the B-Format translated to n channels or
> how is it encoded? (I read some of the ambisonics web-pages and found a hint on
> convolution, is that true? Then it will hardly be possible to execute sound
> movements...)
> 
> Torsten
>

-- 
Test your DAW with my Soundcard Attrition Page!
http://wkweb5.cableinet.co.uk/rwd (LU: 6th July 1999)