Sending Text data to sound card in c# - text

I want to send text data to sound card like "my name is alex"?
how can i do this? do i have to convert it to .wav first? if yes then how to convert text to wav file?

You can use the built SpeechSynthesis in C# 4.0
using(var tts = new System.Speech.Synthesis.SpeechSynthesizer())
{
tts.SetOutputToDefaultAudioDevice();
tts.Speak("Hello");
tts.SetOutputToWaveFile("myHello.wav");
tts.Speak("Hello Again");
}
In a webbrowser you could use Google's text2speech (translate really):
http://translate.google.com/translate_tts?q=HelloWorld&tl=en

Related

Is there a way to convert from audio url to text in python

I have reference code (from the attached url) to convert speech to text with direct audio file. Convert sound from website to text in python
I tried passing the direct audio_url as string( "https://1filedownload.com/wp-content/uploads/2020/09/01.mp3") but it is not reading from the url.
Is there a way to convert the audio directly without downloading and then convert?

How to convert amr files to mp3 using C#

I am using NAudio MFT to convert different audio formats to MP3.
Now i want to convert amr file to MP3 using Naudio MFT. But, when i given amr file as input to MFT, it has thrown following exception "Exception from HRESULT: 0xC00D36C4". Is there any way to achieve this?
My C# code:
public byte[] ConvertAMRToMP3( )
{
var data = new MediaFoundationReader("..\\amr\\test.amr");
MediaFoundationEncoder.EncodeToMP3(data, "..\\test.mp3", 128000);
......
}
I am working on windows server 2012 64-bit platform.
Thanks in advance.
0xC00D36C4 is MF_E_UNSUPPORTED_BYTESTREAM_TYPE "The byte stream type of the given URL is unsupported."
There is no support for AMR in Media Foundation codecs.

how to decode amr files using c#.net

I need to decode amr format to pcm format, which is later converted to mp3 using c#.net. But I am hardly finding any library to do so. It seems with NAudio it is not possible. Is there any c# based open source library which can be used to decode this format files?. Presently I am working on windows server 2012(64 bit).
NAudio Code:
public void Decode()
{
.....
var result= new MediaFoundationReader("..\\sample.amr");
// later converted to mp3 here
}
It looks you two guys are doing the same thing: How to convert amr files to mp3 using C#
You typically need to have a [third party] AMR decoder installed and integrated into Windows API (ACM, DirectShow, Media Foundation). Then you will use your favorite library around this API, such as NAudio.
Example of AMR decoder: MONOGRAM AMR Pack.
You're unlikely to find a C# decoder for AMR files. I'd recommend just finding a command-line utility that you can call to convert to PCM. For example, it looks like sox can be used to decode AMR.

Does openSL support "returning decode audio buffer" for MP3/AAC?

Does openSL support "returning decode audio buffer" for MP3/AAC, as Open Max IL does?
I am creating an app that has mp3/aac as input and want to use openSL as a decoder, not the player. I need decoded PCM data back to my app, and I want to play / do something else with that buffer later.
I can't find any related APIs for this in opensl spec.
I haven't tried this, but perhaps you could set up a data source using as a URI data locator using MIME format with an Android audio buffer as the sink, then access the decoded data that way?

Convert RTF Stream to Plain Text Stream

I have crystal report and I need to convert it to text file. Currently I can only convert it to RTF Stream. Now I need to convert the RTF Stream to Text Stream. I am using C#.
Thanks.
Correct me if I am wrong but you are using the ExportToStream method with ExportFormatType.RichText:
Stream stream = report.ExportToStream(ExportFormatType.RichText);
This exports the report into an RTF stream. Now you wish to convert this stream to plain text (extract the text from the RTF). If that's true then this thread might have the answer for you.

Resources