hi everyone!
there is way to create, save and loop a x seconds of Microphone input?
i have find a way to record and save a file, but when i try to play it, it have a millisecond of silence, and i need a clear loop for my app
Anyone can help me? ![]()
hi everyone!
there is way to create, save and loop a x seconds of Microphone input?
i have find a way to record and save a file, but when i try to play it, it have a millisecond of silence, and i need a clear loop for my app
Anyone can help me? ![]()
For one, it has to be saved as WAV, as you won’t be able to smoothly loop an MP3 for various reasons of the format’s “chunked” nature.
The other thing to do is choose some number of samples (say 1/10th of a second worth) and fade out the end, fade in the beginning, and slightly-overlay the end to the beginning and the beginning to the end (in the sound editor). This will also help smooth out any issues.
Also, when you cut the audio, make sure you cut it right as the wave sample passes through the zero mark, otherwise there will be a click.
Thanks for reply,
I already save it as a wav file
i not understand well the part of cut and wave sample, can you explain me in more detail?
this is my code:
public void RilasciaBottone()
{
StartCoroutine (DelayStato (0));
Microphone.End(_device);
int converti = _clipRecord.samples;
int converti2 = _clipRecord.samples - (_clipRecord.samples/2);
int overlapSamples = (int)(0.2f * _clipRecord.frequency);
SalvaClip = AudioClip.Create ("cut1", converti, _clipRecord.channels, _clipRecord.frequency, false, false);
float[] smp1 = new float[(converti) * _clipRecord.channels];
float[] smp2 = new float[(converti2 +overlapSamples) * _clipRecord.channels];
_clipRecord.GetData(smp1, 0);
SalvaClip.SetData(smp1,0);
var filepath = Path.Combine(Application.dataPath, "porcamadonna.wav");
SavWav.Save (filepath, SalvaClip);
CASSA.GetComponent<ExampleClass> ().sourceClip = SalvaClip;
CASSA.SetActive (true);
DiversiLoop [contaclip] = SalvaClip;
contaclip++;
GameObject.Find ("PORCAMADONNA").GetComponent<AudioSource> ().clip = DiversiLoop[contaclip-1];
GameObject.Find ("PORCAMADONNA").GetComponent<AudioSource> ().Play ();
DeviContare = false;
}
Using an audio tool, like Audacity or SoundForge or whatever, you would ensure the endpoints match, or optionally blend them over a short period of time.
thanks for reply
i can not use tool because i must create the microphone loop on runtime.
i have tried to blend it but i have always the milliseconds problem…