User:Fabien Labeyrie/Wifi Orchestra

From XPUB & Lens-Based wiki

Unstandingstill DJ

Description Connected people are always physically revolving around us, and we mostly don't interact with them. The following lines of codes offer the possibility to play music with those people, using their Wifi MAC adress as a notation ressource.

The result is an collective music played with strangers, as anonymous as the people that usually dance in a club.


Structure

  • We are checking the wifi connexions around.
  • We convert the MAC adress value into a following of numbers.
  • This is then converted into music notes.

Source

This is the list of connexion around :

eth1      Scan completed :
          Cell 01 - Address: 00:23:AB:BF:FB:C0
                    ESSID:"eduroam"
                    Protocol:IEEE 802.11bg
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:6 Mb/s; 9 Mb/s; 11 Mb/s; 12 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Quality=76/100  Signal level=-53 dBm  
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (2) : 802.1x Proprietary
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (2) : 802.1x Proprietary
                    Extra: Last beacon: 728ms ago
          Cell 02 - Address: 00:18:F6:F5:97:4F
                    ESSID:"ThomsonAC6D8D"
                    Protocol:IEEE 802.11bg
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
                              11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    Quality=67/100  Signal level=-60 dBm  
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Extra: Last beacon: 692ms ago
        ...

Code

[convertAdress.sed]

/Address/!d
s/[^0123456789]//g
s/00//g 
s/0/c /g
s/1/c /g
s/2/e- /g
s/3/e- /g
s/4/f /g
s/5/f /g
s/6/g /g
s/7/g /g
s/8/b- /g
s/9/b- /g

[dispatchNotes.sh]

cat <<END


@head {
    \$time_sig 3/4
    \$tempo 45
}
@body {
 
    @channel 1 {
        \$patch 99
        \$octave 4
        \$length 24
	\$reverb 100
	%repeat 100 {
END

iAdd="0"
while read line; 
do 
	if (("$iAdd" == "0" )); then
		 echo $line
		iAdd=$[$iAdd + 1] 
	elif (("$iAdd" == "1" )); then
		echo $line
		iAdd=$[$iAdd + 1] 
	elif (("$iAdd" == "2" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "3" )); then
		echo $line 
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "4" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "5" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "6" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "7" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "8" )); then
		echo $line
		iAdd=$[$iAdd + 1]
	elif (("$iAdd" == "9" )); then
		echo $line
		iAdd=$[$iAdd + 1]

	else 
		iAdd="-1"
	fi
done   	


cat <<END
	}
}

}

END

This is the line that's launching the whole thing.

sudo iwlist eth1 scan | sed -f convertAdress.sed | bash dispatchNotes.sh


Output is

File:SortieDJ.ogg