Closed spinalcode closed 2 years ago
The code is trivial and dumps a WAV header followed by the raw 16b samples sent, and I used it to debug some on-chip issues back when I first wrote the library.
Make sure you are recording the serial port as binary with no translation, and be sure to drop off any chars sent before the binary WAV is sent. Since the generator doesn't know the total length, it sets the length in the WAV header to a value that most apps recognize as "however long the file turns out to be."
Worst case, import the raw capture as raw 2-channel, 16b samples in Audacity (you may need to try big or little endianness depending on how many chars are in your capture before the 1st sample).
Is this the same when using the web radio example? if is the serial poluted by web chatter?
It could be, if the code or your app is writing things to the Serial port. See the AudioLogger class which can silence some of the internal chatter.
That said, you're not going to be able to write out audio samples to the serial port for any realtime app (i.e. web streaming) since the max baud rate is way too low.
Part of my issue was the conversion from 16bit to 8bit, should be more like the following... if (bps == 8) { int num = (uint8_t) (((sample[0] +32768)>>8)& 0xFF); Serial.write(num); } else {
as it needs to go from 16bit signed to 8bit unsigned. I think real time listening over serial should be doable as long as I don't want 44.1k quality :-P
I have tried using the wav file dump over serial and saving the data directly to a file, but the output is only noise. Has anyone had any success with this?