1

I am trying to build an app which can generate tones of arbitrary frequency..I got this link: Playing an arbitrary tone with Android which is really helpful..in that the tone is played for a particular duration which is set in code..I want to modify it such that the tone continues to play till the stop button is pressed..and not for a preset duration..I am unable to implement it..can someone please help with this?

Also I would like to know the reason for the click sound while starting and stopping a tone..and if there is any way to avoid this..I really need help with this..please help..

Community
  • 1
  • 1
Coder
  • 153
  • 1
  • 9

1 Answers1

0

An AudioTrack instance can operate under two modes: static or streaming. So I think streaming mode may solve your problem. In Streaming mode, the application writes a continuous stream of data to the AudioTrack, using one of the write() methods.

Please see this link. This may help you.

AudioTrack Class can be found here.

Community
  • 1
  • 1
subhash kumar singh
  • 2,716
  • 8
  • 31
  • 43
  • already tried streaming mode..didnt work..the track I am generating lasts only for 3 seconds..and therefore stops at 3 seconds..will try out the suggestions.. – Coder Dec 06 '12 at 06:22
  • I tried the posted link and it is generating sound continuously. It is not limited for 3 seconds. – subhash kumar singh Dec 06 '12 at 06:40
  • which answer in that link did u try?..I tried the one with most votes..in that duration is specified and its 3 seconds..and mine stops playing after 3 seconds.. – Coder Dec 06 '12 at 06:59
  • please try the answer from my shared [link] (http://stackoverflow.com/questions/6179392/audiotrack-in-streaming-mode-mode-streaming) – subhash kumar singh Dec 06 '12 at 07:17