Sound is not working properly in Corona SDK - coronasdk

I have a problem when I gave channel number to a sound. When I did not give channel number to a sound then it plays perfect and it also plays when I play that sound, so it stops the previous sound and play new sound.
But when I play that sound with a specific channel, then it would not plays repeatedly, it use to wait for completion of previously playing sound, then it plays the new sound
For example,
I have put a sound to play when ball strike with walls, but when ball strikes again to wall, sound is not playing until previous sound not play completely.
Any Help?

Related

MIDI Note On in middle of Note

I am trying to play MIDI Notes in iOS using AudioGraph and AudioUnit. I used kAudioUnitSubType_MIDISynth to successfully create MIDISynth Unit, loaded sound font file into the unit, and used NOTE ON (0x90|0) message to start a note.
osStatus = MusicDeviceMIDIEvent(midiSynthUnit,
0x90|0,
60, //Pitch
100, //Velocity
0);
However, I would like to pause the music player at some point. When the music player has resumed after pause, the note on time might be passed already.
The image hereunder is an example, the vertical line is where the MIDI has to be resumed in time, a note D3 has passed its start time but not yet ended:
How can I play the midi note from the middle its time?
Thanks

iOS Change pitch of voice while recording the sound file

My basic question is that , Is it possible that I can change pitch of the sound before recording so that the recorded sound shall be saved as my desired pitch value. Means If I need to record sound in low/high pitch what Audio settings I need to do before recording a sound.
Regards

The Amazing audio engine 2 - Crossfade looping

I am using the amazing audio engine 2 library for my sequencer app and I want to implement Crossfade loop audio.
Here is explanation :
When user press any key in sequencer piano it will play some audio file and and that audio file will continue to play in loop until user release the key. But that loop will be crossfade to itself.
I am using AEAudioFilePlayerModule for looping but not sure how to crossfade audio file with this class.
Explanation of Cross fade :
Start/End: This setting allows me to choose where in the audio file I want the app to constantly loop so that if user taps+holds note down for a long time, the audio will sound continuously until the user releases his finger.
XFade: This function (crossfade) allows me to chose how to fade between the end and start of the audio loop. This is good so
that the sound will loop smoothly. Here, 9999 is set. So at about 5k samples before the 200k end point, the audio for this note
will begin to fade away and at the same time, the audio loop starting at 50k samples will fade in for a duration of about 5k samples (1/2 the XFade amount).
Please help.
Thank you.

Capture when recording audio, stops to receiving audio AVAudioRecorder

There is a talking cat app well known for iOS devices, in which you speak your voice and he repeats. Analyzing this app, you'll see that it stops talking when you stop talking, that is, it stops to capture the audio when not receive another voice.
I was giving a analyzing the methods of AVAudioRecorder class, and not found any method in which to capture when the User stop to talking or recorder stops to receive external audio.
How can I capture when the audio recorder stops to receiving audio.
Process the audio stream as it is coming through. You can look at the frequency and volume of the stream. From there you can determine if the user has stopped talking.
I suggest frequency and volume as the recorder still picks up background audio. If the volume drops dramatically then the sounds the recorder is picking up must be further away from the device than before. The frequency can also lend itself to:
A.) Filter out the background audio in the audio used to replay the audio with a pitch change or any other changes. etc.
B.) I do not know the limits of frequency for the average human. But this covers the use case where the user has stopped talking, but have moved the device in such a way that the recorder still picks up load shuffling from moving fingers near the mic.

Get the total played duration of a video in MPMoviePlayer

I need to get information about total time a video is played using MPMoviePlayer.How to handle the case when user watches a 3 min video upto 2 min and moves backward to 1.30 and closes the video.The requirement is to know the fraction of video viewed by user accurately.
From the Apple docs on MPMoviePlayerController:
Movie Player Notifications
A movie player generates notifications to keep your app informed about the state of movie playback. In addition to being notified when playback finishes, your app can be notified in the following situations:
When the movie player begins playing, is paused, or begins seeking forward or backward
Using these notifications, you could set your own timers to know the total amount of time that a video has been playing. Specifically, you probably want the MPMoviePlayerPlaybackStateDidChangeNotification.
Knowing the total percentage of the video watched could be a little trickier but still possible I think. You would need to register for the MPMediaPlayback protocol and use it in conjunction with the PlaybackStateDidChangeNotification mentioned above.
One idea I had (though probably not the best or most efficient approach) would be to create an array of BOOL values, 1 for each second of the video. When a video plays, grab the currentPlaybackTime on the player and mark off each second as it is played. If the video state changes (pause, skip forward, etc), stop marking them off until it is resumed, then start at that new index based on the new currentPlaybackTime and continue marking. When they're finished, calculate the % of indexes that have been marked.
MPMoviePlayerController
MPMediaPlayback Protocol
Let me know if this works for you!!

Resources