How I made a twitterbot for fun and profit! part 2

Back to the bot. The twitter-bot. The Lars Ulrich twitter-bot. The Lars Ulrich swearing twitter-bot. He’s up and running, spreading obscenities all over the internets. Check him out at http://twitter.com/i_am_larsulrich

The engine I was planning on using didn’t do what I  wanted it to do (search) so I went with twitter4j and processing (processing to the rescue).

There are a lot of other bot’s you could build for example a “silent bob” bot, that twitters silent comments beavis or butthead bot’s that search for bad words and replies to those twitters in a “huh huh huh you say *”

I’ve included the source of the bot down after the jump for you to build further on if you want to, the whole shebang is also available here for you to download: i_am_larsulrich.zip

Continue reading

I made an art

So, I made an artsy video, with artsy sound, like art-music. Now let me try and make an artsy description of my art.

The video is a one-clip recording of the teeth of a subject. Teeth that are bad, and in need of cleansing. The teeth in the video does not look like the look anymore, since loads of money have been put into fixing them. The sound scape you hear with the video is the sound of cleansing teeth, spitting out debris and other bodily sounds.

While I think of a way to use juxtapose in the description please have a look at :

Plain white MacBook made awesomer!

When pondering if I should buy a MacBook or a MaxBook Pro one thing that talked against the MacBook was it’s plain whiteness. I decided for the cheaper alternative but I did not accept the whiteness. This is my journey towards getting this awesome tentacles on my computer.

1

The first thing I did whas deciding on a motive, and there are a lot of nice things to do and loads of inspiration to get at such places as deviantart and the internet in general. A few things I really liked was the snowwhite motives that are available to buy. But by this time I was so set on making something unique. So I made a tentacle motive.
Since I cant draw very well this proved to hard so I cheated 🙂 a few google imagesearch I found a bunch of tentacles that I could use. These I “photoshoped” together and printed. After that I stenciled that image with the help of a window and the sun.

2

Ten I photographed this image in a better setting. Then back to the computer to and some searching on the internet. I looked around for skin shops and or sticker places that could do a good job. But I found no skin that I liked and all the “convert photo to sticker for your computer” places had no way of telling where the apple would be. I did not want to loose the glowing apple. Then I found  a local place www.stickit.se/ and they had this vinylcutter service. Excellent. But they wanted an EPS. So I had to learn how to do one. I could try and redraw my image in some program that makes vectors, but that seemed hard and time-consuming. But I remembered Inkskape that I used before and behold I rememberd correctly. Inkscape can export EPS files. Then luck stroke again, delineate takes an image and converts it to SVG. After playing with the contrast and brightness levels I got this picture that that translated into a EPS beautifully.

3

So yeah, I sent the EPS to stickit and they sent me the plastic and all I had to do was to transfer it onto my computer. I’m very satisfied with the result.

Very satisfied!

Friday night, glitchnoisefight

I’m sitting here, home with the kids sleeping. After riding my exercise bike for a while I decided I should make some sort of song. A little laid back glitch thingy I though. but it became a little more noisy then I though it would. And not very melodic.

I’m off to bed soon, and it’s probably a mistake publishing this song before it have had a little time settle. I mean, a good rule of thumb is not to play a song to anyone until you’ve slept on it.

Tomorrow I’m going to make a present for my kid sister.

Glitchnoise-experimentation1

That VST idea I had

Do you remember this VST idea I had http://www.larsby.com/johan/?p=187 ? Well I tried it out. Not fully, but close enough.
In Ableton Live I added a beat, then I recorded midi of me banging to it in different variations. Then I put that through the Live randomizer and then the scale plugin. The scale plugin was fixed so that notes could not clash with each other. Then I recorded the output of that midi data into a few tracks with softsynths. It sounds pretty art musicy, but still good. I wonder if I should program the VST or just wait for max 4 Live.

Anyways here is the mp3 you’ve been waiting for: testing the melody generation idea

Making a gift

I made this photo as a present for my friend Christian. I also made the frame, it’s not as awesome as the picture though.

The idea came when I bought that hat, in Swedish it’s called a sydvest, and I was parading around the office with it, I threw the idea out that one should make a “old fisherman” style photo, here is one I found on the internets to let you get the idea. The corn pipe was the cheapest I could find. I don’t really cared to put a lot of money on that prop. The kids want it to blow bubbles with tough.

So the kids and I had an evening of shaving, putting up lights, taking photos and manipulate them. The next day I ordered a 40*50cm large photo. It arrived the next day (yesterday) so I made a frame quick and dirty so I could give it to Christian today. All I hope for now is a laugh and that he really hangs it in his bedroom as he promised 🙂

Finaguppen

UPDATE: The gift was delivered and was well received! all is happy rejoice!

Digital rust, creating a feedback-loop to destroy audio.

So I was not at ease after creating Decompression glitches for sound generation but needed to explore this more. I was thinking that if you could feed the glitched sample back into the algorithm over and over again it could create something nice. something noisy, something full of love. So I did do the necessary changes after the perfect phrase had come to me during almost throwing up while taking the train home from work. You see, I think I had some sort of food poisoning, but the whole time I was thinking left,right,fight out loud in my head, with the sound coming from first left, then right, then both, but overdubbed. So naturally I had to use that for the digital rust test you are about to hear. So without further ramblings here it is in it’s shiny mp3 form.

digital rust example – Left Right FIGHT

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:

trumpet.wav
trumpet_glitched

bicycle_bell
bicycle_bell_glitched

rusty
rusty_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;
}