- Home /
Audio Recorder Script, How Do I Use It?
Hey guys, I'm pretty new to unity, been doing it for almost a month but I've been lerking around unity answers for a while for previously posted questions, I've done pretty well so far, I'm almost done with my app in-fact, but the last thing I need to do is record sound from the game.
I've found this script: https://gist.github.com/darktable/2317063
But I don't know how to use it.. I don't see where there's a button to use all of this code, like a Input.GetKeyDown ("R") etc..
Any ideas? Thanks guys!
Does anyone know how I can make the following code work for android? http://answers.unity3d.com/questions/606232/how-to-save-an-audio-clip-to-mp3-file.html
This code here apparently works for android and I figure it's because of the following code from this link: https://gist.github.com/darktable/2317063
var filepath = Path.Combine(Application.persistentDataPath, filename);
Debug.Log(filepath);
// $$anonymous$$ake sure directory exists if user is saving to sub dir.
Directory.CreateDirectory(Path.GetDirectoryName(filepath));
using (var fileStream = CreateEmpty(filepath)) {
ConvertAndWrite(fileStream, clip);
WriteHeader(fileStream, clip);
Answer by Dizzyman572 · Jun 08, 2014 at 12:12 AM
Hmm, I think the code your looking is meant to convert file format. So it may not even be helping you with what you want to do. Would something like this be your answer? http://docs.unity3d.com/ScriptReference/Microphone.Start.html
Thanks Dizzy, I don't think so, I've researched $$anonymous$$icrophone before, but I'm pretty sure it's for recording audio through the microphone, not purely in-game audio.
The reason I came across that script was because of this question on here: http://answers.unity3d.com/questions/606232/how-to-save-an-audio-clip-to-mp3-file.html
I tried that guys script that's in java (it works, though I prefer C#) and I was fine with that, it was working on my pc, but I'm making this for android, the guy on the first answer suggested that script I posted and apparently the other guy got it to work, but he doesn't say how..
Oh okay, sorry that I wasn't much help. Hmm, have tried contacting the guy. I'll definitely think more about this question.
No worries man, yeah I might have to try to contact him via the forums, but I'm not sure if he's still paying attention to this place..
Alright, thanks!
Have you read the forum thread that the code was derived from?
No I hadn't, but after looking now, I can't seem to find a way to use it either
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How to Save Audio Clip through Script in unity3d? 0 Answers
Audio Record Limit? 1 Answer
Multiple Cars not working 1 Answer
Audio Trigger 3 Answers