electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  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 » DIY Hardware and Software » ChucK programming language
Bug fix: pssshhhhttt!
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 4804
Location: Florida, USA
Audio files: 202

PostPosted: Mon Jun 08, 2009 10:30 am    Post subject: Bug fix: pssshhhhttt!
Subject description: Bug in my brain...
Reply with quote  Mark this post and the followings unread

Hi folks, I've got a quandry here. I wanted to make a drum machine based on kijjaz's drumset, ok. So I thought I would do a signal intensity level on the output and if the signal got low i would hit a drum. Well, all I get is constant drum beats. Please have a look at my code and tell me what i'm doing wrong, thanks.

Les


Drums2.ck
 Description:

Download
 Filename:  Drums2.ck
 Filesize:  4.95 KB
 Downloaded:  40 Time(s)


_________________
All your money won't another minute buy - Kansas
All play, no work, makes Les a fun guy!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Antimon



Joined: Jan 18, 2005
Posts: 2409
Location: Sweden
Audio files: 32
G2 patch files: 74

PostPosted: Mon Jun 08, 2009 11:38 am    Post subject: Reply with quote  Mark this post and the followings unread

I tried moving drums.hit() up inside the if block and then raising the LPF frequency to 100. That got a bit more space between the beats.

Code:

<...>
// the patch
drums.output => dac;
drums.output => FullRect fwr => LPF lpf => blackhole;
100 => lpf.freq;


// play the music
spork ~ play.drummer();


// time loop
while (true) {
    second => now;
}




// the player class
class player {
    float prev;
    float next;
    fun void drummer() {
        while(true) {
            next => prev;
            lpf.last() => next;
<<< "Hej", Math.fabs(next), next >>>;
            if (Math.fabs(next) <= noise) {
                drums.BD();
            drums.hit();
            }

            /*
            drums.SD();
<...>


/Stefan

_________________
@myspace @virb A blog home - in Cyberspace no one can hear you SEGV
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 2409
Location: Sweden
Audio files: 32
G2 patch files: 74

PostPosted: Mon Jun 08, 2009 11:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Clever envelope follower trick, BTW! Smile

/Stefan

_________________
@myspace @virb A blog home - in Cyberspace no one can hear you SEGV
Back to top
View user's profile Send private message Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 4804
Location: Florida, USA
Audio files: 202

PostPosted: Mon Jun 08, 2009 3:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

That and a little tweaking of the constants did the job! Thank you Stefan!

Les

_________________
All your money won't another minute buy - Kansas
All play, no work, makes Les a fun guy!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 4804
Location: Florida, USA
Audio files: 202

PostPosted: Mon Jun 08, 2009 4:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, here is the result. It is a drum machine of sorts. It does a BPF of the output signal, breaking it into bands and then envelope following each band. Each drum type (8 of them) in kijjaz's drum class triggers when it's band falls below a variable threshold. It's kinda lame but it's something, whatever...

Les


Drums3.ck
 Description:

Download
 Filename:  Drums3.ck
 Filesize:  5.78 KB
 Downloaded:  38 Time(s)


_________________
All your money won't another minute buy - Kansas
All play, no work, makes Les a fun guy!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 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
Niio1

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