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
use constant BPS => 300; | |
use constant SRATE => 44100; | |
$dur = 0; | |
for (qx!cat olddata.asc!) { | |
chomp($a = $_); | |
if ($a * $preva < 0) { | |
$nbits = int($dur / (SRATE/BPS) + .5); | |
print ((($preva < 0) ? 1 : 0) x $nbits); | |
$dur = 0; |
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
$prevbit = 0; | |
$n=0; | |
for (qx!cat ddtaa.asc!) { | |
chomp($a = $_); | |
if ($n >= 2300) { | |
if (($n - 2300) % 80 == 0) { | |
$bit = ($a > 0) ? 1 : 0; | |
print (($bit != $prevbit) ? "1" : "0"); | |
$prevbit = $bit; | |
} |
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
open(S,"sox salakalastaja.wav -t .raw -e signed -|"); | |
open(U,"|sox -b 16 -c 1 -e signed -t .raw -r 44100 ". | |
"- ssb.wav sinc 6000 -n 4096"); | |
while(not eof(S)) { | |
read(S,$a,2); | |
print U pack("s",unpack("s",$a) * | |
cos(($n++ * 2 * 3.141592653589793 * 6000) / 44100); | |
} |
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
open(IN, "sox scrambled.wav -r 8600 -c 1 -t .s16 -|"); | |
open(OUT,"|sox -r 8600 -c 1 -t .s16 - descrambled.wav"); | |
$n = 1; | |
while (not eof IN) { | |
read IN, $a, 2; | |
print OUT pack("s",unpack("s",$a) * $n); | |
$n *= -1; | |
} |
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
$fs = 48000; # sample rate | |
$fc = 3729; # carrier frequency | |
$filter = " sinc -$fc"; # optional LP filter | |
$fc = freq($fc); | |
open(IN, "sox scrambled.wav -c 1 -b 16 -e signed -t .raw -|"); | |
open(OUT,"|sox -r $fs -c 1 -b 16 -e signed -t .raw - descrambled.wav". | |
$filter); |
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
#!/usr/bin/perl | |
# | |
# bpm.pl - count newlines per minute | |
# | |
# Oona Räisänen 2012 | |
# Public domain | |
# | |
# Usage: ./bpm [-n SAMPLES] [-p DECIMALS] [-s] | |
# | |
# -n SECONDS: average over SECONDS seconds (default 5) |
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
if (/^\.ninja (.+)/) { | |
$irivi = lc($1); | |
$irivi =~ tr/ÅÄÖ/åäö/; | |
$irivi =~ tr/åäöéèü/aaoeeu/; | |
$irivi =~ s/[^a-z\- ]//g; | |
$irivi =~ s/\s+$//; | |
$irivi =~ s/\s\s/ /g; | |
%ninjanames = qw( a KA b ZU c MI d TE e KU f LU g JI h RI i KI j ZU | |
k ME l TA m RIN n TO o MO p NO q KE r SHI s ARI | |
t CHI u DO v RU w MEI x NA y FU z ZI ); |
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
use warnings; | |
my $snum = 0; | |
my $reading = 0; | |
open my $in, '-|', 'sox stamped.wav -e unsigned-integer -t .raw -'; | |
while (read $in, $sample, 2) { | |
$bit = (unpack "S", $sample) & 1; |
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
#!/usr/bin/perl | |
# windytan 2017, public domain | |
use warnings; | |
use strict; | |
my $img_width = 1200; | |
my $img_height = 900; | |
my $yscale = 0.6; | |
my $xscale = 0.13; | |
my $rowheight = 5; |
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
#!/usr/bin/perl | |
# | |
# Markov-tavutin | |
# | |
# (c) Oona Räisänen | |
# MIT license | |
# | |
use strict; | |
use warnings; |