My poor daughter is sick right now, perhaps the swine flu. But thursday evening I finished this for her. She likes it alot, and that makes me happy.
Category Archives: Uncategorized
A grinder of coffe I found!
I found a coffe-grinder at a secondhand market today. It was 140Sek so I just bought it. After I tore it apart, cleaned it (spiderweb and stuff) put it together again. After spending more time to get it to grind so very small then I did waiting for it to dry after the cleaning. Then I made a latte and drank it. Here are some pictures:
New books.
I’m on a netabel!
Not a boat, but nice still. After a little help with the artwork I now have a release over at http://www.hexawe.net/ hex002B_green_worm_boogie <– that’s me.
If you read the release text with the downloadable zip at hexawe you will read:
Yeah, so friends.
Here we go, hexawe, Hooray.
I’d like to greet all the piggaz at #hexawe, and dmusta1ne for listening to this little track and giving me critique, all the peeps in the LGPT scene.
Made on a Dingoo A320, sitting on a rock while my kids played on the playground and on the train going back and forth to work.
Lined in and recorded to computer from the Dingoo. Well
yeah. Nothing else. Hooray!
A great big thanx to Caotix who took my original coverartidea and created the masterpiece you see in this release.
Find more of my stuff over at http://www.larsby.com/johan
Tentacle-box, mobile musicstation with beatsynched lights.
Since I don’t get enough gigs, or any at all, I though I’d make a sound-system so I could go wherever and play a little show. So I decided to build a sound system that was moderately movable and would work of the grid.
Features:
So a featureset that I though was the least I could work with was this: It should be able to work without being connected to an outlet. It should have lights and it shouldn’t be to heavy to move around. Ateast not by a small wagon. And it should be loud. Not Mötorhead loud but loud enough. It should also be cheap enough so that I would not cry if it got trashed or stolen after a few gigs/parties.
Materials:
So what do I need to get this together? some sort of battery, and a way to charge it. Luckily there are these car-starters charger thingys that you should use as help of your car battery dies. I bought one of those. Then a car-stereo I found. One that takes memory cards and USB-sticks and has a line in on the front. To control the lights I needed an Arduino, a few LED’s for the lights (I bought 200) and some sort of measuring the beat so that the lights could be synced to the tempo of the songs. I thought I could use a piezo and do the Arduino knock example, but later experimentation showed that I had to settle for a button-based solution.
The build:
A box takes time to build, and woodworking is not my passion. So I went and gotten a box. It used to house a philips radio, way back when you did not have any TV’s. There was mirrors and everything in that box. but the back was just paper so I had to reinforce it. I mounted the speakers there and also the LED’s. I arranged the LED’s in groups to enhance the amount of light. Half of them are blue and half are white. The LED obscuring part did not work as I thought it should, But the results was OK anyways. As for the tentacle-painting. I don’t know. I like tentacles, not in a Hentai/Manga way, but just the cartoonish style of them.
The Arduino code:
The code is pretty basic. It multiplexes the led’s so that I did not have to add a shift registers. It also reads a button so that I can sync the lights by tapping. the code is pretty self-explanatory.
//tempo variables
byte tempo=120;Â /* bmp of our sequence */
long rememberMillis=0;
long timeChange=250; /*a variable for calculating how long we are going to wait*/
//The light's stuff
int ledColWhteAndBlueRing[8] = {
6,9,3,5,2,4,10,8 }; //these are the blue led's in order. Why no pin7? why not in order? Lazy at the wrong time I guess
int ledColSmall[8] = {
3,2,9,6,4,8,10,5 };
// tap button
#define tapButton 14
byte tapButtonState;
byte lastTapButtonState = LOW;
long tapOldTime =0;
long lastDebounceTime = 0;Â // the last time the output pin was toggled
long debounceDelay = 50;Â Â Â // the debounce time; increase if the output flickers
boolean justPressed = false;
byte currentLamp=0;
#define lampChange 100
int lampCounter=0;
float ix=0.0;
float ib=0.0;
float is=0.0;
float ixSpeed=1.0/4.0;
float ibSpeed=1.0/4.0;
float iySpeed=1.0/4.0;
int lampFrame[3][8]=
{
{Â Â Â 1,0,1,0,1,0,1,0Â Â Â Â Â }
,
{Â Â Â 0,1,0,1,0,1,0,1Â Â Â Â Â }
,
{Â Â Â 0,0,0,0,0,0,0,0Â Â Â Â Â }
};
void setup()
{
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
pinMode(tapButton,INPUT);
/*starting the builtin pullup-resistor!*/
digitalWrite(tapButton,HIGH);
for (int i=0; i<8;i++)
pinMode(ledColWhteAndBlueRing[i], OUTPUT);
/*calculating the timeChange variable. milliseconds divided by
tempo and 16th note, or something like that. I dont remember*/
timeChange=((60000/tempo)/8);
rememberMillis = millis();
}
void workSmall()
{
digitalWrite(11,LOW);
for (int i=0; i<8;i++)
if(lampFrame[2][i]==1)
digitalWrite(ledColSmall[i], HIGH);Â Â // set the LED on
else
digitalWrite(ledColSmall[i], LOW);Â Â // set the LED on
delay(1);
digitalWrite(11,HIGH);
}
void workWhite()
{
digitalWrite(13,LOW); //White
for (int i=0; i<8;i++)
if(lampFrame[1][i]==1)
digitalWrite(ledColWhteAndBlueRing[i], HIGH);Â Â // set the LED on
else
digitalWrite(ledColWhteAndBlueRing[i], LOW);Â Â // set the LED on
delay(1);
digitalWrite(13,HIGH); //White
}
void workBlue()
{
digitalWrite(12,LOW); //Blue
for (int i=0; i<8;i++)
if(lampFrame[0][i]==1)
digitalWrite(ledColWhteAndBlueRing[i], HIGH);Â Â // set the LED on
else
digitalWrite(ledColWhteAndBlueRing[i], LOW);Â Â // set the LED on
delay(1);
digitalWrite(12,HIGH); //Blue
}
void moveLamps1()
{
for (int i=0; i<8;i++)
{
lampFrame[0][i]=0;
lampFrame[1][i]=0;
lampFrame[2][i]=0;
}
lampFrame[0][int(ix)]=1;
lampFrame[1][int(ib)]=1;
lampFrame[2][int(is)]=1;
ix+=(ixSpeed);
if (ix>8)
ix=0;
ib+=(ibSpeed);
if (ib>8)
ib=0;
is+=(iySpeed);
if (is>8)
is=0;
}
void moveLamps2()
{
for (int i=0; i<8;i++)
{
if (int(ix)==1)
lampFrame[0][i]=0;
else
lampFrame[0][i]=1;
if (int(is)==1)
lampFrame[1][i]=0;
else
lampFrame[1][i]=1;
if (int(ib)==1)
lampFrame[2][i]=0;
else
lampFrame[2][i]=1;
}
ix+=(ixSpeed);
if (ix>2)
ix=0;
is+=(iySpeed);
if (is>2)
is=0;
ib+=(ibSpeed);
if (ib>2)
ib=0;
}
void moveLamps3()
{
for (int i=0; i<8;i++)
{
lampFrame[0][i]=0;
lampFrame[1][i]=0;
lampFrame[2][i]=0;
}
lampFrame[0][int(ix)]=1;
lampFrame[1][int(ib)]=1;
lampFrame[2][int(is)]=1;
ix-=(ixSpeed);
if ((int)(ix)<0)
ix=7;
ib-=(ibSpeed);
if ((int)(ib)<0)
ib=7;
is-=(iySpeed);
if ((int)(is)<0)
is=7;
}
void checkButtons()
{
int reading = digitalRead(tapButton);
if (reading != lastTapButtonState)
{
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay)
{
tapButtonState = reading;
if(tapButtonState==true && justPressed==false)
{
//this is the most basic tempo calculation I could think of
justPressed=true;
timeChange= (millis()-tapOldTime)/8;
tapOldTime=millis();
}
else if (tapButtonState == false)
{
justPressed=false;
}
}
lastTapButtonState = reading;
}
void randomizelampSpeed()
{
ix=(rand()%4)+2;
is=(rand()%4)+2;
ib=(rand()%4)+2;
ixSpeed=1.0/((rand()%6)+2);
ibSpeed=1.0/((rand()%6)+2);
iySpeed=1.0/((rand()%6)+2);
}
/*our main baby */
void loop()
{
workSmall();
workWhite();
workBlue();
if( (millis()-rememberMillis) > (timeChange)) //this is one
{
rememberMillis=millis();
switch(currentLamp)
{
case 0:
moveLamps2();
break;
case 1:
moveLamps1();
break;
case 2:
moveLamps3();
break;
default:
break;
}
lampCounter++;
if (lampCounter >= lampChange)
{
currentLamp = rand()%3;
lampCounter =0;
randomizelampSpeed();
}
}
checkButtons();
}
Is it broken?
While I was documenting that sticker I’m making for the macbook I’ve ordered I accidentally dropped my camera 10cm. It landed on the lens. The lens got pushed in and looked totally broken. While trying to fix it it suddenly looked like this:
I managed to get it together again, and it’s working. I’m able to take photos with it, but it does not want to retract again.
I dont have any warranty left on it, it’s over 2 years, atleast. Sure I have an insurance but if I excercise that one, I will have to pay more for the insurance later on.
A new camera needs to be bought, I’ll look around, see what I can find. probably it will be the same series. Unless anyone have a tip?
What I’m looking for is:
- Fast to start.
- Good quality images
- Battery that are either interchangable or lasts forever.
- Takes SD-Cards
- Works well during poor lightning.
The one I broke was a Fujifilm Finepix F40FD
Another crochet pouch
I’m having some kind of flu, makes my bodily functions work in mysterious ways. Still you would think that since I’m feeling sick all the time I would loose some wight (geekbeach ftw!) but sadly no. I hardly move. To get my mind of off feeling sick I’ve crocheted some more things. Some of them are going to be gifts so I wont show them. This little cellphonepouch I made for my wife I can post a picture of though. I’ve gotten better on keeping it straight, and I’ve even tried to add a little flare on this one. It’s an L if you’re wondering.
Now I’m gonna make pot-holders for EVERYONE for Christmas.
Geekbeach, what is it and how do I make one?
It’s a competition me and a few friends/colleagues have been working on to loose weight. You see, we are all in the IT business and consequently we are pale, slightly overweight men. We all have previously made halfheartedly attempts at losing weight on our own. Since that did not work we decided to make things more interesting. Alas, getting fitter can be a competition.
So we did just that in 2007; decided on a prize, made the rules, took measurements and started logging and blogging. It went awesome, I won by loosing 10kg :). But since then a few years have passed and the lost weight have been regained so a new GeekBeach was due. This time, the affair quickly grew to a pretty large number of participants. We even had to turn people down. That is why I am writing this guide to what to think of when having a go at the GeekBeach method yourselves, which you should.
Clear rules: It’s important to have rules that everybody understands and agrees on.
Personal progress = win: During the first GeekBeach the winner was the person with the greatest percentage of weight loss, added to the percentage lost in waist circumference. That means that the one who lost most weight and got to buy new trousers the most won. It also means that you compete against your own body, not to some ideal that everybody wants to reach. Well you understand percentages I hope. In the 2010 edition, the winner will be the one with the best combination of percent body fat lost and muscle mass gained. At the start we all went to a gym where they have an expensive fat-measuring apparatus. I was a little horrified to know that 26.6% of my body is fat.
A long time span:Â If you want the new slender you and your newly acquired good habits to stick, you need to make this event last a few months. I think 4-6 months is the time span you should try to aim for. A semi-goal/measurement or as we call it the “sprint”-price is made 1 or 2 months in to the competition. The winner gets a small price.
Price money:Â We decided to put down 500sek each. That is enough to buy a nice suit for the winner.
Price money:Â Collect the price money at sign up. The bastards who chickened out/lost at Geekbeach2007 haven’t payed the winner yet.
Proximity: It’s good to meet the people you are in this with on at least a weekly basis.
Blog: This is probably one of the most important parts. You generate a buzz around your GeekBeach competition, and friends and loved ones can follow you. Another important thing is to make it a multi-user blog, with a page per participant. Have a look at the one I’m participating in to get an idea. Don’t worry if you don’t know Swedish, you’ll get the idea.
Preferred weight losing methods: This is one of the beauties with GeekBeach, there are is no set diet or training regimen. Use whatever rocks your boat. From GI to daily workouts to Tantric yoga to method x.
Statistics: Be sure to post updates on your progress. This will bring motivation to all invested in the competition.
Geekbeach is like fight club without the fist fights and the charismatic schizophrenic leader.
More lgpt awesomeness and new hardwave.
I have bought new hardware. Hooray!
The new one is the top one, it’s a Dingoo A320 made by Shenzhen Dingoo Digital. The Dingoo is a nice little piece of machinery. A few of the things I like about it are:
- Opensource’d development enviroment
- Form factor of a Nes-controller
- 7hour battery time.
- It runs LGPT
- It boots in 4 seconds.
- It’s supposed to be some sort of Communistic statement from the Chinese government.
So yes I was really excited to exchange my gp2x f200 with it’s bulky size and long boot time for something younger and slimmer :). After installing a new firmware and a Linux variant called Dingux I was up and running. Hooray. After using it on the train (with a little scare where I could not get audio out from the headphones since I put it in the wrong hole (video out instead of headphones)) I was up and piggin. The awkward placement of the headphone jack wasn’t that awkward after all.
I noticed a few things that wasn’t one hundred percentage super sweet, one was the volume, you couldn’t get the piggy running at a nice volume on the speakers, and you have to exit the piggy, reboot into the original OS to quit. The first was fixed by mashing X, it is a hidden feature. The second was fixed with a new version of the Linux. Hooray.
What better way to celebrate this then to make a tune from beginning to end? NONE, so I’ve made this song in the style of booring techno with only one note, the note of D. Yup, only D. the note D.
Here’s the lgpt project folder: lgpt_dingo_1
And here’s the song i mp3 format:Â lgpt_dingo_1
Decompression glitches for sound generation.
The art of using compression glitches as visual tools for creating art has been around a some time now. Datamoshing yields many hits, as do glitch. But how could you apply the same effects to audio and get more interesting results then we have to day with the mp3 FFT artifact?
That question was thrown out in a conversation between me and Rosa late one night at Norbergfestivalen. I recently met her when we carpooled to the festival. Anyways, she’s writing her doctorate about these things and that was one of the questions she was thinking about. To bad she addressed that to me, because I started thinking about it also.
I’ve gone through and tried a few things, but none of them sounded very good. Basic RLE decoding of data to a waveform. Fourier compression data corruption test’s. Packaging raw data in a zip-file, change the contest of the zip data, and then re-import the raw-data. Â None of these where very interesting, but they are easy to do without any programming. I also listened to the scratched mp3-cd’s I have in my car. Where the most interesting effects where a sort of LP-like stuttering. But not interesting enough.
So what to do to make things a little more interesting? Well one has to look at the problem from another angle I suppose.
I have to create a compression-algorithm that makes more sense to break. Sounds stupid? I guess, but if we cant be stupid for the sake of art or comedy when are we allowed to be stupid?
Right. I came up with a modified RLE-algorithm. It’s pretty basic. waveforms are 2D, and the next sample can move up, down, or not move at all. With that you can compress your data with information on where to move for the next sample, and if there is a pattern to it it’s easy to find and repeat. A triangle example follows the data could be: “move up 1 step for every sample 127 times”.
This can also make for seriously fun glitches if you edit the compressed data, or as nice samples if you just randomly generate the compressed data.
As you can see below the implementation is very naive, there are no key frames, the comparison algorithm works by stripping away data (converting from double to float). One could also implement a better RLE that finds patterns. None of this however was very important for me when I wanted to test this idea.
There are a few parameters I’ve been toying around with on a few different wav files. These have yielded results that I’m mildly satisfied with. I don’t know what my expectations where when I started out on this journey, but there has been some success.
I tried it out on a few different sounds, the result’s are a little longer and they don’t share parameters:
bicycle_bell
bicycle_bell_glitched
scream_females.wav
scream_females_glitched
I’ve toyed with the parameters in injectErrors() function. as you can se from the commented out code there are a few different things to play with when trying out the algorithm.
Where to go now?
Well I don’t know, perhaps wrap this in a standalone program, look more into other compression techniques  to try out, make a VST out of it. Maybe I’ll just leave it. Possibly I’ll try to make some nice noise songs with this as either a generation device or as an effect on noisy samples. Most possibly I’ll let it mutate itself over time, feeding the same sample back over and over and over and over. Maybe one should try and apply this to MIDI note data. That could be awesome.
#include "stdafx.h"
#include "wav.h"
#include "wav_save.h"
#include
SoundDataStruct* p_wav;
void compressWaveform()
{
int i;
//first run is to change everything to relative path's
double oldData = p_wav->dataP[0];
p_wav->dataRLEWP[0] = p_wav->dataP[0];
for (i = 1; i < p_wav->length; i++)
{
p_wav->dataRLEWP[i] = oldData - p_wav->dataP[i];
oldData = p_wav->dataP[i];
}
p_wav->keyframedata = (keyFrameStruct*)malloc(sizeof(keyFrameStruct)*(p_wav->length/100));
//add keyframes
int pos=0;
for (i = 1; i < p_wav->length; i+=100)
{
p_wav->keyframedata[pos].data=p_wav->dataP[i];
p_wav->keyframedata[pos].position =i;
pos++;
}
//now we RLE Encode it for real.
int writeplace=0;
for (i = 0; i < p_wav->length; i++)
{
int runLength = 1;
while( i+1 < p_wav->length && (float)p_wav->dataRLEWP[i] == (float)p_wav->dataRLEWP[i+1] ) {
runLength++;
i++;
}
p_wav->dataRLEP[writeplace]=runLength;
writeplace++;
p_wav->dataRLEP[writeplace]=p_wav->dataRLEWP[i];
writeplace++;
}
p_wav->RLELengthP = writeplace;
printf("compression is %d \n",p_wav->length-p_wav->RLELengthP);
}
double clamp(double in)
{
if(in>1.0)
return 1.0;
else if(in<-1.0)
return -1.0;
else return in;
}
void decompressWaveform()
{
int i,x;
int writeplace =0;
int newLength=0;
//find length for the new sample.
for (i = 0; i < p_wav->RLELengthP; i+=2)
newLength+=p_wav->dataRLEP[i];
printf("newLength % = %d \n ",newLength);
p_wav->dataU = (double *)malloc(sizeof(double)*newLength);
p_wav->dataRLEWU = (double *)malloc(sizeof(double)*newLength);
//undo RLE Encoding
for (i = 0; i < p_wav->RLELengthP; i+=2)
{
for(x=0;x<(int)p_wav->dataRLEP[i];x++)
{
p_wav->dataRLEWU[writeplace] = p_wav->dataRLEP[i+1];
writeplace++;
}
}
p_wav->RLEWLengthU = writeplace;
//undo RLEW Encoding
int pos=0;
p_wav->dataU[0]= p_wav->dataRLEWU[0];
for (i = 1; i < p_wav->RLEWLengthU; i++)
{
p_wav->dataU[i] = p_wav->dataU[i-1]+p_wav->dataRLEWU[i];
p_wav->dataU[i] = clamp(p_wav->dataU[i]);
}
}
void compareWaveforms()
{
int i;
if(p_wav->length != p_wav->RLEWLengthU)
{
printf("data not equal\n");
printf("%d\n",p_wav->length);
printf("%d\n",p_wav->RLEWLengthU);
}
for (i = 0; i < p_wav->RLEWLengthU; i++)
{
if(i>p_wav->length)
break;
if(i>p_wav->RLEWLengthU)
break;
}
}
void injectErrors()
{
int i=0;
//randomizing number of repeat's
for (i = 0; i < p_wav->RLELengthP; i+=2)
{
if(rand()%200==1)
{
p_wav->dataRLEP[i]=(rand()%512)+1024;
// p_wav->dataRLEP[i] -= ((double) (rand() / (double)RAND_MAX)*0.4f)-0.2f;
p_wav->dataRLEP[i] -= ((double) (rand() / (double)RAND_MAX));
}
}
//randomizing data to repeat
for (i = 1; i < p_wav->RLELengthP; i+=2)
{
if(rand()%4000==1)
{
//p_wav->dataRLEP[i] -= ((double) (rand() / (double)RAND_MAX)*0.4f)-0.2f;
}
}
}
void savewav()
{
float calculatedlengthofnewsample = float(p_wav->RLEWLengthU)/44100.0;
Init_save(calculatedlengthofnewsample+1.0);
int i;
for ( i=0; i
RLEWLengthU; i+=1 )
{
SaveWavData(i, p_wav->dataU[i] );
}
Do("temporary.wav"); //save might crash if called to many times
freemeData();
//---------- end render block
}
int _tmain(int argc, _TCHAR* argv[])
{
srand( 1234 );
/* get input wav */
p_wav = (SoundDataStruct*)malloc(sizeof(SoundDataStruct));
wav_init( "bicycle_bell.wav", p_wav );
compressWaveform();
decompressWaveform();
compareWaveforms();
/* the fun begins here*/
injectErrors();
decompressWaveform();
compareWaveforms();
/* save wav */
savewav();
return 0;
}