0

I am new in Android programming and I am working in area of Text to speech in Gujarati(Indic) language and for that I have individual sound units of Gujarati alphabets stored in raw folder of res in android as I am using rule based concatenation. Now What I have to do is to take these sound units, concate them into one speech file and need to play that resultant file. I have sound samples in .mp3 format as well as in .waw format. I dont know how to do this.

I searched it on google but there are so many ways to do this that I am getting more and more confused. Please help me with this. Thanks in advance

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Riya Patel
  • 77
  • 9
  • you must discover whether or not you can concatenate audio files while in their original codec using some high level audio API ... if not then you can always concatenate audio files by first transforming each into PCM audio and do the stitching together while in PCM ... then possibly render while still in PCM or if need be transform back to a format android can render ... PCM is the native raw audio format which is simply the digital representation of the analog audio curve and it what all other audio formats must get converted into to enable rendering or conversion between formats – Scott Stensland Feb 10 '18 at 16:51

1 Answers1

0

You could try a list of objects and just keep adding whichever you need. Then to play them just go to each index one after the other in a loop. Just remember to store them in an object e.g:

List<Audio> audioList = new List<Audio>;

Then:

set(int index, Audio value);

To give it an index and a value. To retrieve it's:

get(int index)

I don't quite get your question but I believe this is a fairly simple way on how to do that. The real work will come from how you store and call the sound files. Be it locally or on a remote server.

Thabiso Motswagole
  • 146
  • 1
  • 2
  • 17
  • I need to merge audio files into one and save that file into internal storage. If you know how to do that please suggest. Though I will try the solution you suggested. Thank you – Riya Patel Feb 09 '18 at 10:44
  • @RiyaPatel Ok well some of these answers should help you then: https://stackoverflow.com/questions/12568326/merge-two-audio-filesnot-concat-in-javaapi – Thabiso Motswagole Feb 09 '18 at 11:06
  • Sorry I wrote merge instead of concatenation. I want to concate audio files one after another. Sorry for misleading – Riya Patel Feb 09 '18 at 11:32