Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  automatic talk file generator (perl/linux)
« previous next »
  • Print
Pages: [1]

Author Topic: automatic talk file generator (perl/linux)  (Read 1705 times)

Offline lfod

  • Member
  • *
  • Posts: 1
automatic talk file generator (perl/linux)
« on: August 16, 2007, 08:51:08 AM »
The posted link for automatic talk file generation appeared to be Windows only, so I wrote a small perl script to generate the directory and filename  talk files on a linux box.   I use linux and have an iRiver H160 aka H140.   If you know a bit of perl you can customize the script to your preferences.  It requires text2wave (festival voice package) and lame, and I post the perl script below.   If people think it would be useful I can clean the script up and make it a bit more configurable from the command line or even attach a GUI.


#!/usr/bin/env perl

# descend directory tree on H160 and add _dirname.talk
# files in each directory, and file.mp3.talk for voice menu to use
#
# requires text2wave, lame


use File::Find;

#sub wanted;

# change this line to point to your rockbox mount point
$top_dir = '/media/H160/music/';
$tmp = File::Find::find({wanted => \&wanted, follow_skip =>2}, $top_dir);

$tmp = File::Find::find({wanted => \&files, follow_skip =>2}, $top_dir);

# create a mp3 file foreach directory
foreach $d (sort keys %DIRS) {
    @path = split(/\//, $d);
    $dirname = pop @path;
    $dirname =~ s/_/  /g;
    print "$d  $dirname\n";

   
    open(OUT, ">filename.txt");
    print OUT "$dirname\n";
    close(OUT);
$cmd = "text2wave filename.txt -o _dirname.wav";
#print "$cmd\n";
system($cmd);

$cmd="lame _dirname.wav \"$d\/_dirname.talk\"";
#print "$cmd\n";
system($cmd);
}

# create a mp3 file for each ogg/mp3/mp4/wma/m3u file
foreach $f (sort keys %FILES) {
    next if ($f =~ /\.talk$/);
    @path = split(/\//, $f);
    $filename = pop @path;
    $filename =~ s/^\d+//;
    $filename =~ s/_/  /g;
    $filename =~ s/\.ogg//;
    $filename =~ s/\.mp3/  mp3/;
    $filename =~ s/\.mp4/  mp4/;
    $filename =~ s/\.wma/  wma/;
    $filename =~ s/\.m3u/ playlist/;
    print "\nf:$f  filename:$filename\n";

   
    open(OUT, ">filename.txt");
    print OUT "$filename\n";
    close(OUT);
$cmd = "text2wave filename.txt -o tmp.wav";
#print "$cmd\n";
system($cmd);

$cmd="lame tmp.wav \"$f\.talk\"";
print "$cmd\n";
system($cmd);
}

sub wanted {
    my ($dev,$ino,$mode,$nlink,$uid,$gid);

    (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))
    && (-d _)
#    && print("$File::Find::dir\n")
    && ($DIRS{$File::Find::name} = 1);
}

sub files {
    my ($dev,$ino,$mode,$nlink,$uid,$gid);

    (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))
    && (-f _)
#    && print("$File::Find::dir\n")
    && ($FILES{$File::Find::name} = 1);
}

Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: automatic talk file generator (perl/linux)
« Reply #1 on: August 16, 2007, 10:39:49 AM »
It would really be preferable if you attached this to the appropriate wiki page, the forums are not the appropriate place for such a thing.
Logged

Offline Domonoky

  • Developer
  • Member
  • *
  • Posts: 205
Re: automatic talk file generator (perl/linux)
« Reply #2 on: August 16, 2007, 02:13:36 PM »
And also note that rbutil, can now also generate Talkfiles :-)
At the moment it supports only filte and espeak, but it works on linux, windows, and mac :-)

Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  automatic talk file generator (perl/linux)
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.07 seconds with 15 queries.