User:Lieven Van Speybroeck/Prototyping/2-CPUtter
CPUtter
Description
The CPU... the brain of our computer systems. And yet, it's so quiet while making it's calculations. Not like those fans, hard disks and DVD-drives that tend to manifest themselves with all sorts of bleeps and buzzes. Therefore, i thought about making a voice for the processor. An intuitive representation of all it's hard work in the background. This is my attempt.
Structure
- Check user cpu usage for an amount of time and log it in a file.
- Filter the logfile so the result is a list of numbers that represent the cpu-usage over time.
- Create a scale from "low usage" to "high usage", compare each line of the file to that scale and convert it into a tone with pitch value.
- Use bending to create an ongoing sequence between the tones and pitch values.
Source
For making a log-file of the cpu-usage, i used "iostat", which does pretty much the same as "top" does, but you can filter a bit more:
iostat -c 1 250 > log
This will put a 250 cpu-usage (-c) reports at 1 second intervals in "log". You can change the speed and amount of lines (amount of statistics) by changing these numbers. This way you could run it as long as you want to get better results. The output looks a bit like this:
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
Evolution
For now I can only convert adresses that are eventually merged into a precise channel in midge, but the full idea is to separate every data from each connexion, so that each user revolving around would have is own channel. So each time a new user would connect, a new channel would be added. And the name, quality of signal and adresse would be taken into account as a data for the sound channel.