Hey all

I need to convert audio file of wav format into text file in order to feed it as input to an encryption algorithm(IBE encrypt method of Miracl library takes only texts as input) and have to reconvert the decrypted text file to audio format.

Could you please suggest me a way to accomplish this. I have rest of my code written in C++.

regards
bk

Recommended Answers

All 6 Replies

Is there something wrong with just opening and reading it like any other (text) file? There's nothing magical about WAV files, it's just a header with information about the bit rate, file size, number of samples, etc. followed by the values along the waveform for the audio output, all encoded in base-16. See this write-up for some information about WAV file structure.

Try opening a WAV file in a hex editor and take a look at it, it should demystify it a bit.

Thanks

I thought it would be something different than just opening given that its an audio file with a totally different format from normal text.

Thanks for clarification :)

No problem. If this works for you, don't forget to mark the thread as solved and consider adding reputation and/or +1 vote.

Hey am sorry ..but the solution above did not work.
It is giving some other wierd characters and the final output text different from that of the input.And on saving that as a wav file ,i aint able to play it(says its a corrupt file)

Is there any other solution?
Please help.
Thanks
bk
reminder: The library that am using takes input only in text format .

Hey am sorry ..but the solution above did not work.
It is giving some other wierd characters and the final output text different from that of the input.And on saving that as a wav file ,i aint able to play it(says its a corrupt file)

Is there any other solution?
Please help.
Thanks
bk
reminder: The library that am using takes input only in text format .

What is giving you weird characters? What characters are they? What are you using to view the file to look at characters? What have you done so far when you see the weird characters? Did you look at the WAV file you created and make sure that the number of bytes specified in the header you wrote (both in chunkSize and SubChunk2Size) match the number of bytes that you SHOULD have as well as the number of bytes that you REALLY have?

Text input library should be no problem. As I said earlier, a WAV file is nothing but a whole bunch of hexadecimal numbers; the numbers 0-9 and the letters A-F. When you open and read the file, you'll just be reading in all of those letters and numbers, the program should have no idea what it says, whether or not it's hex or plain text, etc. If your encryption algorithm is supposed to be able to take letters and numbers (text), turn it into some encrypted something-or-other, and then decrypt it back into the exact same thing that you started with (i.e. the exact same letters and numbers, the hexadecimal WAV data) then there shouldn't be any problems. Is your input (unencrypted) file the same as your output (encrypted-then-decrypted) file?

I want a c++ coding for audio compression and decompression using wavelet technique.It should be .wav to text and vice versa.Please help me.Please

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.