Csound Csound-dev Csound-tekno Search About

csound5 : problem with deormals in reverb instrument

Date2005-12-28 23:45
FromErik de Castro Lopo
Subjectcsound5 : problem with deormals in reverb instrument
Hi all,

I've got a rather large CSD which works with csound4, but suffers from
denormals (I think) under csound5. By commenting out the instruments
one by one I found that the following reverb instrument was (at least
partially) to blame.

So far I've tried the following:

  - Sprinkling denorm opcodes after all a* = statements.
  - Adding low level trirand noise at the input.
  - Adding a DC offset at the input.

but none of these solved the problem.

Anybody have any clues on how to fix this problem?

Cheers,
Erik

;-----------------------------------------------------------------------
; Medium Room Reverb with controls
;-----------------------------------------------------------------------
       instr    192

idur   =        p3
iamp   =        p4
iinch1 =        p5
iinch2 =        p6
iinch3 =        p7
iinch4 =        p8
iinch5 =        p9
iinch6 =        p10
idecay =        2.0
idense  =       .82
idense2 =       .9
ipreflt =       5000
ihpfqc  =       4100
ilpfqc  =       200

adel71 init     0
adel11 init     0
adel12 init     0
adel13 init     0
adel31 init     0
adel61 init     0
adel62 init     0

kdclick linseg  0, .002, iamp, idur-.004, iamp, .002, 0

; Initialize
ain1   zar      iinch1
ain2   zar      iinch2
ain3   zar      iinch3
ain4   zar      iinch4
ain5   zar      iinch5
ain6   zar      iinch6

asig0  =        ain1 + ain2 + ain3 + ain4 + ain5 + ain6

aflt01 butterlp asig0, ipreflt                         ; Pre-Filter
aflt02 butterhp .4*adel71*idense2, ihpfqc              ; Feed-Back Filter
aflt03 butterlp .4*aflt02, ilpfqc                      ; Feed-Back Filter
asum01  =       aflt01+.5*aflt03                       ; Initial Mix

; Double Nested All-Pass
asum11  =       adel12-.35*adel11*idense               ; First  Inner Feedforward
asum12  =       adel13-.45*asum11*idense               ; Second Inner Feedforward
aout11  =       asum12-.25*asum01*idense               ; Outer Feedforward

adel11  delay   asum01+.25*aout11*idense, .0047*idecay ; Outer Feedback
adel12  delay   adel11+.35*asum11*idense, .0083*idecay ; First  Inner Feedback
adel13  delay   asum11+.45*asum12*idense, .0220*idecay ; Second Inner Feedback

adel21  delay   aout11, .005*idecay                    ; Delay 1

; All-Pass 1
asub31  =       adel31-.45*adel21*idense               ; Feedforward

adel31  delay   adel21+.45*asub31*idense, .030*idecay  ; Feedback

adel41  delay   asub31, .067*idecay                    ; Delay 2
adel51  delay   .4*adel41, .015*idecay                 ; Delay 3
aout51  =       aflt01+adel41

; Single Nested All-Pass
asum61  =       adel62-.35*adel61*idense               ; Inner Feedforward
aout61  =       asum61-.25*aout51*idense               ; Outer Feedforward

adel61  delay   aout51+.25*aout61*idense, .0292*idecay ; Outer Feedback
adel62  delay   adel61+.35*asum61*idense, .0098*idecay ; Inner Feedback

aout    =       .5*aout11+.5*adel41+.5*aout61          ; Combine Outputs

adel71  delay   aout61, .108*idecay                    ; Delay 4

        outs     aout*kdclick, -aout*kdclick

        endin

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"TLC declared bankruptcy after they received less than 2 percent of the $175
million earned by their CD sales. That was about 40 times less than the
profit that was divided among their management, production and record
companies." -- Courtney Love on the REAL piracy

Date2005-12-29 08:04
From"Michael Mossey"
SubjectAlgorithmic composition
I wanted to ask about algorithmic composition. Let me begin by
explaining what musical patterns I enjoy. Then I want to think about
how to achive that algorithmically.

I enjoy music that establishes clear patterns, then creates varied
sounds by changing those patterns. I like music that is unified around
certain melodies, pitch-class sets, harmonic qualities, or
voice-leading patterns. I like music that has sections clearly
delineated by contrasts in texture, harmonic quality (e.g. "light" or
"dark"), etc.

Just to give a few concrete examples:

Patterns that vary: let's say a piece is in 3/4, and opens with a
pickup that leaps up to the 1st beat. In the next few measures, there
is always a leap up from beat 3 to the next measure's beat 1. A bit of
the way into the composition, we still have a pickup but the same note
is repeated. Ah!  Refreshing contrast, but still close to the original
pattern (still a pickup).

Unified: let's say a piece uses the pitch-class set [014] in various
forms, inversions and transpositions and octave displacements, giving
a number of chords of contrasting quality, but with a feeling of
relatedness.

I am pondering this: should a music-generating algorithm encode these
preferences explicitly, or is it better to use a (probably simpler)
algorithm which expresses these patterns indirectly?

THe former possibility encroaches on a general expert system:
something that knows what I like and explicitly searches for patterns
which match it. Perhaps this idea is fundamentally off track: it gets
close to making an artificial system that encodes all my preferences,
but why not do the composing myself? The latter seems simpler and a
purer expression of algorithmic composition. To give one example: I
create a recursive grammar which doesn't mention a particular pc set
but happens to generate a series of related pc sets anyway.

Another possibility might be in-between: a simple generative algorithm
(such as a recursive grammar) which takes as its elements the patterns
themselves. It generates pc sets rather than individual notes, or lays
out melodies rather than individual notes.

Yet another possibility is to use algorithmic composition to create
things that *don't* use the patterns I enjoy---or rather, the patterns
I believe at this moment that I enjoy---the hope being to find new
patterns I enjoy.

Date2005-12-29 21:43
FromIstvan Varga
SubjectRe: csound5 : problem with deormals in reverb instrument
AttachmentsNone  

Date2005-12-29 22:32
FromErik de Castro Lopo
SubjectRe: csound5 : problem with deormals in reverb instrument
Istvan Varga wrote:

> If suffering from denormals means getting a slowdown, then adding a
> 'denorm asig0' here seems to improve performance when there is no
> input signal.

Its not just a slowdown. The signal also goes to a large negative
number (or maybe -NAN):

    http://www.mega-nerd.com/tmp/csound-bug.png

I've tried adding a "denorm asig0" directly after this line:

> asig0  =        ain1 + ain2 + ain3 + ain4 + ain5 + ain6

but that doesn't help. I've also tried adding a small DC offset
and low level noise. But it works with csound4.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
When aiming for the common denominator, be prepared for the
occasional division by zero.

Date2005-12-30 09:49
FromIstvan Varga
SubjectRe: csound5 : problem with deormals in reverb instrument
AttachmentsNone  

Date2005-12-30 10:02
FromErik de Castro Lopo
SubjectRe: csound5 : problem with deormals in reverb instrument
Istvan Varga wrote:

> I cannot reproduce this. Could you post a full example that reproduces
> the problem ?

Here it is:

    http://www.mega-nerd.com/tmp/TeknoBubble.csd

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"This is like creating laws against blasphemy and then complaining that
unbelievers can't come up with any logical argument against the existence
of God"  -- www.infoanarchy.org on the Digital Millenium Copyright Act

Date2005-12-30 11:31
FromIstvan Varga
SubjectRe: csound5 : problem with deormals in reverb instrument
AttachmentsNone  

Date2005-12-30 20:49
FromErik de Castro Lopo
SubjectRe: csound5 : problem with deormals in reverb instrument
Istvan Varga wrote:

> While I found some differences between the version 4 and 5 nlfilt opcode,
> the main problem seems to be lines like this one:
> 
> kacct2 linseg   1/i(kaccnt1), .04, i(kaccnt1), .1, 1/i(kaccnt1), i(kdur1)-.14, 1
> /i(kaccnt1)
> 
> here kaccnt1 is zero at init time, and thus 1/i(kaccnt1) is Inf. kacct2 is then
> used in calculations of filter cutoff frequencies and other parameters, and the
> Inf value is responsible for getting the bad output.

Istvan, thanks again for your help.

I replaced all the instances of

       X/i(kaccnt1)

with

	X/ (1+i(kaccnt1))

and that seems to have fixed it.

In most other programming environments, a integer division by zero like
this will produce and exception and an error message regarding the
location of the error. Would it be possible for csound to do something
similar?

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"I have long argued that the entertainment industry doesn't want
people to have computers. Computers give users too much capability,
too much flexibility, too much freedom. The entertainment industry
wants users to sit back and consume things. They are trying to
turn a computer into an Internet Entertainment Platform, along the
lines of a television or VCR. This bill is a large step in that
direction."  -- Bruce Schneier

Date2005-12-30 20:51
FromIstvan Varga
SubjectRe: csound5 : problem with deormals in reverb instrument
AttachmentsNone  

Date2005-12-30 21:18
FromErik de Castro Lopo
SubjectRe: csound5 : problem with deormals in reverb instrument
Istvan Varga wrote:

> This is not an integer division by zero; Csound has only floating
> point signal types, but no integers.

Yes of course. Sorry.

> While it is possible to add
> checking to all operations, doing so is not without an overhead.

Anyway, I thought the CPU automatically sent SIGFPE on a divide
by zero error. This is obviously being trapped and discarded.
Would it not make sense to something more with this signal?

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
Never argue with stupid people. They'll just drag you down to
their level and beat you with experience

Date2006-01-01 16:12
FromJeff Harrington
SubjectCacophnous.org New Music Announcement Service
Hi, I'd like to announce a new service for the contemporary music
community I'm developing which should interest many of you. It's
called Cacophonous.org and is a tagged MP3 aggregator. The intention
is that there be an RSS newsfeed that will list new contemporary music
MP3's and that that can be transformed into podcasts, RSS feeds and
auto-generated blog listings. Cacophonous.org hosts these feeds and is
also a blog. Please use it only for new MP3's , though. And If none of
this last paragraph makes sense, check out the site and read the how
to top article. It's not that hard to announce your new
tunes/non-tunes/anti-tunes.

http://cacophonous.org

Please don't post more than one MP3 at a time or even one MP3 a week.
First, it's a moderated system, and I won't approve. Second, you
won't get downloaded cuz you'll look like you're abusing the system.
It's for announcing NEW MP3's! So, when you make a new one...

My article at http://beepsnort.org has more info also. You'll see
Prent Rodgers has already used it... he's been something of a
beta-tester. Enjoy!

Jeff Harrington
jeff@... 

http://jeffharrington.org