0
$\begingroup$

I'working with esp32 and for some project I need to know something about wav files. I saw into many wav files with HxD and play them with Audacity. Still I do not understand why Audacity play silence either bytes into file are all 0x0 either the bytes are 0xFF, 0xFE and what you want.

I cataloged the WAV file in two basically format (only part of files): 80 80 80 80 80 81 81 81 81 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7E 7E 7E 7E 7E 7E 7E 7E 7E 7E 7D 7E 7D 7E 7E 7E 7E 7E 7E 7E 7E 7E 7D 7D 7D 7D 7E 7E 7E 7F 7F 7F 80 80 80 80 81 81 81 82 82 82 83 82 82 83 83 83 84 84 84 84 85 85 85 85 84 84 84 84 83 83 83 82 82 83 82 82 82 82 82 and this is OK for ESP 32

and this: F4 FF FC FF F8 FF 08 00 F3 FF FE FF F1 FF FB FF E9 FF 03 00 F5 FF 08 00 F6 FF F3 FF FB FF FC FF 04 00 F8 FF 00 00 E8 FF 01 00 E5 FF ED FF FF FF ED FF 00 00 F8 FF FF FF F5 FF F2 FF E7 FF F3 FF F7 FF FC FF F8 FF ED FF FA FF FE FF F2 FF ED FF E4 FF E0 FF 00 00 F7 FF FF FF 0B 00 EB FF 0D 00 F2 FF 01 00 10 00 FE FF 0B 00 FB FF F5 FF 0B 00 this is NOT OK for ESP32

It is visible that looks like they have different codification.

Also they produce difference behavior in ESP32, they are play back very well from Audacity. I'd like to convert the second format to the first, but I don't know how are their name and how discovere from data if some wav is from one type or the other.

To do some example: in https://www.thesoundarchive.com/star-wars.asp as Princess Leia (nerfherder.wav) is compatible for esp32, instead Darth Sidious (swsidious01.wav) is not compatible and esp32 ( it plays only big noise), but both are red by Audacity veri fine. WHY?

I hope I describe my problem in right way. Thanks a lot for your time.

$\endgroup$
2
  • $\begingroup$ Looking to metadata with mediainfo, one can see that swsidious01.wav is coded as 16 bit signed whereas nerfherder.wav is coded as 8 bit unsigned. $\endgroup$
    – audionuma
    Nov 6, 2018 at 5:49
  • 1
    $\begingroup$ @OlliNiemitalo I have a doubt on the on-topicness of this question. $\endgroup$
    – audionuma
    Nov 6, 2018 at 7:20

1 Answer 1

4
$\begingroup$

Using a tool like MediaInfo, one can see that swsidious01.wav is coded as 16 bit signed whereas nerfherder.wav is coded as 8 bit unsigned.

Audacity can play both without issue because it is actually parsing the wav header and using this information. It seems that esp32 (whatever that is) is expecting 8 bit unsigned data and doesn't parse the header.

There are many options to convert 16 bit signed to 8 bit unsigned, one of them being with Audacity, using custom PCM settings when exporting..

$\endgroup$
1
  • $\begingroup$ I did what you said in Audacity and works. Thanks. I'd like to do the same thing in Android with this instructions: for (int i3 = 0; i3 < numberOfShort; i3++) { byte tempSigned8Bit = (byte) (audioBuffer[i3] / 256); l = tempSigned8Bit + 128; audioBuffer_8[i3] = (byte)l; but nothing it doesn't speak do you have solution in Android to trasform 16 bit to 8 bit Thanks a lot. $\endgroup$
    – magpa
    Nov 6, 2018 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.