electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » How-tos » Production - engineering/mixing
Pitfalls of digital synthesis and effects
Post new topic   Reply to topic
Page 1 of 1 [13 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Afro88



Joined: Jun 20, 2004
Posts: 701
Location: Brisbane, Australia
Audio files: 12
G2 patch files: 79

PostPosted: Mon Aug 28, 2006 7:08 pm    Post subject: Pitfalls of digital synthesis and effects
Subject description: What are they, and what are the workarounds
Reply with quote  Mark this post and the followings unread

Ok, so inspired from a couple of recent threads I've decided to start this one. Basically, what are areas of digital synthesis and effects that currently fall over using todays methods, sample/bit rates and cpu power.

1) Any time a mathematical operation is carried out that will alter the frequency of harmonics or create new harmonics, aliasing could becom an issue. This includes frequency modulation (FM), amplitude modulation (AM) and wave shaping effects as well as others I'm sure. See http://www.electro-music.com/forum/topic-12670.html&postorder=asc

Oversampling when carrying out these operations is the main method used to avoid aliasing and maintain an accurate representation of the function being performed. Bandlimiting would be ideal (cpu wise), but unfortunately can't be done as usually these operations are performed on a sample per sample basis. Unfortunately oversampling isn't possible in many systems yet.

2) When multiple effect treatments are going to be applied, doing so at higher sample rates and bit depths can result in a clearer sound. Exactly why I'm still not entirely sure, but it has something to do with providing more information for the operation to be performed. This was discussed here: http://www.electro-music.com/forum/topic-11682.html&postorder=asc

Work at higher sample rates and bit depths if you know you'll be processing sounds alot, or use high quality plugins that oversample internally and provide high quality resampling on the output.

3) Resonant filters can be unstable at the top end and can also alias if the cutoff is pushed too high. I read this on a few threads in the kvr modular synthesis forum.

Again, oversampling is the key. I've read that 3x oversampling is ample for an accurate resonant filter.


Now I'm not saying all of this is 100% correct, but it's correct to the best of my knowledge. If there's something in here that isn't correct, please tell me why. Also, if there's anything else you want to add, please do so! It would be great if we could get a comprehensive outline of the current pitfalls and what would be needed to overcome them.
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20269
Location: The Netherlands, Enschede
Audio files: 143
G2 patch files: 318

PostPosted: Wed Aug 30, 2006 2:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

Seems like people shyed away a bit from the discussion ...
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Afro88



Joined: Jun 20, 2004
Posts: 701
Location: Brisbane, Australia
Audio files: 12
G2 patch files: 79

PostPosted: Wed Aug 30, 2006 3:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, I don't know that much about DSP, so maybe it's so far off the mark people don't know where to start? Confused

I dunno... I'm still going to post anything I find to this thread in case anyone is interested further down the track...
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2564
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 600

PostPosted: Wed Aug 30, 2006 3:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

It is an interesting topic, I had always assumed that higher sample rates would shift aliasing up so high, it would not be a problem, but I am not so sure anymore. I read somewhere that for a ring modulator or FM, you only need 2X oversampling if your X and Y are band limited, because highest sideband cant be greater than twice the highest frequency. But what if you don't band limit, or allow feedback?
Some experiments I did ages ago in C, seemed to indicate that bumping up the oversample ratio gave diminishing returns, though this may have been down to poor downsampling implementation.
Back to top
View user's profile Send private message
Afro88



Joined: Jun 20, 2004
Posts: 701
Location: Brisbane, Australia
Audio files: 12
G2 patch files: 79

PostPosted: Thu Aug 31, 2006 4:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

g2ian wrote:
It is an interesting topic, I had always assumed that higher sample rates would shift aliasing up so high, it would not be a problem, but I am not so sure anymore. I read somewhere that for a ring modulator or FM, you only need 2X oversampling if your X and Y are band limited, because highest sideband cant be greater than twice the highest frequency. But what if you don't band limit, or allow feedback?


Or even allow greater than 1x modulation amount? On the G2, the output of 2 osc's in FM gets pretty damn high pitched pretty quickly when turning up the amount knob.

Quote:
Some experiments I did ages ago in C, seemed to indicate that bumping up the oversample ratio gave diminishing returns, though this may have been down to poor downsampling implementation.


As long as you bandlimited correctly then downsampled by throwing away x samples every y, then there's not much else you can do. I guess bandlimiting isn't a trivial task...

I would love to do some experiements with oversampling and FM, but unfortunately I can't code in anything better than BASIC on the Commodore 64 Laughing Ok, I lie, I can do some Pascal, but that was a long time ago too. I've tried to do some stuff with Reaktor, but I'm having trouble implementing oversampling in Core and no one on the NI forums wants to help. Do you still happen to have any wav files from your experiments g2ian?
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2564
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 600

PostPosted: Thu Aug 31, 2006 5:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Afro88 wrote:
Do you still happen to have any wav files from your experiments?


It was a real time system using DirectSound drivers so no wav output.

From memory my down sample filter was way too simple. I know now that you need a good polyphase FIR before discarding your surplus samples. There are a huge variety of different types of filters which is probably one of the primary reasons for differences in sound between various VA synthesisers. There is a fine balance between good stop band attenuation, pass band flatness and DSP efficiency.
For the sake of experimenting, I was thinking of making some high sample rate WAV files then down sampling using a ‘decent’ down sampling program.
The sample rate in the WAV header is just a long integer, so I should be able to create 192000, 384000 or even 796000 files and have them successfully down sampled to 48000. I could just use CSound for creating the wav files maybe.
Back to top
View user's profile Send private message
Afro88



Joined: Jun 20, 2004
Posts: 701
Location: Brisbane, Australia
Audio files: 12
G2 patch files: 79

PostPosted: Thu Aug 31, 2006 10:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ahhh, Csound. Well, I don't know how to code in it, but I know how to render stuff so I did a quick test...

I grabbed the 808 emulation csound example from http://www.csounds.com/cook/ cause it does exactly what I want to test - FM with complex waves. Using the CsoundGUI it was a simple case of telling it what sample and control rates to render. I did one at 44.1 and one at 176.4, then downsampled the 176.4 one using Audacity.

Turns out there's a huge quality difference Cool

I have no idea if Csound's default osc's are bandlimited or not, so who knows, the quality difference might be mainly due to a difference in oscillator aliasing before fm.


808hh at 44.1.wav
 Description:
Csound render of Stephen Cook's 808 hihat example at 44.1k

Download
 Filename:  808hh at 44.1.wav
 Filesize:  346.73 KB
 Downloaded:  387 Time(s)


808hh at 176.4.wav
 Description:
Csound render of Stephen Cook's 808 hihat example at 176.4k then downsampled to 44.1k

Download
 Filename:  808hh at 176.4.wav
 Filesize:  346.72 KB
 Downloaded:  385 Time(s)

Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2564
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 600

PostPosted: Fri Sep 01, 2006 1:04 am    Post subject: Reply with quote  Mark this post and the followings unread

Well I did some stuff this afternnon as well Very Happy . CSound will happily produce WAV files up to 1536K (or higher?), and SSRC will happily down sample them to 48K. My CSound Orc is a pure sawtooth (no band limiting at all) sweep from 120 to 12000Hz. I rendered at 2X,4X,8X,16X and 32X then resampled each to 48K. As expected, the 2X suffers badly with aliasing, 32X is pretty damn clean. The subjective improvement is not as simple as B is twice as good as A though. I’ve combined the 5 samples into one file and Lame encoded, in case anyone is interested.

CSound code
Code:

sr         =          1536000
kr         =          1536000
ksmps      =          1
nchnls     =          1

instr 1 ;-------- instrument -------------------------------------------------------;

; CREATE BASIC SAWTOOTH WAVE SWEEP FROM 120Hz to 12000Hz

; signal source:
kenv       expon      120.0, p3, 12000.0
aphs       phasor      kenv            ; basic sawtooth phasor

; output sound scaled for 14 bits:
           out       (aphs-0.5)*2^14

endin



allrates.mp3
 Description:
sample of raw saw sweep at 2,4,8,16 and 32 time over sample.

Download
 Filename:  allrates.mp3
 Filesize:  265.22 KB
 Downloaded:  489 Time(s)

Back to top
View user's profile Send private message
kkissinger



Joined: Mar 28, 2006
Posts: 1212
Location: Kansas City, Mo USA
Audio files: 29

PostPosted: Fri Sep 01, 2006 6:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Fascinating topic....

I'm listening to the examples thru this laptop's internal sound card (nothing fancy) and a Sony (computer open-air) headset and, well... I can't hear the difference on the hi-hat examples.

The sweep is more revealing particularly at the high frequencies.

Now a question...

Currently I am laying down audio tracks for my latest project. My firepod interface supports 24bit/96khz and the computer can store files as either 24bit or 32bit floating point. I am working at the 96khz rate and saving the files as 32bit float on the assumption that I can convert the final mix to 24bit or .mp3, etc. I haven't run into any issues with my CPU speed or memory, so at this point the only consideration is sonic.

Is this overkill or am I on the right track?

Thanks!
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2564
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 600

PostPosted: Fri Sep 01, 2006 2:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

kkissinger wrote:
I am working at the 96khz rate and saving the files as 32bit float on the assumption that I can convert the final mix to 24bit or .mp3, etc. I haven't run into any issues with my CPU speed or memory, so at this point the only consideration is sonic.

Is this overkill or am I on the right track?

Thanks!


My first thought was more bits cant hurt, but 32bit floating point only uses 24 bits for the mantissa so I'm not sure that it offers any advantage to store in that format.
There are those who say that good fixed point processors give superior results to 32bit float because they have larger accumulators. This in some cases results in less info being discarded on multiple MAC type operations, which are very common in audio processing.

Forgot to mention that my downsampling step also reduced from 24 to 16 bit.
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2031
Location: Morokulien
Audio files: 3

PostPosted: Fri Sep 01, 2006 5:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

32 bit floating point offers a huge dynamic range (hundreds of dB), but with a loss of precision once you go above 0dB. That precision loss may be a moot point though, if the DAW never stores sample values above 0dB - In that case 24 bit fixed point is just as good. (AFAIK Cubase doesn't store or pass on anything above 0dB - does anybody have any hard info on specific DAWs here?)

At lower amplitudes the stored precision increases with the use of 32 bit floats, which is a good thing - here it wins out over 24 bit fixed point. IMHO, all in all 32 bit floating point is a pretty good storage format.

It is true, as g2ian says, that fixed point processors with wide accumulators (meaning fixed point DSPs) give good precision when doing sums of products, particularly if the sum goes above 0dB at any point. E.g. a 24 bit DSP with a 56 bit accumulator may easily outperform a 32 bit floating point CPU. That is both algorithm and data -dependent though.

However, in a typical PC/Mac, DSP is often (usually?) done using double precision, that is 64 bit floating point with a mantissa of 52 bits - this gives pretty good precision over a very wide dynamic range. The samples may still be stored as 32 bit floats. Most PC/Mac type processors will also do DSP with floating point a lot faster than with fixed point.

kkissinger: I think 32 bit floats @ 96kHz is a sensible format if your rig can handle it, and it will give you an upper hand quality wise when you want to convert to various other formats for publication.

DJ
--
Back to top
View user's profile Send private message Visit poster's website
kkissinger



Joined: Mar 28, 2006
Posts: 1212
Location: Kansas City, Mo USA
Audio files: 29

PostPosted: Fri Sep 01, 2006 7:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thank you for the speedy replies.

In parts of my project I have had up to 9 mono tracks with no problems. I also am laying down some stereo tracks, too.

I am running a PC laptop with a P4 3.2Ghz with 2gig ram. I am using a multi-band compressor plugin on one of the mono tracks. The VST performance meter (part of Cubase SX3) show that I am using around 12 to 15% of my CPU and is not even indicating a load on the hard drive.

In tests I have done up to 60 mono tracks without any problems however, as we all know, there is nothing like doing an actual project to shake things out.

From your comments, sounds like I am on the right track!

Pun intended Very Happy
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2564
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 600

PostPosted: Sat Sep 02, 2006 12:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Here is another dual sample using a more synth-like sound, 2 sets of three notes. The first set is 64X over sampled which is as high as I can go before ssrc breaks. The second set is 'as output' by CSound.

I quite like the way this last 64X sample sounds, alias free, but still crisp and sharp.

Edit: Alias free is a bit optimistic, I think at 64X aliasing is down 36dB

I wonder if it would be practical to code a VA using naïve algorithms and a high virtual sample rate, then simulate a delta-sigma bit steam so you can use off the shelf hardware decimation.

CSound source

Code:
sr = 3072000
kr = 30720
;sr = 48000
;kr = 480
ksmps = 100
nchnls = 1

;------------------------------------------------------------------
instr 1 ; Hard Sync Sawtooth, Ian Sayer 20 Aug 2002
;------------------------------------------------------------------

; sync sweep start ratio, time, end ratio
aSweep line p5,p3,1

; use phasor+tablei pair
aphs phasor p4

; use aSweep to scale table index, use table wrap mode (parameter 4 = 1)
async tablei aphs*aSweep,1,1,0,1

; output result scaled to 14bits (1/2 full scale)
out async*(2^14)
endin



64Xohsy.wav
 Description:
exersize showing that oversampling can reduce alias

Download
 Filename:  64Xohsy.wav
 Filesize:  421.92 KB
 Downloaded:  472 Time(s)

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [13 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » How-tos » Production - engineering/mixing
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
mps board

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use