Can I save these documents on a dying machine from oblivion?
Solution 1:
here's an example libasound program with just enough definitions to get basic 2-channel 44.1k wav output going without the headers.
EDIT: I'm actually not sure if straight up dumping the data as wav would work, as noise when recording could easily damage it, but you can probably do something like a sine wave of bits at high frequency which is more reliable
EDIT2: if aplay is present and works you can also use that and just write a program that output raw audio and pipe it into aplay or anything that can play audio
EDIT3: modified it to not use any headers at all
if -lasound doesn't compile, add -L/path/where/libasound/is/located
/*
gcc alsa_noheader.c -lasound
cat stuff.wav | ./a.out
*/
typedef unsigned int uint;
typedef unsigned long ulon;
int printf(char*, ...);
void* malloc(long);
long read(int fd, void* buf, ulon count);
int snd_pcm_open(void**, char*, int, int);
ulon snd_pcm_hw_params_sizeof();
int snd_pcm_hw_params_any(void*, void*);
int snd_pcm_hw_params_set_access(void*, void*, int);
int snd_pcm_hw_params_set_format(void*, void*, int);
int snd_pcm_hw_params_set_channels(void*, void*, uint);
int snd_pcm_hw_params_set_rate_near(void*, void*, uint*, int*);
int snd_pcm_hw_params(void*, void*);
int snd_pcm_hw_params_get_period_size(void*, ulon*, int*);
long snd_pcm_writei(void*, void*, uint);
int snd_pcm_prepare(void*);
int snd_pcm_drain(void*);
int snd_pcm_close(void*);
int main(int argc, char* argv[])
{
void* pcm;
void* params;
int rate;
int nchannels;
ulon frames;
void* buf;
int bufsize;
long nread;
snd_pcm_open(&pcm, "default", 0, 0);
params = malloc(snd_pcm_hw_params_sizeof());
snd_pcm_hw_params_any(pcm, params);
/* 3 = rw_interleaved */
snd_pcm_hw_params_set_access(pcm, params, 3);
/* 2 = 16-bit signed little endian */
snd_pcm_hw_params_set_format(pcm, params, 2);
/* 2 channels */
nchannels = 2;
snd_pcm_hw_params_set_channels(pcm, params, nchannels);
/* sample rate */
rate = 44100;
snd_pcm_hw_params_set_rate_near(pcm, params, &rate, 0);
snd_pcm_hw_params(pcm, params);
snd_pcm_hw_params_get_period_size(params, &frames, 0);
bufsize = frames * nchannels * 2;
buf = malloc(bufsize);
/* read file from stdin */
while (nread = read(0, buf, bufsize) > 0)
{
if (snd_pcm_writei(pcm, buf, frames) == -29)
{
printf("W: underrun\n");
snd_pcm_prepare(pcm);
}
}
snd_pcm_drain(pcm);
snd_pcm_close(pcm);
return 0;
}
Solution 2:
Is your HDMI or any other display out port working? If so you can use a screen capture device to record it as video and process later. Thus not being limited by your webcam's framerate.
Solution 3:
How about you hex-encode your data and output it page per page to the terminal?
You can add a prefix with the the offset in the binary so that you can easily regenerate a page (for manual correction?)
Then on a different computer use some OCR software to scan the pages.
80x25 terminal would yield 1000 bytes per page (minus some space for the prefix). So in roughly 1000 pages you could get out your data. Even at one page per second, that's less than 20 minutes.
Hex encoding is easy to write and also provides a raw form of error correction (there are only 16 valid symbols).
Solution 4:
can you set up a network connection? ssh might be a bit too much but if you can use netcat on 2 machines you might be able to transfer data. one in sending mode, one in listening mode. If all you need to do is transfer text then this 'could' be a solution..
edit: nevermind, just read that you lost your network connection as well..