I have audio, how to convert to ASCII code??

23 views (last 30 days)
I have audio, i use audioread in program. how to convert audio to ASCII code??
  10 Comments
Guillaume
Guillaume on 19 Dec 2017
why integer value between 0 until 127?
Because that's the definition of ASCII. It's a 7-bit encoding so the values are from 0 to 2^7-1 == 127.
my purpose convert audio to ascii us[ing] cryptography algorithm
Yes, but what algorithm? Until you tell us the finer details of your algorithm we have no idea how to convert. As I said, there are many ways to convert some sequence of numbers into another sequence of numbers all producing different results.
Jan
Jan on 20 Dec 2017
@heri: If all you want is to encrypt the file, use fileread or fread(fileID, Inf, 'uint8'). You do not have to convert the signal, if you can encrypt the bytes directly.
Your explanations did not help yet to find out, what you want to achieve exactly.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Dec 2017
reshape( num2hex(TheSignalArray(:)) .', 1, [])
  5 Comments
Walter Roberson
Walter Roberson on 19 Dec 2017
Note that there are two ways you can do "audio encryption":
1) Read the audio file, and calculate an encrypted version of the signal. If the sampling frequency is not fixed, then you will need to either include it "in the clear" or you will need to include it in the information being encrypted. When you use this approach, all extra information such as track names and artist and copyright will be discarded and not transferred. It would be possible for the decrypting side to play the sound immediately after decrypting.
2) Read the audio file as a series of bytes or characters, and calculate an encrypted version of that. The decrypting side would typically need to write the decrypted information into a file and then read the file in order to be able to play the sound after decrypting. All extra information such as track names and artist and copyright will be included, whatever was in the original file.
Walter Roberson
Walter Roberson on 19 Dec 2017
Also, if you are planning to encrypt an audio signal, you should seriously consider using the 'native' option when you read the signal,
[data, fs] = audioread('Concerto For Jar-Jar.mp3', 'native');
This would often return integer data instead of floating point that you would get without 'native'

Sign in to comment.

More Answers (0)

Categories

Find more on Encryption / Cryptography in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!