I want to make a unity3d appllication for ios, and need to record audio.
Ref:
I found a way to record audio. But the saving audio format is wav. I want a compressed audio format, like ogg/mp3.
And I watch this question too, but it use lame, can I use lame on ios?
I thinks there are 2 ways:
- record audio, and save it in ogg, but I do not know how to compress audio from microphone on unity engine
- use SaveWav like the below, and convert the audio file to ogg or mp3, is there some library for unity to do this? And does it work well on ios platform?
I have no ideas now, hope your help!
P.S. (20160425)
I try this lib NAudio.Lame.
But it cannot be used in unity engine, do you know how to make it support unity engine and any platforms for unity? Or other solutions?
Still wait for your help!
Error When I rebuid project in vs
There is not only this error, but many other errors too, how to fix it?
No matter
master
orexperimental
branch. One error is Severity Code Description Project File Line Suppression State Error CS0103 The name 'LibMp3Lame' does not exist in the current context NAudio.Lame \C#Projects\NAudio.Lame\MP3FileWriter.cs 636 Active
this is build error in
master branch
.
Error About CopyTo
20160416
error CS1061: Type
NAudio.Wave.WaveFileReader' does not contain a definition for
CopyTo' and no extension methodCopyTo' of type
NAudio.Wave.WaveFileReader' could be found (are you missing a using directive or an assembly reference?)
Do you know how to fix it? Or other method to convert to mp3 file instead of the below codes.
using System.IO;
using NAudio.Wave;
using NAudio.Lame;
public static class Codec {
// Convert WAV to MP3 using libmp3lame library
public static void WaveToMP3(string waveFileName, string mp3FileName, int bitRate = 128)
{
using (var reader = new WaveFileReader(waveFileName))
using (var writer = new LameMP3FileWriter(mp3FileName, reader.WaveFormat, bitRate))
reader.CopyTo(writer);
}