I dumped the bit banged I2S data to the Dash's serial console and logged it to a file. After a few hours of waiting, I was able to whip up a small Node.js program to convert the ASCII into a binary blob. Imported it into Audacity and got this sweet looking waveform. Too bad it sounds like static.
Here's the code.
var fs = require('fs');
var convertHex = require('convert-hex');
var tokenizer = require('tokenizer');
var t = new tokenizer();
t.addRule(/^0x[0-9A-Fa-f]+$/, 'half');
t.addRule(/^\w+$/, 'junk');
t.addRule(/^\s+$/, 'whitespace');
t.addRule(/^.$/, 'whitespace');
var pcm = fs.createWriteStream('pcm.raw');
var bytes = [];
t.on('token', function(token, type) {
if (type == 'half') {
if (token.content.length == 6) {
var b = convertHex.hexToBytes(token.content);
bytes.push(b[0], b[1]);
}
}
});
t.write(fs.readFileSync('../audio.log', { encoding: 'utf8' }));
t.on('data', function() { });
t.on('error', function(error) {
console.log(error);
pcm.write(new Buffer(bytes));
pcm.end();
});
t.on('end', function() {
console.log("DONE");
pcm.write(new Buffer(bytes));
pcm.end();
});
t.end();
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.