How it works

The barcode system was programmed in Multimedia Fusion 2 (Clickteam). The system consists of 3 basic components: The Scanning, The Music Generation and the Music Modification. To reach the final state of the system, it had gone through about five major alterations , and countless minor iterations. The system has a number of modes which each apply a certain behaviour; we will explain the workings of standard and the DJ mode.

The Scanning

When the barcode scanner scans a barcode, it is fed into the system through a simple textbox. If no other barcode with the same code exists in the system, the code is added. If there already is a code of the same type in the system, standard mode will lengthen the lifespan of the code, while DJ mode will remove it from the system. In standard mode barcodes die after a certain time.

The Music Generation

In the basic fundament of the music generation lies a tempo of 8 beats per loop. During each beat, all barcodes in the system will be prompted to act, upon which they will decide if they want to make a sound or not.

General

Barcodes have one of three modes, melody, drum or vocal. Vocal is simply a small adaption of the drum system, so that mode will be ignored in this documentation. The mode a barcode gets is decided by the resulting value formula G1. The exact span of each mode can of course be tweaked depending on how big portion of the barcodes that is desired to have in each mode.

Formula G1: Val(Mid$(code( "barcode" ), 1, 8)) mod 10

When a barcode is prompted, it reads its code through a number of formulas that modify a set of variables held by the barcode than in turn define if the barcode will make a sound, what kind of sound that will be, at what volume, at what panning and at which frequency.

The music generation has two fundamentally different sets of algorithms, the "melodies" and "drums". Melodies emphasize movements in frequency, while drums emphasize rythmical usage of different samples.

Melodies

Melodies should be more varied as each loop evolve in more interesting ways over time, thus Algorithm 1M uses high divisions of the beat, which are become invisible the first loops, but emerge later on. This algorithm is run each time the barcode is prompted, despite if it makes a sound or not in the end.

Algorithm 1M:

* Set beatplace to 1+(beat/(BeatsPerMiniteDivider)) mod 8

* Add Val(Mid$(strArgA( "Function Looper" ), readCodeAt( "barcode" ), 1))/(0.5*Val(Mid$(strArgA( "Function Looper" ), 4, 1)))-Val(Mid$(strArgA( "Function Looper" ), (outOfFourLoops( "barcode" )+(readCodeAt( "barcode" )/4)) mod (2*(Val(Mid$(strArgA( "Function Looper" ), 4, 1))/2)), 1)) to Frequency Change Limiter

* Set Frequency Change Limiter to Int(Max(1, (Frequency Change Limiter( "barcode" )*Frequency Change Limiter( "barcode" ))/Val(Mid$(strArgA( "Function Looper" ), 2, 6)) mod Val(Mid$(strArgA( "Function Looper" ), 5, 2))))

* Add Int(((Val(Mid$(strArgA( "Function Looper" ), (readCodeAt( "barcode" )+(beat/(BeatsPerMiniteDivider*(2*((Val(Mid$(strArgA( "Function Looper" ), 9, 4)) mod 10)/2))))*Val(Mid$(strArgA( "Function Looper" ), 3, 5))+(beat/(BeatsPerMiniteDivider*(4*((Val(Mid$(strArgA( "Function Looper" ), 9, 4)) mod 8)))))*0.3) mod 8, 1))-4)*3)/(Frequency Change Limiter( "barcode" )*0.7+0.3)) to Sample Frequency.

* Set ReadCodeAt (beat/BeatsPerMiniteDivider) mod 8

When these values have been set and modified, algorithm 2M latches on and prepares for the sample. The LimitModifier will decide if a sample is to be played at all, and FrequencyModifier will decide at which frequency its played.

Algorithm 2M:

* Set LimitModifier to Val(Mid$(strArgA( "Function Looper" ), (beatplace+Sample Frequency( "barcode" )/8) mod 8, 1))-(Val(Mid$(strArgA( "Function Looper" ), 5, 3)) mod 10)+overallLimit

* Set FrequencyModifier 14080*Val(Evaluate$( "ExpEval Object", "Pow(2,"+Str$(((Sample Frequency( "barcode" )/12)*12)+ValueAtXY( "Scales", Sample Frequency( "barcode" ) mod 12, Val(Mid$(strArgA( "Function Looper" ), 4, 4)) mod 2))+"/ 12.0)"))

Now the sample playing will be evaluated through algorithm 3M.

Algorithm 3M:

If LimitModifier GREATOREQUAL to Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))+limiterModer( "all my values" )

THEN

* Play Sample List Line Text$( "samples melody", (sampleModifier+123*Val(Mid$(strArgA( "Function Looper" ), 3, 6))) mod List Nb Lines( "samples melody" ))

* Set Volume to (Val(Mid$(strArgA( "Function Looper" ), beatplace, 2))/2)+35

* Set Frequency to Frequency Modifier

* Set Pan to ((sampleModifier*1235+Val(Mid$(strArgA( "Function Looper" ), 1, 8))) mod 200)-100

If a Sample is not played, Algorithm 4M is evaluated to make the frequency changes not peak in any direction, and to make interesting octave moves.

Algorithm 4M

- If LimitModifier < Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))/3

THEN

* Set Sample Frequency to Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))-4


- If limitModifier < Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))+Val(Mid$(strArgA( "Function Looper" ), 1, 3)) mod 6 AND Sample Frequency > Val(Mid$(strArgA( "Function Looper" ), 3, 5)) mod 70

THEN

- Subtract (Val(Mid$(strArgA( "Function Looper" ), 1, 8)) mod 50) from Sample Frequency.

- If limitModifier < Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))+Val(Mid$(strArgA( "Function Looper" ), 1, 3)) mod 6AND Sample Frequency < Val(Mid$(strArgA( "Function Looper" ), 3, 5)) mod 70

THEN

- Add (Val(Mid$(strArgA( "Function Looper" ), 1, 8)) mod 50) to Sample Frequency.

Drums

Drums need to keep a good rhythm and give a good sense of tempo, thus their Algorithm 1D puts emphasis on stability. Some drums have 8 beatsperloop while other have 4 which is decided by if formula D1 is greater of equal to 6.

Algorithm 1D:

* Set beatplace to 1+(beat/(BeatsPerMiniteDivider)) mod beatsperloop( "barcode" )

* Add Val(Mid$(strArgA( "Function Looper" ), readCodeAt( "barcode" ), 1))/Val(Mid$(strArgA( "Function Looper" ), 4, 1))-Val(Mid$(strArgA( "Function Looper" ), (outOfFourLoops( "barcode" )+(readCodeAt( "barcode" )/8)+(readCodeAt( "barcode" )/32)*0.5+(readCodeAt( "barcode" )/16)*0.7) mod beatsperloop( "barcode" ), 1)) to Frequency Change Limiter

* Set Frequency Change Limiter to Int(Max(1, Frequency Change Limiter( "barcode" )))

* Add Int(((Val(Mid$(strArgA( "Function Looper" ), readCodeAt( "barcode" ) mod beatsperloop( "barcode" ), 1))-4)*3)/(0.5+(Frequency Change Limiter( "barcode" )*0.5))) to Sample Frequency

* Set ReadCodeAt (beat/BeatsPerMiniteDivider) mod beatsperloop( "barcode" )

Formula D1: Val(Mid$(code( "barcode" ), 3, 6)) mod 10

Algorithm 2D takes over and prepares for the sample. The LimitModifier will decide if a sample is to be played at all, and SampleModifier will decide which sample from the sound bank to play.


Algorithm 2D:

* Set LimitModifier to Val(Mid$(strArgA( "Function Looper" ), (beatplace+Val(Mid$(strArgA( "Function Looper" ), 3, 6))) mod beatsperloop( "barcode" ), 1))+overallLimit-5

* Set SampleModifier Int(Sqr(Sample Frequency( "barcode" ))/3)

Algorithm 3D:

- If LimitModifier GREATOREQUAL to Val(Mid$(strArgA( "Function Looper" ), beatplace, 1))+limiterModer( "all my values" )

THEN

* Play Sample List Line Text$( "samples beats", (sampleModifier+123*Val(Mid$(strArgA( "Function Looper" ), 3, 6))) mod List Nb Lines( "samples beats" ))

* Set Volume to (Val(Mid$(strArgA( "Function Looper" ), beatplace, 2))/2)+50

* Set Frequency to Frequency Modifier

* Set Pan to ((sampleModifier*1235+Val(Mid$(strArgA( "Function Looper" ), 1, 8))) mod 200)-100


Music Modification

After the music generation is done, users can modify the sound by adjusting the limit-modifier, the frequency and so on through various user interfaces.