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
poster
 Forum index » DIY Hardware and Software » ChucK programming language
Modifying SinOsc to produce harmonics
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Mon Jun 02, 2008 1:13 pm    Post subject: Modifying SinOsc to produce harmonics Reply with quote  Mark this post and the followings unread

Today I tried a bit with phase syncing with SinOsc
and turns out to hear some obvious nth harmonic when using a Phasor to phase-sync with a SinOsc,
but adjusting the Gain of the Phasor.

So, after bandpassing the exact harmonics,
the harmonics suddenly sounds very clear.

Let's make furthur use of this.
This must not be a very complex thing,
but it's easy to build and it sounds smooth.
It makes me think of building a small unit that's easier to choose harmonic number to emphasize.
Or for creating smooth harmonic-sweeping drones.

Code:
/*  SinOsc modified to produce strong n-th harmonic content version 0.1
    for ChucK programming language.
    Copyright (C) 2008 Kijjasak Triyanond (kijjaz@yahoo.com)
   
    update: June 3, 2008 by Kijjasak Triyanond

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */

Phasor a => Gain a_g => SinOsc b => BPF b_f => dac;
55 => a.freq; // set main frequency

3 => a_g.op;
1 => b.sync;

10 => a_g.gain; // chang to hear up to this number of harmonic

TriOsc lfo => a_g;

.05 => lfo.freq; // set LFO (sweep) frequency

2 => b_f.Q; // set bandpass filter Q
.5 => b_f.gain; // set overall gain

while(true)
{
    Math.fabs(lfo.last() * a_g.gain() * a.freq()) + 1 => b_f.freq;
    ms => now;
}
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
rogan



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Fri Jun 06, 2008 2:33 am    Post subject: Reply with quote  Mark this post and the followings unread

Wow. Kijjaz, this is great. I am listening to this with the sounds of birds chirping in the background (I'm up a bit late...). I'll have to look into this soon.

Edit: I just noticed that I've been listening to this on repeat for like 20 minutes. This is somewhat embarrassing, but I do really like the sound!
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Fri Jun 06, 2008 5:09 am    Post subject: Reply with quote  Mark this post and the followings unread

-_- me too .. I was listening to it for almost a hour after programming it -_-"
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 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