I'm writing a media player that uses the Bass.Net wrapper for Un4Seen's Bass native audio API.
The library is all free for non-commercial use and I have the free license, but in the documentation it says that unless you tell Bass to use the MP3 decoder built into Windows, it requires that you to also get a separate license from the MP3 licensing organization.
However, I cannot find anywhere how to get Bass.Net to tell it to use the Windows decoder instead of the one built into Bass (that requires the license).
This is going to be an open source application and I don't want to have to get a license for something that's free.
Any ideas how to do this?
According to some forums:
With version 2.3.0.1 there are now two versions of the bass.dll available:
a) the standard on in the main directory based on the BASS internal MP3 decoder
b) the on the 'mp3-free' directory which is using the Windows based MP3 decoder
Source
So, you should be able to simply replace the bass.dll with the version in the mp3-free directory, and it will use the windows mp3 decoder automatically.
The information below the line is outdated. Apparently, they got rid of the BASS_CONFIG_MP3_CODEC config in an earlier version of Bass.NET
If you have the .NET API help chm (/help), you can look at the BASS_SetConfig method in the Bass class for more information on setting up configurations.
Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MP3_CODEC, 1);
Interestingly enough, the BASS_CONFIG_MP3_CODEC value (supposedly of the BASSConfig enumeration), is listed in the Get/SetConfig methods, but not in the actual documentation of the enum.
Related
I did some research on converting video's to audio (MP3) on Windows Phone, but I can't find any converter or even basic functionality on the Windows Phone core to do this. Is this even possible?
You have a NuGet package named: MediaToolkit which is available with the NuGet package manager and also here: https://www.nuget.org/packages/MediaToolkit/
The library exposes features which convert video files into various other video formats. Grab images from videos. Perform a range of other audio / video transcoding tasks, even cutting / splitting videos.
To find the source code / code examples, visit GitHub: https://github.com/AydinAdn/MediaToolkit
To download it straight in to your project, use the Project Manager Console for NuGet: PM> Install-Package MediaToolkit.
There are no classes inside the Windows Phone 8 framework, the best thing to do is to go with an external library (like the one #Gaurav Deochakke) posted.
I've looked at the supported Win32 and COM APIs inside the WP8 framework, there are lots of API's that can help you (dis)playing media files, but none of them will help you either capture the desired audio or convert the video file to an audio file.
Although you might want to look at IAudioCaptureClient and IAudioClient (less documented), they might be able to help you with capturing the output of a file that has audio (a video for example). The only downside of this will be that you will have to loop through the video per second.
As stated above I'd go with a simple library to complete your task, but if you have time and you are interested in creating the solution yourself, I'd go with the links I posted.
I am developing application that receives media content(.mp3/.mp4/.avi) in form of bytes.
However, as WPF doesn't support playing media from stream, So I started with WMP.dll.
I am creating class library that receives media in form of bytes and media format and play media accordingly.
Referring Creating the WMP Programmatically, however, I didn't find method to pass bytes stream.
So My question is how do I play media from bytes using wmp.dll?
Edit: I am using WMP.dll using COM located at C:\WINDOWS\system32\wmp.dll
I've been through this process a long time ago ...
Basically I would advise you NOT to go down the WMP route at all. It's heavy, cumbersome and not very nice to work with. I encountered lots of issues along the way basically. Least of all it being feature rich (which it isn't).
The best solution I found and the one I'm still using now is a library called BASS from Un4SeenDevelopments.
This library is tiny < 100k and basically it's awesome. Never had a problem with it and it has it's own .NET wrapper that is a free download from the site.
The support is amazing and the compatibility via a massive selection of plugins and additional libraries is staggering.
Highly recommended for what you want to do.
"BASS is an audio library for use in software on several platforms. Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via OS codecs and add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions. All in a compact DLL that won't bloat your distribution."
I need to write a utility in c# that uses Google Speech Api to convert speech from an audio file into text. As far as I know, Google only accepts .flac format for this api. Unfortunately, I have .wav and .mp3 audio files. So I am trying to find out if there is a way for me to convert mp3 to flac in .NET. I looked at NAudio, but it doesn't seem to be working with flac files.
I ended up using Gregory S. Chudov's C# implementation of FLAKE encoder. You can find more information at
http://www.hydrogenaudio.org/forums/index.php?showtopic=74242
There is another project on BitBucket that uses CUETools FLAKE in its Google Speech Api wrapper. It is a good starting point for implementing speech to text using Google speech api. You can find it at
https://bitbucket.org/josephcooney/cloudspeech
I was able to convert wav to flac without much difficulty using the FLAKE encoder. Hope this helps you.
Take a look at http://naudio.codeplex.com/
NAudio is an open source .NET audio and MIDI library, containing dozens of useful audio related classes intended to speed development of audio related utilities in .NET. It has been in development since 2002 and has grown to include a wide variety of features. While some parts of the library are relatively new and incomplete, the more mature features have undergone extensive testing and can be quickly used to add audio capabilities to an existing .NET application. NAudio can be quickly added to your .NET application using NuGet.
Edit
Sadly FLAC is not supported there, as i see in the overview. Try it yourself.
I need to play the audio files like mp3 and .wav using c#. I don't want to use the com dll's and I need some functionality like to set the current time and end time of the file to play. etc.
Need some sample exmaples for the same.
To play audio using C# at some point the managed code will need to call into unmanaged APIs. NAudio provides wrappers for four different Windows audio playback APIs. WaveOut would be the most appropriate choice for you, since it is not COM based.
To decode MP3, you have a choice of using the codecs that come with Windows or trying to find a fully managed MP3 decoder. NAudio provides interop wrappers for two different Windows MP3 decoders - the Fraunhofer ACM codec that comes with Windows XP and above and the DirectX Media Object decoder that comes with Windows Vista and above. If you want a fully managed MP3 decoder, you can try NLayer which is a port I made of JavaLayer to .NET, although its public API doesn't currently allow it to slot neatly into an NAudio app.
I want to transcode a lot of audio from its source format to PCM without resampling or messing with the sample size. I figure if Windows Media Player can play the file and it doesn't use a legacy ACM codecs it must be using DirectSound to do so (this is on Windows XP and Windows Server 2k3). So is it possible to access DirectSound from C# and do so? I've tried searching the web but all the examples have been about playback which I have no interest in doing.
DirectSound is an audio playback API, you mean DirectShow. Windows Media player does use DirectShow to play audio files. In theory, all you need to do is build the same playback graph that media player uses, but replace the audio driver on the end with a .WAV writer filter.
This is somewhat easier to do in C++ code, since the DirectShow graph object is really designed to be called from C++, but with a good set of interop definitions, you can do this in C#.
There's http://directshownet.sourceforge.net/ for serious hacking with DirectShow in .NET, but that's probably overkill for your problem.
I would suggest getting a copy of GraphEdit if you don't already have one. You can use it to "prototype" direct show graphs interactively. drop a file into graphedit. then delete the filter on the end and replace it with a file writer filter.
One problem you will have is that there is no .WAV file writer filter in the default set of o DirectShow filters, you will have to find or write one.
If you just want to get the files converted, and could care less about learning how to write code using DirectShow, I would suggest that you just get a copy of Sound Forge (possibly even a demo version). It has a scripting language (C#,vb) that can be used to easily batch process most audio file formats.
Conversion to WAV can be done from the Windows command line using SoX (Sound eXchange, http://sox.sourceforge.net/). You could write a batch file or a C# application that calls SoX with the proper attributes. I'm not sure how WinAMP's feature works specifically, but it has a file writer output option built in as well. You can stream the entire playlist to wave files.
Have a look at this article on CodeProject about audio conversion here and here.