Merge branch 'master' of ssh://hygiene.bl0rg.net/srv/git/arduinisten
This commit is contained in:
commit
3c2eba78f0
3 changed files with 56 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
/* TIMER_DELAY macro for convenience */
|
/* TIMER_DELAY macro for convenience, do { } while(0) is just a macro trick */
|
||||||
#define TIMER_DELAY(pt, timer, t) \
|
#define TIMER_DELAY(pt, timer, t) \
|
||||||
do { \
|
do { \
|
||||||
timer_set(&timer, t); \
|
timer_set(&timer, t); \
|
||||||
|
|
|
@ -93,12 +93,12 @@ void arpeggio_play(int32_t note, uint32_t len) {
|
||||||
// clock tick is 1s/18.2 == 54ms
|
// clock tick is 1s/18.2 == 54ms
|
||||||
#define MAGIC_CLOCK_TICK 54
|
#define MAGIC_CLOCK_TICK 54
|
||||||
#define MAGIC_DELAY_FACTOR 400 // well, should be 1000 us?!
|
#define MAGIC_DELAY_FACTOR 400 // well, should be 1000 us?!
|
||||||
#define MAGIC_BREATH 50
|
|
||||||
_delay_us(MAGIC_DELAY_FACTOR*(len*MAGIC_CLOCK_TICK/10));
|
_delay_us(MAGIC_DELAY_FACTOR*(len*MAGIC_CLOCK_TICK/10));
|
||||||
|
|
||||||
// breath
|
// breath
|
||||||
curNote=REST;
|
curNote=REST;
|
||||||
_delay_us(50);
|
#define MAGIC_BREATH 50
|
||||||
|
_delay_us(MAGIC_BREATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void arpeggio(int32_t n1, int32_t n2, int32_t n3, int32_t len) {
|
void arpeggio(int32_t n1, int32_t n2, int32_t n3, int32_t len) {
|
||||||
|
|
53
projekte/soundz/quak/quak.pde
Normal file
53
projekte/soundz/quak/quak.pde
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
byte foo;
|
||||||
|
int bar;
|
||||||
|
byte mul;
|
||||||
|
byte cnt;
|
||||||
|
float wow;
|
||||||
|
boolean b;
|
||||||
|
int inv;
|
||||||
|
|
||||||
|
#define WOW_FACTOR 512
|
||||||
|
#define WOW_LIMIT 4
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(8, OUTPUT);
|
||||||
|
cnt = 0;
|
||||||
|
mul = 1;
|
||||||
|
wow = WOW_FACTOR;
|
||||||
|
inv = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
if( cnt == 0 ) {
|
||||||
|
mul = random(6)+1;
|
||||||
|
cnt = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
cnt--;
|
||||||
|
|
||||||
|
foo = random(5*mul)+2;
|
||||||
|
|
||||||
|
for(bar = 0; bar < (255-(foo*20)); bar++) {
|
||||||
|
|
||||||
|
|
||||||
|
if( inv == 1 )
|
||||||
|
wow /= 2;
|
||||||
|
else
|
||||||
|
wow *= 2;
|
||||||
|
|
||||||
|
if( wow < WOW_LIMIT || wow > WOW_FACTOR ) {
|
||||||
|
inv = inv == 1 ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(8, b = !b);
|
||||||
|
delayMicroseconds((WOW_FACTOR+(wow*inv))*foo+(bar*2*b));
|
||||||
|
|
||||||
|
// NOISE
|
||||||
|
if( random(10) == 0 ) {
|
||||||
|
digitalWrite(8, b = !b); delayMicroseconds(4500); digitalWrite(8, b = !b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue