|
Hi,
Does anyone have an example to get me started on recording to an mp3 file.
I want to record from the microphone and save it directly to an mp3.
I have a working project but now I save it to wav and then send it to lame and I want to skip that step.
Thanks,
/Johan
|
|
|
|
|
Hello,
the only program i know that streams "directly" to a desired audio format is the VLC Media Player. The good news is, that it is open source and quite well documented. But... it's unmanaged (of course) and i think you will have to dig through quite a bit of code in order to find something useful.
Anyway, try this:
http://www.videolan.org/developers/vlc.html[^]
Michael.
|
|
|
|
|
Thanks for your answer but I was hoping that there might be a simple library I could use
|
|
|
|
|
Check this[^] article - it uses the dll from Lame. Creating your own encoder will be a LOT of hard work and probably not possible in C#?
Dave
|
|
|
|
|
That article does pretty much what I have so far, it takes a wav-file and uses lame to create an mp3.
I want to record directly to mp3.
|
|
|
|
|
AFAIK, I could be wrong (but I've been around the pro audio world for over 20 years) it's not possible.
MP3 is an encoding format that compresses existing audio.
It's like trying to write data to a zip file without first either saving the file or creating it in memory - the file has to exist somewhere first.
Dave
|
|
|
|
|
Yes, I realize it has to created in memory or something like that, so what I'm looking for is a free audio library that takes the data from the mic and sends it directly to lame. My problem is that it must be free for commercial use.
|
|
|
|
|
Just had a quick look at the source code from the article I referenced.
It uses its own class WaveStream which takes a Stream in the constructor. I'm pretty sure that would work with a MemoryStream , and if not, I can't imagine it'd be too difficult to ads a new overload to the constructor. Then you could create the wav in memory (MemoryStream) and write directly to disk as mp3.
Dave
|
|
|
|
|
You're right, that could absolutely work, I will try it out
Thanks for the help everybody
|
|
|
|
|
let me know if you get it working. If it's viable I could find a use for it myself!
Dave
|
|
|
|
|
Audacity[^] is an excellent program that does the streaming. It is open-source (not .NET), but it might be an area to start. For encoding to mp3 is uses the lame library mentioned in a previous post.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi fellows, I have 50 textbox and 50 checkbox on my Form1.cs. While overriding the dispose method do i have to dispose all of those textbox and checkbox that were create explicitly e.g txtbox1.dispose(), checkbox1.dispose() or i can simply dispose the entire form e.g Form1.dispose();
Perhaps, what i want to know if GC dispose all the child controls when am disposing the form1. If so is there any compile list of controls that we have to dispose ourselves?
Thanks
|
|
|
|
|
Hi,
I trust Control.Dispose() disposes of its children (Control.Controls), and Form IS a Control.
BTW: That should be sufficient reason for you to call base.Dispose() inside myControl.Dispose()
when inheriting from a Control.
modified on Tuesday, July 15, 2008 3:37 PM
|
|
|
|
|
Visual Studio usually gives you a Dispose method to do that.
If you're using VS, look in the Form1.Designer.cs file (depending on version).
It should look something like this:
protected override void Dispose ( bool disposing )
{
if ( disposing && ( components != null ) )
{
components.Dispose ();
}
base.Dispose ( disposing );
}
|
|
|
|
|
Thanks for answering that we should trust on the base control.dispose to dipose all child controls but i didn't get the answer on what are the controls that we need to define the dispose explicitly. Are there any e.g for those controls.
|
|
|
|
|
Simply disposing of the form will take care of it if they are built in controls that aren't accessing unmanaged resources.
I suppose you could do
foreach (Control thisControl in Controls)
{
thisControl.Dispose();
} if you have reason to be paranoid!
Dave
|
|
|
|
|
You've already had the answer to your question but I have to ask, why do you have so many controls on 1 form? Isn't this going to be a bit much for your users to take in? Step back for a minute and think about how your users are going to use the application and then look again at the number of textboxes; then see if you can figure out a way to simplify the design for your users.
|
|
|
|
|
Pete O'Hanlon wrote: Isn't this going to be a bit much for your users to take in?
I thought that same question when reading the OP. Sounds rather intimidating and unfriendly.
Pete O'Hanlon wrote: look again at the number of textboxes; then see if you can figure out a way to simplify the design
Excellent point.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
i've got a problem regarding the System.windows.forms.webbrowser-control as it won't host certain plugins that run fine in the standard iexplorer. The problem occurs roughly on 50% of the machines, interestingly mainly those with windows vista on it. (Although there are vista-PCs where it runs just fine).
Any help would be appreciated,
Michael.
|
|
|
|
|
I have a requirement to allow an ADODB Connectionless RecordSet to be passed to a COM object from an Excel VBA application.In VB.Net, I am able to open the Connectionless RecordSet by first instantiating the object, then using the object's Open() method with no parameters. In C# however, the ADODB.Recordset's Open method requires all 5 parameters be specified (source, connection, cursor type, lock type and options). I have tried setting the source and connection parameters to an Object.Type.Missing and .Net null, played with the other parameters, essentially running the matrix of all possible combinations and I still get the error "Arguments are of the wrong type..." I am rapidly reaching the level of frustration where I believe it is in fact not possible to open an ADODB Connectionless RecordSet from C#. Any suggestions"?
|
|
|
|
|
The answer to this question is in two parts.
First, the connectionless ADODB.Recordset must be passed inside an ADODB.Stream object.
Next, to open the recordset in C#, use the stream object as the source for the recordset:
recordset.Open(ADODBStream, System.Reflection.Missing.Value, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, -1)
|
|
|
|
|
Hello, Here I'm directly passing the crystal reports parameters through the code, and generating the report but for some obvious reason, I want the records to be stored first of all into a 2-dimensional array and from there writing it back onto Crystal reports.
Note : The reason why I'm looking for 2-Dimensional array is that currently upon execution I'm getting a Crystal Report with repeated records and that too upto the no. of maximum records in table.
To be more clear, lets say, that I have an access database with 30,000 records and whn I generate the crystal report I'm expecting all 30,000 records to be displayed row-by-row. But instead of that I'm getting the first record repeated 30,000 times..........NEED HELP........!!!
The actual code before storing it in 2D-array is as given below:
private void btnReport_Click(object sender, System.EventArgs e)
{ try
{
makeReport(report_file);
for (int recordCount=0; recordCount <= myTable.Rows.Count; recordCount++)
{
SetParamValue("@parameter1", myTable.Rows[recordCount]["CLNT#"].ToString));
SetParamValue("@parameter2", myTable.Rows[recordCount]"CNAME"].ToString));
SetParamValue("@parameter3", myTable.Rows[recordCount]["CSEX"].ToString));
SetParamValue("@parameter4", myTable.Rows[recordCount]["CSS#"].ToString()); crystalReportViewer1.ReportSource = ReportDoc;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "EXCEPTION");
}
}
private void SetParamValue (string paramName, string paramValue)
{
for(int i=0; i<reportdoc.datadefinition.formulafields.count;>
if(ReportDoc.DataDefinition.FormulaFields[i].FormulaName=="{" + paramName + "}")
{
ReportDoc.DataDefinition.FormulaFields[i].Text = "\"" +paramValue +"\"";
}
crystalReportViewer1.ReportSource = ReportDoc;
}
private void makeReport(string ReportFile)
{
ReportDoc.Load(ReportFile);
}
|
|
|
|
|
Whats the point of setting the same paramvalue over and over?
|
|
|
|
|
In my opinion, they are all different parameter values (i.e @parameter1, 2 and so on) are they are the parameters which are being passed into the Crystal Report under 4 different column headings (i.e Client#, Name, Sex, SSN#)..........
to be more clear, @parameter1 wud fetch the value for Client# from the code and pass it to Crystal Report and so on.............since there are 4 fields in Crsyal Reports to be displayed, I have used 4 parameter fields...........did it make any sense............it wud be nice if u can help me with a better way to do this............
|
|
|
|
|
reality_strikes wrote: crystalReportViewer1.ReportSource = ReportDoc;
Shouldn't this line be outside your loop? At the moment, it's being called in every iteration.
|
|
|
|