Mp3 Steganography in C#? - c#

I am currently developing an application in C# to hide data in Mp3 audio files.
So far, I have been able to hide data in MP3 frames using the Least Significant Bit Approach (LSB). I can retrieve the data as well. The problem I am facing is, let's say I hide 300 bytes of data, the encoded audio plays just fine without significant noise. However when I try to encrypt more data into the MP3, like 500 bytes or more, there will be significant noise in my mp3 file. The audio gets distorted a lot.
I was wondering how to reduce that noise.

Related

C# Play WAV Soundfile - Error: "The wave header is corrupt."

I have the following issue.
I want to play a WAV audio file in my C# program, which I converted from MP3 to WAV before. I can't just play it as a MP3 as C# needs the Media Player library added first, but I don't want to use any other library that increases file size or adds another library dll to my export.
So when I use Audacity to convert the file from MP3 to WAV, playing the file in C# works fine, but the WAV file just gets very big, which I want to avoid (from 3 MB MP3 to 25 MB WAV).
Accordingly, I switched to Adobe Premiere Pro because this offers more options to adjust the end size of the file.
Now there are 5 different audio codecs in Adobe Premiere Pro:
Uncompressed
IMA ADPCM
Microsoft ADPCM
CCITT A-Law
GSM 6.10
With the uncompressed mode, the WAV can be played in C# without any problems. The file size is still very large in this case.
All other audio codecs allow me to reduce the file size up to 80% without audible audio loss, but with each of them I get the error message: "System.InvalidOperationException: "The wave header is corrupt." at runtime.
I tried to fix that with previous threads saying I should try reloading the stream or changing the position of the stream to 0 but that didn't work for me, I still got the same error message.
I don't know if there is even a way to fix it as it might be an issue with the compression?
I am able to play those WAV files with Media Player tho.
Is there any workaround?

Play memory streams avoiding gap between them in WP8.1 app

I have 2 memory streams which are representing wav files in my Windows Phone 8.1 app. I want to play them but avoiding gaps between them, is there any way to do that without using Sleep methods or something like that?
I've tried already the Thread.Sleep() but I think it is making lot of gaps as my 2 files are 20ms duration each.
Assuming the audio is the same format and the wave headers have been stripped you could just concatenate the memory streams.
streamTwo.CopyTo(streamOne);
If the wave headers are still embedded then you'd need to skip over the one in the second stream - generally 44 bytes. If the formats are different then you'll need to find another technique.

How can I use mp3 files in Windows Phone 8?

in my windows phone gaming apps, I have to use lots of sound. Now I have seen that Windows phone does not support mp3 files. So I need to use the wav files. Any mp3 file which is just 500 kb size in mp3 format, when convert that to ".wav" it becomes min 2.5MB. It's actually eating up my apps size and unnecessarily the size of my apps is getting bigger.
Anyone know how can I use the mp3 file? In my solution I have a Asset folder and inside this folder all the ".wav" files are located.
How I am doing this let me write a code
SoundEffect effect;
Iinside constructor-
{
...
var soundFile = "Assets/Jump.wav";
Stream stream = TitleContainer.OpenStream(soundFile);
effect = SoundEffect.FromStream(stream);
And in the code
effect.Play();
Is there any better approach. In some thread I come to know that doing this is not a better way coding as it creates object and used up the system space. Please suggest what to do, how do I add mp3 files and write better code for working with sound files.
you can use BackgroundAudioPlayer to play your wav and mp3 files. SoundEffect class cannot play mp3 data
Go through this it's an entire app on it's own.
Background Audio WP
To use an MP3 file you would have to decode the MP3 into PCM in memory, and use that resulting stream in the SoundEffect.FromStream method.
Another thing you could try is encoding the wav files as ADPCM. This usually compresses the wave file at ratio of 4:1. If you can't use the stream directly, decoding of ADPCM is much more straightforward than decoding an mp3 file.
And one more thing you could try to save space is converting the uncompressed wave files into mono, and a lower sampling rate. You can perform listening tests on the sounds after the conversion to make sure that the loss in quality is acceptable or not.

Play an encrypted mp3 file

I am currently trying to play a encrypted .mp3 file. The way I am currently using is:
loading the encrypted file -> decrypting it -> save it to ISO -> play it with the backgroundaudioplayer.
But this can take up to 10-15 seconds to start one .mp3 file. Is there any other way to do this faster ?
For example is there a way to play from a stream and somehow decrypt it while playing ?
And is there actually the need for encrypting the files on the IsolatedStorage ? Since nobody should be able to touch them anyways ?!
Ok well since its been so long I would recommend "Buffering" its really easy, have your decrypt stream give you a decent sized buffer from the first 20 or so seconds of the file, that should take a few seconds max much faster than waiting for the whole file, then just simply feed the backgroundplayer using the decrypted buffer whilst the rest is still decrypting.

Hiding data inside an mp3 file

I am currently working on a project to hide data inside an mp3 file...What I did was, I replaced the last BYTE of every mp3 frame with the bytes from message file(the file to be hidden)... It works fine... I could hide the file in it and also successfully extract it... But some noise are present in the resulting mp3 file, due to addition of external data which is, definitely, not desired... Please help me in where to store the data in mp3 so as to reduce the noise...
PS: There is already a tool to use mp3 for hiding data -Mp3Stego. But it takes uncompressed wav file as input. But I need to have mp3 as input.
Such kind of tools do not replace whole byte. They are replace only last BIT. Try to replace only a BIT instead of BYTE. This will reduce the noise, but also reduce size of an information which you can put in file.

Categories

Resources