About files and Binary Strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About files and Binary Strings

When I am trying to edit a sound file using open("/storage/emulated/...Test1.wav", "wb"), I would like to try to create random sound files to learn to create sound files. I can see, that any sound file begins with 16 charactees long and rest are b'\x<Hex><Hex>' kind of text. How can I write that? using b'\x' escapes x causes an unicode error, when escaping the "\", sound file can't​ be played, using b'\X' doesn't cause the error, but b'\X'.lower() causes code to escape the "\" automatically.

8th Jun 2018, 9:48 PM
Seb TheS
Seb TheS - avatar
2 Answers
0
You do not need to invent a wheel. Thee is a module called wave.
9th Jun 2018, 7:51 AM
strawdog
strawdog - avatar
0
I don't find any modules in need
9th Jun 2018, 8:36 AM
Seb TheS
Seb TheS - avatar