Last active
October 28, 2019 19:46
-
-
Save chezsick/955cdfcac2a6c84ced8c91eb53b72a9d to your computer and use it in GitHub Desktop.
Encode/Decode An Video/Photo To Native Flute Sheet ;;; NEW Include Sound Inside Sheet ::::::: filename framerate samplesound imgsize ;;;; With A Sound In Raw Unsigned 8 Bit ;;;;; For Color Render, Please Using With This ::::::::::: https://github.com/kFYatek/color_modem
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
<?php | |
$note = [1,3,4,5,7,8,9,0]; | |
while (false !== ($o = fgetc(STDIN))) | |
{ | |
$gray = intval((ord($o) / 256)*64); | |
echo $note[intval($gray/8)].$note[intval($gray%8)]; | |
} |
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
<?php | |
$fs = fopen($argv[1],"rb"); | |
$fps = intval($argv[2]); | |
$sample = intval($argv[3]); | |
$size = $argv[4]; | |
$note = [1,3,4,5,7,8,9,0]; | |
$q = $sample/$fps; | |
$siza = explode("x",$size); | |
$p = $q/intval($siza[1]); | |
while ($o = fread(STDIN,intval($siza[0]))) | |
{ | |
for ($n = 0;$n < intval($siza[0]);$n++) | |
{ | |
$gray = intval((ord($o[$n]) / 256)*64); | |
echo $note[intval($gray/8)].$note[intval($gray%8)]; | |
} | |
$e = fread($fs,intval($p)); | |
for ($n = 0;$n < intval($p);$n++) | |
{ | |
$r = intval((ord($e[$n]) / 256)*64); | |
echo $note[intval($r/8)].$note[intval($r%8)]; | |
} | |
} |
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
<?php | |
$note = [1,3,4,5,7,8,9,0]; | |
while ($o = fread(STDIN,2)) | |
{ | |
$gray = 4*((8*array_search($o[0],$note))+array_search($o[1],$note)); | |
echo chr($gray); | |
} |
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
<?php | |
$fs = fopen($argv[1],"wb"); | |
$fps = intval($argv[2]); | |
$sample = intval($argv[3]); | |
$size = $argv[4]; | |
$note = [1,3,4,5,7,8,9,0]; | |
$q = $sample/$fps; | |
$siza = explode("x",$size); | |
$p = $q/intval($siza[1]); | |
while ($o = fread(STDIN,(intval($siza[0])+$p)*2)) | |
{ | |
for ($n = 0;$n < intval($siza[0]);$n++) | |
{ | |
$gray = 4*((8*array_search($o[($n*2)],$note))+array_search($o[($n*2)+1],$note)); | |
echo chr($gray); | |
} | |
for ($n = intval($siza[0]);$n < intval($siza[0])+intval($p);$n++) | |
{ | |
$d = 4*((8*array_search($o[$n*2],$note))+array_search($o[($n*2)+1],$note)); | |
fwrite($fs,chr($d)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment