-2

Not very good at Java. Tried reading a few post to solve my problem but they arent what im looking for. so here goes:-

I basically want to open a .mp3 file in my android app, as if it were a Text file. Then put in some text (at the end of the file). And then save it.

I tried opening an .mp3 in Notepad. went to the end of the file, put in some text and then saved it. It still is a .mp3 file! and i managed to send it to a friend via any messenger.

user3833732
  • 886
  • 9
  • 14
  • So you want to convert the lyrics of the song into a text file or you want to convert binary encoded data into text file? – Confuse Apr 19 '15 at 16:01
  • That sounds clear - to replicate your notepad experiment with a program, you need to learn how to write additional data to the end of the file, either by opening it in an append mode, by opening it in a non-truncating mode and advancing to the end of the existing data, or by copying it over and then adding more. – Chris Stratton Apr 19 '15 at 16:10
  • Are you asking how to edit the metadata in your mp3 files? – Phantômaxx Apr 19 '15 at 16:12
  • hi, No, not looking to edit data. Yes @ChrisStratton I think you got what i meant. Any quick lead to save me off R&D time? – user3833732 Apr 19 '15 at 16:22

1 Answers1

1

MP3 files are binary files, you don't usually treat them as text files, but if you really need to do so, they're no different (in java). You can use answer to this question.

If you wanna manipulate the mp3 file, do some modifications that are related to it being a sound file, you can use LAMEOnJ Library.

Community
  • 1
  • 1
Mohammad Jafar Mashhadi
  • 4,102
  • 3
  • 29
  • 49
  • Yes it did help me. I managed to do it. I also made a marker like "888" at the place where i added my text. So when i read the .mp3 again i used Split String function on "888", and got the secret i wanted to hide in the .mp3 file thanks! – user3833732 Feb 25 '18 at 21:26