Ti.Media.Sound with looping doesn't have perfect repetition (for a dialtone)

You must Login before you can answer or comment on any questions.

I'm trying to create a window that looks like the iPhone's Phone dialer page. Part of that is having DTMF tones (the tones you hear when you use a traditional landline phone). I have the sounds and in Audacity they loop perfectly, but with Sound and looping it has a choppy noise at the same periodic timing as the length of the sound clip.

Here's the code:

digitSound = Ti.Media.createSound 
  volume: 1.0
  url: "/sounds/dtmf-#{$.largeCharacter.text}.aif"
  looping: true
 
$.phoneButton.addEventListener "touchstart", (event) ->
  digitSound.play()
 
 
$.phoneButton.addEventListener "touchend", (event) ->
  digitSound.stop()
Any ideas on how to fix this?

Here's a link to the sound file:

https://www.dropbox.com/s/11rdt5bjs09ehtj/dtmf-0.aif

1 Answer

When you press a button on the iPhone dialer, it only plays the sound file once. Its just a quick, short tone, no matter how long you hold down the button. Thats how I would handle it. Seems to follow convention.

However, if you're insistent on looping the track, I would extend the length of the tone in Audacity to make it longer, that way you can play the tone longer without the chop and with much less delay between loops.

— answered 8 months ago by Anthony Decena
answer permalink
2 Comments
  • I'm playing with the iPhone dialer and if I hold down the button it does keep playing the tone. Otherwise I would agree with your solution (and may go that way anyway).

    — commented 8 months ago by David Yang

  • Hmm, that was odd. I just tried this and the tone was short. Tested again just now, and sure enough, it continues to play.

    So, the second path may be your best bet. Make the tone longer and chop the beginning and end where the tone tapers off in order to get a smoother, longer playing loop. I just lengthened the tone you posted in Audacity to a length of about a second and a half and it seems to hold a better loop.

    — commented 8 months ago by Anthony Decena

Your Answer

Think you can help? Login to answer this question!