|
From: Gan Uesli Starling on 4 Feb 2006 14:45 I want to write an open source script which does similar to the CGI here... http://morsecode.scphillips.com/translator.html He only shares the Java version and not the CGI. So I am thinking to trump him by writing my own, as best I can, and giving my own away for free. Some time back I heard of a morse-to-audio playout script in Perl which was open source. That would be a good short cut to start from...or at least to study first. Anybody know where I can find it? Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
From: zentara on 5 Feb 2006 05:40 On Sat, 04 Feb 2006 13:45:03 -0600, "Gan Uesli Starling" <gan(a)starling.us> wrote: >I want to write an open source script which does similar to >the CGI here... > >http://morsecode.scphillips.com/translator.html > >He only shares the Java version and not the CGI. So I am >thinking to trump him by writing my own, as best I can, and >giving my own away for free. > >Some time back I heard of a morse-to-audio playout script >in Perl which was open source. That would be a good short >cut to start from...or at least to study first. > >Anybody know where I can find it? Check out Audio::Data Audio::Play Midi::Simple These can output wav or midi files. #!/usr/bin/perl use strict; use MIDI::Simple; new_score; patch_change 1, 41; # Patch 41 = organ of some sort noop 'c1', 'f', 'o2'; # setup my $normal = 'en'; my $fast = 'sn'; foreach my $c (split '', '. - .. - ..- ... - .') { if($c eq ' ') { # interword pause r $normal; } elsif($c eq '.') { # dit n $fast; r $fast; } elsif($c eq '-') { # daah n $normal; r $fast; } else { print "What's \"$c\"? Skipping\n"; } } write_score("morse1.midi"); exit; __END__ You might be able to use MIDI::Realtime for realtime output from the keyboard.... a simple demo.(You will have to setup a key-release scheme, to stop the tones.) #!/usr/bin/perl use warnings; use strict; use MIDI::Realtime; use Term::ReadKey; ReadMode('cbreak'); #this works on linux with an SBlive, Alsa 1.0.4, kernel 2.4.22 # on my system, it has a bug when usb-hotplug and usb-midi are used # and the hotplug-blacklist is not setup properly my $midi = MIDI::Realtime->new(dev=>'/dev/sequencer', midi_device=> 1); #1,2,3,4 #5 for external keyboard while(1){ #thru USB UM-1 connector my $char; if (defined ($char = ReadKey(0)) ) { print ord($char),"\n"; # input was waiting and it was $char $midi->patch(ord($char)); #change instrument, 127 gives "exploding keyboard" :-) $midi->note(50,1,127); #play note } else { # no input was waiting } } ReadMode('normal'); # restore normal tty settings __END__ -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
From: Gan Uesli Starling on 5 Feb 2006 18:27 My attachment did not attach. Or at least I did not see it when I checked my post. Sorry, too, about the non-wrap. Anyway, rather than attach my code. If you like, it is on-line here: http://starling.ws/morse Thanks, PS - If I can't figure out how to delete the usenet.com advert at the bottom of my posts I'm going to get me a new provider. I won't willing pay for the privilege of advertising for them. Grrrrrr! Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
From: zentara on 6 Feb 2006 09:04 On Sun, 05 Feb 2006 17:27:36 -0600, "Gan Uesli Starling" <gan(a)starling.us> wrote: >My attachment did not attach. Or at least I did not see it when I >checked my post. Sorry, too, about the non-wrap. Anyway, rather >than attach my code. If you like, it is on-line here: > >http://starling.ws/morse Hi, it works. :-) -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
|
Pages: 1 Prev: Can someone write me a simple Perl script for a few bucks? Next: Help to parse text file |