Csound Csound-dev Csound-tekno Search About

Re: Pulse width modulation!

Date1998-12-12 15:37
FromHans Mikelson
SubjectRe: Pulse width modulation!
Here is another:

http://csound.ml.org/msg00302.html

Regards,
Hans Mikelson



Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa18882;
          12 Dec 98 16:20 GMT
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 1.92 #2)
	for jpff@maths.bath.ac.uk
	id 0zormd-0002yu-00; Sat, 12 Dec 1998 16:20:43 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (QAA24837); Sat, 12 Dec 1998 16:19:11 GMT
Received: from exeter.ac.uk by maths.ex.ac.uk; Sat, 12 Dec 1998 16:19:03 GMT
Received: from root@lix.intercom.es [194.179.21.2] by hermes via ESMTP (QAA21301); Sat, 12 Dec 1998 16:19:01 GMT
Received: from intercom.es (iv2-47.intercom.es [195.76.206.47]) by lix.intercom.es (8.7.3/8.6.12) with ESMTP id RAA05859; Sat, 12 Dec 1998 17:12:52 +0100
Message-ID: <3670F764.7E42E22D@intercom.es>
Date: Fri, 11 Dec 1998 11:43:48 +0100
From: Josep M Comajuncosas 
X-Mailer: Mozilla 4.05 [en] (Win95; I)
MIME-Version: 1.0
To: zarmzarm@erols.com
CC: Csound mailing list 
Subject: Re: Pulse width modulation!
References: <366F2C5A.655C@erols.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Paul Winkler wrote:

> This should please the analog fans...
>
> Some time ago there was a discussion of simulating pulse width
> modulation. I don't remember anyone posting a solution. Well, the other
> day, inspiration struck, and I came up with the idea to do it by
> indexing a square wave in a funny way...

Horror! a graphycal approach to PWM synthesis guarantees massive
aliasing
;-)Unless you plan to use it for techno hardcore I strongly reccomend to
get
PWM waves in the following way:

Generate 2 pulses with "buzz"
Delay de second pulse a fraction of the cicle (this sets the pw amount)
with
"delay" (or with deltapi if you want to change the pw factor on the fly)
Substract the second pulse from the first (or viceversa)
Integrate the previous result with "integ"

It will sound much better by sure, because all the process is
bandlimited.

Josep M Comajuncosas




Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa20441;
          13 Dec 98 7:49 GMT
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 1.92 #2)
	for jpff@maths.bath.ac.uk
	id 0zp6HE-0003i0-00; Sun, 13 Dec 1998 07:49:16 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (HAA13902); Sun, 13 Dec 1998 07:46:28 GMT
Received: from exeter.ac.uk by maths.ex.ac.uk; Sun, 13 Dec 1998 07:46:16 GMT
Received: from root@ax-nicb.axnet.it [194.184.60.149] by hermes via ESMTP (HAA18222); Sun, 13 Dec 1998 07:46:13 GMT
Received: (from nicb@localhost)
	by ax-nicb.axnet.it (8.8.8/8.8.8) id IAA16971;
	Sun, 13 Dec 1998 08:45:22 +0100
Date: Sun, 13 Dec 1998 08:45:21 +0100 (ROM )
From: Nicola Bernardini 
To: Csound Linux/Unix Development Group , 
    Linux Audio Development Mailing list , 
    Csound mailing list 
Subject: [ANNOUNCE] unofficial linux csound 3.49.3.3e available
Message-ID: 
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Subject: [ANNOUNCE] unofficial linux csound 3.49.3.3e available

The unofficial 3.49.3.3e distribution of linux csound is available from
the AIMI server

ftp://musart.dist.unige.it/pub/CSOUND/csound-3.49.3.3e-*.tar.gz

in binary form (dynamically linked), binary form w/o X11 support (dynamically
linked) and source form.

	*THIS IS NOT THE OFFICIAL DISTRIBUTION*

The official distribution can be found at
ftp://ftp.maths.bath.ac.uk/pub/dream/newest. The official 3.493 sources
are of course the hard work of J.P.Fitch (jpff@maths.bath.ac.uk).

This distribution features a merged port of the official 3.493 sources,
ALSA (i.e. free full-duplex and multiple cards) I/O drivers (by Fred
Floberg), linux scheduler priority control (by Fred Floberg),
improved MIDI out device control (by Dave Phillips and Paul Barton-Davis),
initial support of the 'control' and 'cdisplay' opcodes under unix
(no sliders yet, by Nicola Bernardini), and long option support (by
Fred Floberg). Many others have contributed in useful comments and hints.

Thanks to all,

Enjoy.

------------------------------------------------------------------------
Nicola Bernardini
E-mail: nicb@axnet.it
 
Re graphics: A picture is worth 10K words -- but only those to describe
the picture.  Hardly any sets of 10K words can be adequately described
with pictures.



Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa20461;
          13 Dec 98 7:56 GMT
Received: from [139.130.53.38] (helo=toad.ilogic.com.au ident=majordomo)
	by shaun.maths.bath.ac.uk with esmtp (Exim 1.92 #2)
	for jpff@maths.bath.ac.uk
	id 0zp6Nh-0003iI-00; Sun, 13 Dec 1998 07:55:57 +0000
Received: (from majordomo@localhost)
	by toad.ilogic.com.au (8.8.7/8.8.7) id SAA23570
	for csound-unix-dev-list; Sun, 13 Dec 1998 18:46:58 +1100
X-Authentication-Warning: toad.ilogic.com.au: majordomo set sender to owner-csound-unix-dev@ilogic.com.au using -f
Received: from ax-nicb.axnet.it (root@ax-nicb.axnet.it [194.184.60.149])
	by toad.ilogic.com.au (8.8.7/8.8.7) with ESMTP id SAA23565
	for ; Sun, 13 Dec 1998 18:46:27 +1100
Received: (from nicb@localhost)
	by ax-nicb.axnet.it (8.8.8/8.8.8) id IAA16971;
	Sun, 13 Dec 1998 08:45:22 +0100
Date: Sun, 13 Dec 1998 08:45:21 +0100 (ROM )
From: Nicola Bernardini 
To: Csound Linux/Unix Development Group , 
    Linux Audio Development Mailing list , 
    Csound mailing list 
Subject: [CUD] [ANNOUNCE] unofficial linux csound 3.49.3.3e available
Message-ID: 
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-csound-unix-dev@ilogic.com.au
Precedence: bulk

Subject: [ANNOUNCE] unofficial linux csound 3.49.3.3e available

The unofficial 3.49.3.3e distribution of linux csound is available from
the AIMI server

ftp://musart.dist.unige.it/pub/CSOUND/csound-3.49.3.3e-*.tar.gz

in binary form (dynamically linked), binary form w/o X11 support (dynamically
linked) and source form.

	*THIS IS NOT THE OFFICIAL DISTRIBUTION*

The official distribution can be found at
ftp://ftp.maths.bath.ac.uk/pub/dream/newest. The official 3.493 sources
are of course the hard work of J.P.Fitch (jpff@maths.bath.ac.uk).

This distribution features a merged port of the official 3.493 sources,
ALSA (i.e. free full-duplex and multiple cards) I/O drivers (by Fred
Floberg), linux scheduler priority control (by Fred Floberg),
improved MIDI out device control (by Dave Phillips and Paul Barton-Davis),
initial support of the 'control' and 'cdisplay' opcodes under unix
(no sliders yet, by Nicola Bernardini), and long option support (by
Fred Floberg). Many others have contributed in useful comments and hints.

Thanks to all,

Enjoy.

------------------------------------------------------------------------
Nicola Bernardini
E-mail: nicb@axnet.it
 
Re graphics: A picture is worth 10K words -- but only those to describe
the picture.  Hardly any sets of 10K words can be adequately described
with pictures.



Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa20659;
          13 Dec 98 11:08 GMT
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 1.92 #2)
	for jpff@maths.bath.ac.uk
	id 0zp9Ne-0003qM-00; Sun, 13 Dec 1998 11:08:06 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (LAA13818); Sun, 13 Dec 1998 11:07:00 GMT
Received: from exeter.ac.uk by maths.ex.ac.uk; Sun, 13 Dec 1998 11:06:48 GMT
Received: from smtp2.erols.com [207.172.3.235] by hermes via ESMTP (LAA15950); Sun, 13 Dec 1998 11:06:47 GMT
Received: from oemcomputer (209-122-225-53.s53.tnt1.nyw.erols.com [209.122.225.53])
	by smtp2.erols.com (8.8.8/8.8.5) with SMTP id GAA19242;
	Sun, 13 Dec 1998 06:07:34 -0500 (EST)
Message-ID: <36739FEB.663B@erols.com>
Date: Sun, 13 Dec 1998 06:07:23 -0500
From: Paul Winkler 
Reply-To: zarmzarm@erols.com
X-Mailer: Mozilla 3.03 (Win95; I)
MIME-Version: 1.0
To: Josep M Comajuncosas 
CC: Csound mailing list 
Subject: Re: Pulse width modulation!
References: <366F2C5A.655C@erols.com> <3670F764.7E42E22D@intercom.es>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Josep M Comajuncosas wrote:
> Horror! a graphycal approach to PWM synthesis guarantees massive
> aliasing
> ;-)Unless you plan to use it for techno hardcore

Maybe. :)

> I strongly reccomend to
> get
> PWM waves in the following way:
(snip)
> It will sound much better by sure, because all the process is
> bandlimited.

I found your old message where you posted an example orc. Your approach 
does sound a lot nicer on the higher notes. *BUT*...

--it requires sr=kr which I frequently don't like.
--First impression: it sounds subjectively weaker in the bass compared
to my approach. Maybe that's fixable.
--it glitches badly below 50 hz, and I don't understand your approach
well enough to fix that.

Today I spent some time playing with another approach:
use sine wave as the index to a table containing a straight line from -1
to 1. Amplify the index so that the output is clipped to a pseudo-square
wave, but add an offset to the index so that it's asymmetrical (at large
offset, it looks a lot like a narrow pulse). So the offset is our
"width" control. The trick is to limit the amplification and offset  as
frequency goes up, so that at higher pitches, the output gets closer and
closer to a sine wave.  This sounds a lot like my original version but
with a lot less aliasing (though there still is some).

I'll post it when I've got it  cleaned up and tweaked a bit better.

--P