How to convert an audio or mp3 signal to a binary signal?

39 views (last 30 days)
I have to read the audio signal
then covert the audio signal to the Binary SIgnal to be ready for the modulation.
How to perform the COnversion of the Audio SIgnal to Binary signal that could be domedulated in the end to give the original voice signal?

Accepted Answer

Walter Roberson
Walter Roberson on 14 Apr 2019
filename = 'YourFileNameGoesHere.mp3';
fid = fopen(filename, 'r');
file_bits = fread(fid, [1 inf], 'bit1=>uint8');
fclose(fid);
file_bits is now a vector of binary values ready for modulation.
At the other end, demodulate into a vector of uint8, and do any appropriate error correction. Then
filename = 'YourOutputFileNameGoesHere.mp3';
outfid = fopen(filename, 'w');
fwrite(outfid, file_bits, 'bit1');
fclose(outfid);
The other end will now have a copy of the mp3 file, which can be played through whatever mp3 player the other end has.
Note: if there was uncorrected transmission noise, then the file that is written might be corrupted in a way that makes it impossible to play. So be sure to put in enough error detection and correction for the circumstances.
  2 Comments
sahil sharma
sahil sharma on 2 Jun 2023
As you have used modulation here can you explain what type of modulation is being used here?
Walter Roberson
Walter Roberson on 2 Jun 2023
I did not use modulation here. It just reads the data as a bit stream.

Sign in to comment.

More Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!