mbrola Binary for linux CentOS - text-to-speech

I am trying to use mbrola binary on CentOS box. I tried many binary listed on below page but none is working.
http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html
I am getting following error -
Processing Utterance: com.sun.speech.freetts.ProcessException: Cannot start mbrola program:
I believe this is most likely incompatible binary for CentOS.
Can you please tell me if there is a binary available for CentOS ?
Code -
public static void createAudioFile(String text, String fileName) {
AudioPlayer audioPlayer = null;
//System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_time_awb.AlanVoiceDirectory");
System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
Voice voice;
VoiceManager vm = VoiceManager.getInstance();
voice = vm.getVoice("mbrola_us1");
voice.allocate();
try{
String directoryPath = audioDir+fileName;
audioPlayer = new SingleFileAudioPlayer(directoryPath,Type.WAVE);
voice.setAudioPlayer(audioPlayer);
voice.speak(text);
voice.deallocate();
audioPlayer.close();
}
catch(Exception e){
e.printStackTrace();
}
}

I found Mbrola binary for CentOs from following location -
http://rpm.pbone.net/index.php3/stat/4/idpl/30430620/dir/centos_7/com/mbrola-301h-7.1.x86_64.rpm.html#content
Steps to follow -
1. Download the following rpm
ftp.gwdg.de mbrola-301h-7.1.x86_64.rpm
run > rpm -ivh mbrola-301h-7.1.x86_64.rpm. This will install mbrola binary into /usr/bin.
Copy /usr/bin/mbrola to your preferred location and set mbrola.base to it as - System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
done.

Related

Swift5 Can't record audio on mac os using AVAudioRecorder ( Error : [plugin] AddInstanceForFactory: No factory registered for id <CFUUID )

Making audio recorder application for Mac OS.
Have one trouble when I using AVAudioRecorder.
Don't crash but always shows this error.
Error : [plugin] AddInstanceForFactory: No factory registered for id <CFUUID
...
Error : HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine
** This is my code
var audioRecorder: AVAudioRecorder!
let filepath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("recording.m4a")
let settings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 12000,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]
do {
audioRecorder = try AVAudioRecorder(url: filepath, settings: settings)
audioRecorder.record()
sleep(10)
audioRecorder.stop()
} catch {
print(error.localizedDescription)
}
I have fixed this problem.
The original CLT project doesn't contain Info.plist file.
You have to set Info.plist and allow "Audio Input" of "Resource Access".
Solution
I have made Info.plist file myself and set "Microphone Usage Description" on it.
The main is to add Info.plist and set Info.plist to project setting.
( ** Build Setting / Packaging / Info.plist File : Info.plist )
Add Hardened Runtime on Project
( ** goto Signing & Capabilities and Add "Hardened Runtime" by click "+Capabilty" )
Allow "Audio Input"
( ** Signing & Capabilities / Hardened Runtime / Resource Access / Audio Input )
After setting above, built project.
Can't run directly on Xcode.
When you run on Xcode, app would be crashed.
Must run app on Terminal.

Aspose Cell .net core: Some text is cut off on linux host

I got an issue when develop an export feature using aspose on .net core platform. The issue is that some of the rows data exported as PDF is being cut-off.
I tried on my local environment (windows) there are no issue. The result is as good as I expected.
But when I publish the code into host environment (linux) the result seems off.
My local result (windows)
My hosted result (linux)
Here is piece of code that I am using to generate the file
public FileData ExportToFile(DataTable data, string format, string query)
{
var workbook = new Workbook();
var style = workbook.CreateStyle();
workbook.DefaultStyle = style;
var sheet = workbook.Worksheets[0];
AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = true };
data = _RemoveFormat(data); // Parse all data to String
/**/
sheet.PageSetup.Orientation = PageOrientationType.Landscape;
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.AllColumnsInOnePagePerSheet = true;
sheet.AutoFitRows(oAutoFitterOptions);
sheet.AutoFitColumns(oAutoFitterOptions);
workbook.Save(stream, pdfSaveOptions);
/**/
}
After discussing with Aspose support. I found out that the differences caused by that missing font from my Hosted Server (linux). So I need to install it on the server to get both document have the same style.
In my case, the my app was hosted in kubernetes cluster, so I need to add this line of commands in the dockerfile
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
fontconfig \
ttf-mscorefonts-installer

syslog-ng issue in tagging to server

I installed syslog-ng by using "yum install syslog-ng" in both local machine and server end.
I am using an open source version of syslog-ng.
My need is to pass the log file name from client to server end . I explicitly set the .SDATA.file at 18372.4.name field on my
client side, as the name of the file is available in the $FILE_NAME macro. But ".SDATA.file at 18372.4.name" is empty
in server side. When I am using some static file name the log beings to work.
Below is my code I dont know where i am going wrong If you need more information I can provide you can anyone help me.
MY CLIENT END SYSLOG-NG CODE:
source s_application_logs {
file(
"/var/log/test.log"
flags(no-parse)
);
};
destination d_access_system {
syslog(
"52.38.34.160"
transport("tcp")
port(6514)
);
};
rewrite r_set_filename {
set(
"$FILE_NAME",
value(".SDATA.file at 18372.4.name")
);
};
rewrite r_rename_filename {
subst(
"/var/log/",
"",
value(".SDATA.file at 18372.4.name")
type("string")
flags("prefix")
);
};
log {
source(s_application_logs);
rewrite(r_set_filename);
rewrite(r_rename_filename);
destination(d_access_system);
};
MY SERVER END SYSLOG-NG CODE:
source s_server_end {
syslog(
port(6514)
max_connections(1000)
keep_hostname(yes)
);
};
destination d_log_files {
file(
"/var/log/test/${.SDATA.file at 18372.4.name}"
create_dirs(yes)
);
};
log {source(s_server_end);destination(d_log_files);};
The problem is that the $FILE_NAME macro is currently available only in the commercial version of syslog-ng. For a possible workaround, see this blogpost: Forwarding filenames with syslog-ng

org.apache.commons.vfs2.FileNotFolderException error navigating through folder using commons vfs 2.0

I just started to use apache commons vfs 2.0. I was trying to get file list of folder in c:\ but got error with c:\document and setting. Here is the code:
FileSystemManager fsm = VFS.getManager();
FileObject fo=fsm.resolveFile("c:\\");
FileObject[] fos=fo.getChildren();
for(FileObject f:fos){
FileType ft=f.getType();
if(f.getType().equals(FileType.FOLDER)){
for( FileObject fc:f.getChildren()){
System.out.println(fc.getName().getPath());
}
}
}
Error:
org.apache.commons.vfs2.FileNotFolderException: Could not list the contents of "file:///c:/Documents and Settings" because it is not a folder.
at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:693)
at mypack.gui.FileExplorer.<init>(FileExplorer.java:31)
at mypack.gui.FileExplorer.main(FileExplorer.java:42)
You have to use proper protocol to connect via VFS Try this:
FileSystemManager fsm = VFS.getManager();
FileObject fo=fsm.resolveFile("file:///c:/");
FileObject[] fos=fo.getChildren();
for(FileObject f:fos){
FileType ft=f.getType();
if(f.getType().equals(FileType.FOLDER)){
for( FileObject fc:f.getChildren()){
System.out.println(fc.getName().getPath());
}
}
}

Unable to load SWF from application storage directory

While publishing my AIR application(CurrentFile), I have also included chatFile.swf with the installation files.
In my AIR settings panel [AIR 3.7 for Desktop], under 'Include Files' I have the following:
CurrentFile.swf
CurrentFile-app.xml
chatFile.swf
Here is the AS3 code in my CurrentFile.swf:
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Loader;
import flash.filesystem.File;
var chatLoaderWindow:Loader;
function loadchat(m:MouseEvent):void
{
chatLoaderWindow = new Loader();
chatLoaderWindow.contentLoaderInfo.addEventListener(Event.COMPLETE, chatLoadComplete);
chatLoaderWindow.contentLoaderInfo.addEventListener(Event.INIT, chatInitLoad);
chatLoaderWindow.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, chatErrorLoad);
chatLoaderWindow.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, chatHttpStatus);
myclip.chatwindow.addChild(chatLoaderWindow);
var f:File = File.applicationStorageDirectory.resolvePath("chatFile.swf");
chatLoaderWindow.load(new URLRequest(f.url));
tracebox.text = "Chat URL" + f.url;
}
function chatLoadComplete(e:Event):void
{
tracebox.text = "chat loaded";
}
function chatErrorLoad(io:IOErrorEvent):void
{
tracebox.text = "chat IO Error: "+io;
}
function chatInitLoad(i:Event):void
{
tracebox.text = "chat INIT";
}
function chatHttpStatus(e:HTTPStatusEvent):void
{
tracebox.text = "chat Http"+e;
}
myclip.chatbut.addEventListener(MouseEvent.CLICK,loadchat);
/*
Output:
chat IO Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2035" errorID=2035]
EDIT: I figured it out. It was really simple
This is not required:
var f:File = File.applicationStorageDirectory.resolvePath("chatFile.swf");
chatLoaderWindow.load(new URLRequest(f.url));
Insert this:
chatLoaderWindow.load(new URLRequest("app:/chatFile.swf"));
So now my question is:
What is the purpose of File.applicationStorageDirectory.resolvePath?
There are two directories here. One is the "application" directory, where your install files are placed. One is the "application-storage" directory, which is a convenient place to write files to at runtime. To access these directories you can either use the File.resolvePath() function or use the URI-scheme shortcuts, app: or app-storage:. In your initial attempt, you were just looking in the wrong directory for your file.
File.applicationStorageDirectory.resolvePath("somefile.swf").url will equal "app-storage:/somefile.swf"
File.applicationDirectory.resolvePath("somefile.swf").url will equal "app:/somefile.swf"
The application directory is where your app was installed. The app storage directory is a folder your app can save files to.
resolvePath() returns a file object. You can use it for purposes other than getting the cross-platform url for the file location, such as fileObj.exists and fileObj.parent.createDirectory(). fileObj.url is just the url you would use with URLLoader to access the file in a platform-independent manner.