electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
  host / artist show at your time
today> Twyndyllyngs live tonight! Chez Mosc
 Forum index » DIY Hardware and Software » ChucK programming language
Creating a phaser using All Pass Filters
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Sat Jan 19, 2008 5:10 am    Post subject: Creating a phaser using All Pass Filters Reply with quote  Mark this post and the followings unread

Code:


SndBuf Buffer;
Gain Mixer;
1 => Buffer.loop;

DelayA Stage1;
DelayA Stage2;
DelayA Stage3;
DelayA Stage4;
DelayA Stage5;
DelayA Stage6;
DelayA Stage7;
DelayA Stage8;
Gain PhaserFeedback;

Buffer => Mixer => dac;
Buffer => Stage1 => Stage2 => Stage3 => Stage4 => Stage5 => Stage6 => Stage7 => Stage8;
Stage8 => PhaserFeedback => Stage1;
Stage1 => Mixer;
0.5 => PhaserFeedback.gain;
3 => Mixer.op;

"DC_Kit03_175_Loop3.wav" => Buffer.read;

10::second => now;



This is what I have so far. Am I going about this the right way and how would I modulate the phase using a LFO?

Thanks

Rhys
Back to top
View user's profile Send private message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Jan 23, 2008 5:46 am    Post subject: Reply with quote  Mark this post and the followings unread

This code gets better results but I still need to sync the LFO:

Code:


SndBuf Buffer;
Gain UnProcessed;
Gain Processed;
Gain Mixer;
1 => Buffer.loop;

DelayA Stage1;
DelayA Stage2;
DelayA Stage3;
DelayA Stage4;
DelayA Stage5;
DelayA Stage6;
DelayA Stage7;
DelayA Stage8;
Gain PhaserFeedback;

0.1::ms => Stage1.delay;
0.2::ms => Stage2.delay;
0.3::ms => Stage3.delay;
0.4::ms => Stage4.delay;
0.5::ms => Stage5.delay;
0.6::ms => Stage6.delay;
0.7::ms => Stage7.delay;
0.8::ms => Stage8.delay;

Buffer => UnProcessed;
Buffer => Stage1 => Stage2 => Stage3 => Stage4 => Stage5 => Stage6 => Stage7 => Stage8 => Processed;
0.5 => UnProcessed.gain;
0.5 => Processed.gain;
UnProcessed => Mixer;
Processed => Mixer;
Mixer => dac;
1 => Mixer.op;

"DC_Kit03_175_Loop3.wav" => Buffer.read;

10::second => now;

SinOsc LFO;
4 => LFO.freq;

Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Wed Jan 23, 2008 2:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

I tried it, but I don't get any noticeable effect, or maybe its the nature of my music samples. I had to modify the code at the bottom to change the .wav filename to run it. I noticed you're using 8 all-pass-filters, and each one contributes what, 90 or 180 degrees of phase delay, is that right? One of those. So with 8 of them, aren't you sort of going around the block a few times? I'm not sure if this is a standard way to do it or not, is it? I wonder why I didn't notice much effect - what effect should I have noticed?
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Jan 23, 2008 2:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hmmmm, don't those delays need a "mix" setting? Right now I think they are working as a single delay and I don't see the use of the stages?
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Jan 30, 2008 4:01 am    Post subject: Reply with quote  Mark this post and the followings unread

The DelayA Ugen has no .mix function so other than creating a separate gain for each DelayA then I'm not sure how I would mix them.

Unfortunately, I can't work out a way of making the DelayA Ugens work as separate stages?

Is this...

Code:


Buffer => Stage1 => Stage2 => Stage3 => Stage4 => Stage5 => Stage6 => Stage7 => Stage8 => Processed;



The same as...

Code:


Buffer => Stage1 => Gain Stage1Gain => Processed;
Buffer => Stage2 => Gain Stage2Gain => Processed;

etc.



I know that I'm not really supposed to change the amplitude of the signal as the original signal passes through each stage and just affect the phase. Having a separate Gain for each Stage will affect the amplitude?

Can you help a confused man out?

Thanks,

Rhys
Back to top
View user's profile Send private message
Frostburn



Joined: Dec 12, 2007
Posts: 255
Location: Finland
Audio files: 9

PostPosted: Wed Jan 30, 2008 8:17 am    Post subject: Reply with quote  Mark this post and the followings unread

I think you've misunderstood what the DelayA is.
It is not a phase delay but a regular delay that has the phase smearing as an artifact on non-integer delays.

What you need is propably OnePole with the .allpass setting.
And I say propably because I have no idea what you're trying to make.
Can you elaborate a little on what you're trying to achieve.

Hope that helps Smile, cheers

_________________
To boldly go where no man has bothered to go before.
Back to top
View user's profile Send private message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Jan 30, 2008 12:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

What I'm going for is this:

http://en.wikipedia.org/wiki/Phaser_%28effect%29

It mentions the use of All Pass filters, but in all honesty I'm stuck as to how to use them in this case.

Thanks for your help,

Rhys
Back to top
View user's profile Send private message
ian-s



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

PostPosted: Wed Jan 30, 2008 1:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

There are two distinct types of allpass.

The delay line based one which is a combination of feedforward and feedback comb filter, often used in reverbs.

The allpass filter used for the phasing effect is like a lowpass filter in it's phase response, but has a flat frequency response. You need two allpass filter poles for each phaser notch.
Back to top
View user's profile Send private message
Frostburn



Joined: Dec 12, 2007
Posts: 255
Location: Finland
Audio files: 9

PostPosted: Wed Jan 30, 2008 3:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here you go! A phaser patch:
Code:
32 => int stages; //The number of allpass filters to put in series, bigger number => bigger effect

//The Patch
Noise n => Gain in;
Gain out => dac;
n => Gain dry => out;
out => Gain feedback => in;

PoleZero ap[stages];
in => ap[0];
for(1 => int i; i < stages; i++){
    ap[i-1] => ap[i];
}
ap[stages-1] => Gain wet => out;

//Controls
0.5 => feedback.gain;
0.5 => dry.gain;
0.5 => wet.gain;


//LFO patch to sweep the notch frequency
//Sweep between 0.0 and 1.0
SinOsc lfo_sin => Gain lfo => blackhole;
1.0 => lfo_sin.freq;
0.5 => lfo_sin.gain;
Step lfo_shift => lfo;
0.5 => lfo_shift.next;

0.75 => lfo.gain;

while(true){
    for(1 => int i; i < stages; i++){
        lfo.last() => ap[i].allpass;
    }
    10::ms => now;
}


Just replace Noise n with the source of your choice.
Or better yet make a class out of this so that it can be used more readily.
I propably will, it's a cool effect, but I won't just yet take the fun out of figuring that out by yourself. :)

_________________
To boldly go where no man has bothered to go before.
Back to top
View user's profile Send private message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Jan 30, 2008 4:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

Bloody hell...

You guys never cease to amaze me with these patches, makes me feel like a complete noob, which I guess I kinda am.

I was totally thinking about this the wrong way, not to mention using the wrong kind of AllPass filter. I didn't even know there were two types! Embarassed

Thanks for the help, tis very much appreciated.

Rhys
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Thu Jan 31, 2008 1:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Wow, good phasor sound. Should I put it in the math/music project as well?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
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


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