-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7fdc9ed
Showing
5 changed files
with
446 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
all: Streamy.c | ||
g++ Streamy.c -std=c99 -g -o Streamy -framework CoreAudio -framework ApplicationServices -framework CoreMidi -framework AudioToolbox -framework AudioUnit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Pipeline: | ||
|
||
Phase 1: tcpdump -tnn -c 20000 -ien1 | ||
|
||
produces output like: | ||
|
||
IP 192.168.0.4.54953 > 173.194.33.21.443: Flags [P.], seq 2174803272:2174803309, ack 75913239, win 65535, options [nop,nop,TS val 64433140 ecr 1704041441], length 37 | ||
|
||
Can pipe that to... | ||
|
||
----- | ||
|
||
Phase 2: perl script. | ||
|
||
Script should take lines in, and make a map of hosts. For each present host, there should be an associated (statically assigned? dynamically mapped?) MIDI instrument and/or tone. The script should output tuples like (MIDI cmd, instrument, tone, velocity,...). By specifying the MIDI command, other MIDI parameters could be varied by the output of this tool. Furthermore, there could be effects that we know about that, when certain events happen, could be modulated by traffic. | ||
|
||
These will be piped to... | ||
|
||
----- | ||
|
||
Phase 3: a C MIDI driver | ||
|
||
This will be hooked into CoreAudio. The program will loop on STDIN reading MIDI commands from Phase 2. When each tuple arrives, it is issued to the synth. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/perl | ||
local $| = 1; | ||
use warnings; | ||
use strict; | ||
|
||
my $num_clients = 0; | ||
my %clientMap; | ||
my %Map; | ||
|
||
while(<>){ | ||
|
||
chomp; | ||
my ($srcip,$dstip,$srcport,$dstport,$icmp) = split /\s+/; | ||
|
||
|
||
if( defined $icmp ){ | ||
&addClientIfNew($srcip,$dstip); | ||
&doCommunication($srcip,1,'send'); | ||
&doCommunication($dstip,1,'recv'); | ||
} | ||
|
||
next if !defined $srcip; | ||
next if !defined $dstip; | ||
next if !defined $srcport; | ||
next if !defined $dstport; | ||
|
||
|
||
&addClientIfNew($srcip,$dstip); | ||
&doCommunication($srcip,$srcport,'send'); | ||
&doCommunication($dstip,$dstport,'recv'); | ||
|
||
} | ||
|
||
sub doCommunication(){ | ||
|
||
my $ip = shift; | ||
my $port = shift; | ||
my $direction = shift; | ||
|
||
if( $direction eq 'send' ){ | ||
print "".$clientMap{$ip}." ".$port." 0\n"; | ||
} | ||
if( $direction eq 'recv' ){ | ||
print "".$clientMap{$ip}." ".$port." 1\n"; | ||
} | ||
|
||
} | ||
|
||
sub addClientIfNew(){ | ||
|
||
my $srcip = shift; | ||
my $dstip = shift; | ||
|
||
if( !exists $clientMap{$srcip} ){ | ||
$clientMap{$srcip} = $num_clients++; | ||
#print "New client: $srcip\n" | ||
} | ||
|
||
if( !exists $clientMap{$dstip} ){ | ||
$clientMap{$dstip} = $num_clients++; | ||
#print "New client: $dstip\n" | ||
} | ||
|
||
} |
Oops, something went wrong.