Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Your first Perl script
Re: My first Perl script
I confess that I didn't. Kinda up to my ass in alligators these days.golinux wrote:dasein . . . did you watch the video?
Re: My first Perl script
It's a perfect diversion for when you need a break and a good laugh!dasein wrote:I confess that I didn't. Kinda up to my ass in alligators these days.golinux wrote:dasein . . . did you watch the video?
May the FORK be with you!
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: My first Perl script
I wish I could hear them, or it was "closed" captchined, I felt like I am missing the humor since I could not hear what they say.by golinux »It's a perfect diversion for when you need a break and a good laugh!
================= any way ===========
This may give some people a "laugh" , it is very crude, but does work. I need to look
at some of the tutorial on "loops" now, unless someone can tell me ?
At this point I would just like it to repeat, and give another problem, keep repeating and just use ctr-l c to exit, when I am ready.
Code: Select all
#!/usr/bin/perl
my $random = int rand 10;
my $random2 = int rand 10;
print "$random x $random2 = please hit enter then your answer";
$_ = <STDIN>;
$x = $random * $random2;
chomp $answer;
while ( $answer ne "$x" ) {
print "$answer enter the answer: ";
$answer = <STDIN>;
chomp $answer;
}
print "Great $answer is correct.\n";
print "Hit enter key to continue: ";
$_ = <STDIN>;
if ( $answer eq "$x" ) {
print "$x is correct\n";
}
##### would like it to just start over again, when I hit "enter" ($_ = <STDIN>)
I suppose I should try doing a search on that as well.It's a common enough mistake to have it's own name, and even acronym: it's called the off-by-one (OBO) bug.
Thanks
p.s. as much as I enjoy figuring it on my own, any examples, or ideas certainly are welcome.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: My first Perl script
Never needed to do a search, I finally remembered ! In qbasic, there is a also a "off by one", factor, I never though of it as a "bug" , and I have a loop now also:So far I have not yet encounterd the "subtle" problem
Code: Select all
#!/usr/bin/perl
for( ; ; )
{
my $random = int rand 11;
my $random2 = int rand 11;
print "$random x $random2 = please hit enter then your answer";
$_ = <STDIN>;
$x = $random * $random2;
chomp $answer;
while ( $answer ne "$x" ) {
print "$answer enter the answer: ";
$answer = <STDIN>;
chomp $answer;
}
print "Great $answer is correct.\n";
print "Hit enter key to continue: ";
$_ = <STDIN>;
if ( $answer eq "$x" ) {
print "$x is correct\n";
}
print "hit enter to continue, ctr-c to exit";
$_ = <STDIN>;
print "\033[2J";
#print "\033[2J"Might not work on some systems but it does on mine
}
Still really rough or crude , but now I have something to work with, ....
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: My first Perl script
Yes you do.GarryRicketson wrote:I need to look at some of the tutorial on "loops" now...
Can you think of a more kid-friendly way to end the program?GarryRicketson wrote:At this point I would just like it to repeat, and give another problem, keep repeating and just use ctr-l c to exit, when I am ready.
Edit I see you found it. But you've only fixed half of it.GarryRicketson wrote:I suppose I should try doing a search on that as well.it's called the off-by-one (OBO) bug.
Garry, it seems clear that you'd like more help with this, but figuring stuff out for yourself has at least two advantages:
1) We all learn better when we can apply what we've learned to a project we're actively working on. This is why "write a 'russian roulette' program" is a mainstay of programming 101 homework.
2) We learn other stuff along the way. That stuff (called "incidental learning") is a vital part of the larger learning experience.
The vast majority of programming involves no more than a handful of basic operations and concepts. Focus on learning those concepts, rather than becoming mired in syntax. This "concept-centered approach" will help you see where what you're learning about in perl maps to something you already know from BASIC. It'll take some time and some practice, but you seem to be having a pretty good time, so enjoy the ride.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: My first Perl script
Thanks, yes I am having fun with this, every time I work on it , and look at some of the tutorials, I do gain a little, and that is encouraging.
Oh, I am sure there is, and there is a lot I need to think of and then figure ot
to make it more fun, the qbasic one had some sounds, and played some tunes using the
"play" command, and also I made a "piano" that one could play tunes with, just using the "beep", and play command....there will be more , but like you are saying I need to get more familiar and comfortable with perl and just some basic operations and concepts. with it.
On the "ctrl-c", that is what I first learned, on dos, but also this may sound surprising,
the "ctrl-c" is something she all ready is familiar with, and she is only 4 yrs old, she still does not know any addition, counting, nor reading really... so I have plenty of time on this.
I did find, and have grasped some concepts for some text stuff,that are really easy, and can help her start learning letters and spelling.
Part of it is also, but she is still a little to young, but the idea is to give her something she can edit, like a template,... for example, once she knows the times table 1 through 10, she can also change the values her self, and start getting numbers above 10,..
Similar she herself can change the text stuff , to say things the want she wants,..etc.
But any way, now I am getting ahead of myself, a little bit at a time,.
thanks,...
Can you think of a more kid-friendly way to end the program?
Oh, I am sure there is, and there is a lot I need to think of and then figure ot
to make it more fun, the qbasic one had some sounds, and played some tunes using the
"play" command, and also I made a "piano" that one could play tunes with, just using the "beep", and play command....there will be more , but like you are saying I need to get more familiar and comfortable with perl and just some basic operations and concepts. with it.
On the "ctrl-c", that is what I first learned, on dos, but also this may sound surprising,
the "ctrl-c" is something she all ready is familiar with, and she is only 4 yrs old, she still does not know any addition, counting, nor reading really... so I have plenty of time on this.
I did find, and have grasped some concepts for some text stuff,that are really easy, and can help her start learning letters and spelling.
Part of it is also, but she is still a little to young, but the idea is to give her something she can edit, like a template,... for example, once she knows the times table 1 through 10, she can also change the values her self, and start getting numbers above 10,..
Similar she herself can change the text stuff , to say things the want she wants,..etc.
But any way, now I am getting ahead of myself, a little bit at a time,.
thanks,...
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: My first Perl script
I hope that comment didn't seem insensitive. If it's any consolation, the talk was captioned in several screens during the event. Did you notice that? You could always write to them and perhaps request they do split screen captioning on videos in the future.GarryRicketson wrote:I wish I could hear them, or it was "closed" captchined, I felt like I am missing the humor since I could not hear what they say.by golinux »It's a perfect diversion for when you need a break and a good laugh!
May the FORK be with you!
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: My first Perl script
No not at all , and the parts that they did show some "captions" and examples, I did read, so I am not sure how much or what I missed in not hearing them.(if anything) Any way thanks for sharing it, I can look at it again and pay more attention to the parts with captions, like you say, it is a good diversion when I, or anyone wants to take a break, for a laugh,..I hope that comment didn't seem insensitive
thanks
I am the sort of person that even reading a joke, or piece of humor, it usually takes me a few times , before I "get it", and see the humor.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: My first Perl script
Enough time so that you will have forgotten more then you've learned so far. (Programming is not like riding a bicycle; unused skills and concepts definitely atrophy with time.)GarryRicketson wrote:...she is only 4 yrs old, she still does not know any addition, counting, nor reading really... so I have plenty of time on this.
That said, I'm actually a huge fan of early exposure to arithmetic and even very rudimentary math at a very young age, particularly when that exposure is framed in terms of math as a different "language." (And so it surely is; mathematics is the language of Nature.)
Human children have an amazing ability to absorb languages up to about age 7. Expose them to one, they learn one. Expose them to three, they learn three. The ability seems to be hard-wired into our brains. And at its root, math obeys exactly the same principles as any other language. (That is to say, rules regarding, say, subject-verb agreement and rules regarding, say, properties of multiplication are not so much different as they are merely distinct.)
Sorry. End of pedagogical rant.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: My first Perl script
OK, well thanks again Dasein, and then this, I had not yet thought about what to say really, but you are right, :
Ok that is well said, and I agree, like wise yes, I like some help, your pointing out the "off by one" "bug", for example, was a big help and just about the same time I was going to "google" that, to get more clues, I remembered in some qbasic tutorial, that was one of the first things they mentioned.
Just to clarify, the bigger motive in starting this topic/thread, not so much that I need help, the material and tutorials are on the "Web", all the help I need is out there, but I enjoying sharing what I do with my Debian system, even though Perl scripts, and any programming can be done on any OS, that part is not to important, but it can be a factor, what works on one OS/distro, might not work on another.
Any way, I posted my first attempt at perl, but in no way did I intend the topic/thread to be limited to just "Garry's first Perl script", my intention was to try to start something for others, if there are any on this forum trying to start learning how to wtite some perl scripts, to perform what ever tasks, or perhaps even a game or something.
I enjoy seeing what others are trying to do as well, ideas they have ,etc. Of course
if people think "Perl is dead", well those would not have much interest, and they can all ways start a topic on whatever programming language interests them as well.
There are so many very good tutorials, even with good search skills it can be kind of overwhelming, and one can waste a lot of time going to sites, and looking at a tutorial, browsing , trying to find parts that relate to what they do not understand, etc.
So anyway, after looking several I finally stumbled on to this one: I like it, so I downloaded some parts.
http://perl-begin.org/tutorials/perl-for-newbies/
With all that said, anyone else is more then welcome to share their "first scripts", or even more advanced "projects" if they want to.
I do want to add though, anyone that does not understand what any script will actually do, or how it will work should not simply copy/paste it into a file and make it executable, perl is powerfull enough , in the wrong hands a system could be "borked" very easily, or comprimised.
OK well I guess that is about it for now. Thanks for your interest, both Dasein and GOLINUX, I am happy at least a couple of forum members showed some interest.
The topic is pretty new, I just wanted to make it clear it was not intended as only looking for help for my script, but also intended for others as well. In fact I wanted to also demonstrate how even though I knew nothing about perl, using tutorials and some experimenting I was able to come up with a "crude , rude" but working "mini" program.
With just a little help, like "clues" etc,.. it makes it more fun when others show interest and are willing to take the time to respond. Thanks.
P.S. Eventually, when I have this more better( "chido",we say in Mexico) I mean, when my little program is more "cool", I will share the finished program.
====================================================================Garry, it seems clear that you'd like more help with this, but figuring stuff out for yourself has at least two advantages:
1) We all learn better when we can apply what we've learned to a project we're actively working on. This is why "write a 'russian roulette' program" is a mainstay of programming 101 homework.
2) We learn other stuff along the way. That stuff (called "incidental learning") is a vital part of the larger learning experience.
The vast majority of programming involves no more than a handful of basic operations and concepts. Focus on learning those concepts, rather than becoming mired in syntax. This "concept-centered approach" will help you see where what you're learning about in perl maps to something you already know from BASIC. It'll take some time and some practice, but you seem to be having a pretty good time, so enjoy the ride.
Ok that is well said, and I agree, like wise yes, I like some help, your pointing out the "off by one" "bug", for example, was a big help and just about the same time I was going to "google" that, to get more clues, I remembered in some qbasic tutorial, that was one of the first things they mentioned.
Just to clarify, the bigger motive in starting this topic/thread, not so much that I need help, the material and tutorials are on the "Web", all the help I need is out there, but I enjoying sharing what I do with my Debian system, even though Perl scripts, and any programming can be done on any OS, that part is not to important, but it can be a factor, what works on one OS/distro, might not work on another.
Any way, I posted my first attempt at perl, but in no way did I intend the topic/thread to be limited to just "Garry's first Perl script", my intention was to try to start something for others, if there are any on this forum trying to start learning how to wtite some perl scripts, to perform what ever tasks, or perhaps even a game or something.
I enjoy seeing what others are trying to do as well, ideas they have ,etc. Of course
if people think "Perl is dead", well those would not have much interest, and they can all ways start a topic on whatever programming language interests them as well.
There are so many very good tutorials, even with good search skills it can be kind of overwhelming, and one can waste a lot of time going to sites, and looking at a tutorial, browsing , trying to find parts that relate to what they do not understand, etc.
So anyway, after looking several I finally stumbled on to this one: I like it, so I downloaded some parts.
http://perl-begin.org/tutorials/perl-for-newbies/
With all that said, anyone else is more then welcome to share their "first scripts", or even more advanced "projects" if they want to.
I do want to add though, anyone that does not understand what any script will actually do, or how it will work should not simply copy/paste it into a file and make it executable, perl is powerfull enough , in the wrong hands a system could be "borked" very easily, or comprimised.
OK well I guess that is about it for now. Thanks for your interest, both Dasein and GOLINUX, I am happy at least a couple of forum members showed some interest.
The topic is pretty new, I just wanted to make it clear it was not intended as only looking for help for my script, but also intended for others as well. In fact I wanted to also demonstrate how even though I knew nothing about perl, using tutorials and some experimenting I was able to come up with a "crude , rude" but working "mini" program.
With just a little help, like "clues" etc,.. it makes it more fun when others show interest and are willing to take the time to respond. Thanks.
P.S. Eventually, when I have this more better( "chido",we say in Mexico) I mean, when my little program is more "cool", I will share the finished program.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Your first Perl script
I like this better:,
This is how it looks when running it:
The screen clears , after each problem is correctly solved, and a new one displayed.
One thing I like about Perl, and a little tip, I did not see in any of the tutorials,
If you have perl installed, working form the command line,
Type:
then enter: (for example)
This is what it says, when I hit <ctrl-d>
Perl is a fun, easy programming language to learn, I am really enjoying this.
This is how it looks when running it:
Code: Select all
perl-tests$ ./aamath.pl
Type in the correct answer,
Hit enter key to continue, if it is not correct
the program will not move on to a new problem,
think about your answer, and try again, when it is
the correct answer, it will tell you,
and give a new problem.
6 x 0 = 0
Great 0 is correct.
hit enter to continue, ctr-c to exit.
4 x 4 = 16
Great 16 is correct.
hit enter to continue, ctr-c to exit.
3 x 1 = 5
9
6
4
3
Great 3 is correct.
hit enter to continue, ctr-c to exit.
Code: Select all
#!/usr/bin/perl
print "Type in the correct answer, \n";
print "Hit enter key to continue, if it is not correct\n ";
print "the program will not move on to a new problem, \n ";
print "think about your answer, and try again, when it is\n ";
print "the correct answer, it will tell you, \n ";
print "and give a new problem.\n ";
for( ; ; )
{
my $random = int rand 11;
my $random2 = int rand 11;
print "$random x $random2 = ";
$x = $random * $random2;
while ( $answer ne "$x" ) {
$answer = <STDIN>;
chomp $answer;
;
}
if ( $answer eq "$x" ) {
}
print "Great $answer is correct.\n";
print "hit enter to continue, ctr-c to exit.";
$_ = <STDIN>;
print "\033[2J";
#print "\033[2J"Might not work on some systems but it does on mine
}
If you have perl installed, working form the command line,
Type:
Code: Select all
perl
then enter: (for example)
Code: Select all
/perl-tests$ perl
print "Type in the correct answer, \n";
[code]
Then use "ctrl-d" to execute the line:
on this it then displays
[quote]Type in the correct answer, [/quote]
But if it is not a valid command ,or string, it tries to give hints, as to why.
[code]perl-tests$ perl
but if the command is wrong
Can't locate object method "is" via package "wrong" (perhaps you forgot to load "wrong"?) at - line 1.
Perl is a fun, easy programming language to learn, I am really enjoying this.
Last edited by GarryRicketson on 2016-06-30 03:53, edited 1 time in total.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Your first Perl script
Now in Spanish, and some better methods.
Code: Select all
#!/usr/bin/perl
#use strict;
#use warnings;
print "Por favor escribe tu nuombre:\n";
$name = <>;
chomp($name);
print "Hola!, ", $name, "!\n";
print " $name, Vamos a hacer tablas ,tecla algunas letras o numeros:\n";
$string = <>;
chomp($string);
print "Lo que teclado,tiene:\n",length($string)," letras o numeros\n";
$_= <STDIN>;
print "[Instrucciones, ctrl-c o \"quit\" para salir]\n";
print "Entra para continuar\n";
$_ = <STDIN>;
OUTER: {
my ($x, $y) = map { int rand $_ } qw/11 11/;
INNER: {
print "$x x $y = ";
local $_ = <STDIN>;
chomp;
last OUTER if m/^quit$/;
redo INNER unless m/^\d+$/;
if ($_ == ($x*$y))
{ print "Muy buen es correcto!\n"; redo OUTER }
else
{ print "Oops!No es correcto,haga otra vez\n"; redo INNER }
}
}
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Your first Perl script
My first Perl script was written a few days ago, and played some helicopter and organ sounds into a MIDI file using libmidi-perl, which is originally a http://www.cpan.org Perl module. I highly recommend using CPAN for modules to use in larger projects. Perl is a very nice easy language. I might post my script sometime.
I am now planning a graphical MIDI sequencer using Tk from CPAN.(libtkx-perl in Debian)
I am now planning a graphical MIDI sequencer using Tk from CPAN.(libtkx-perl in Debian)
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Your first Perl script
I will look forward to that, (or "we" but I can not speak for others).I might post my script sometime.
That sounds interesting, I am thinking as well, to try to add some sounds, and maybe even graphics, I have the CPAN modules, but have not yet tried anything using them.and played some helicopter and organ sounds into a MIDI file using libmidi-perl,
thank you for sharing.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Your first Perl script
This is the original script. I'm sorry you may not be able to hear the output of sound-related scripts, but this one isn't very pleasant anyway.
And this is the start of my MIDI sequencer software; pretty much the same thing, just made nicer. (This code is released under the Perl license. Just had to throw that in there for if/when I release it.)
Both of these will require the installation of libmidi-perl.
Edit: I changed the license. I still have to decide on the eventual license for the software, so I changed this second script to redistributable for use in free software as defined by either the FSF or DFSG.
Code: Select all
use strict;
use warnings;
use MIDI;
#foreach (@MIDI::Event::All_events) {
# print "$_\n";
#}
my $organ_track = MIDI::Track->new();
$organ_track->events(
['patch_change', 0, 0, 19],
['patch_change', 0, 1, 124],
[ 'note_on', 0, 0, 50, 64],
[ 'note_on', 0, 1, 50, 96],
[ 'note_off', 96, 0, 50, 64],
[ 'note_on', 96, 0, 49, 64],
[ 'note_off', 96, 1, 50, 96],
[ 'note_on', 96, 1, 49, 90],
[ 'note_off', 192, 0, 48, 64],
[ 'note_on', 192, 0, 49, 64],
[ 'note_off', 192, 1, 48, 90],
[ 'note_on', 192, 1, 49, 90],
[ 'note_off', 288, 0, 48, 64],
[ 'note_on', 288, 0, 49, 64],
[ 'note_off', 288, 1, 48, 90],
[ 'note_on', 288, 1, 49, 90],
[ 'note_off', 384, 0, 48, 64],
[ 'note_on', 384, 0, 49, 64],
[ 'note_off', 384, 1, 48, 90],
[ 'note_on', 384, 1, 49, 90],
[ 'note_off', 480, 0, 48, 64],
[ 'note_on', 480, 0, 49, 64],
[ 'note_off', 480, 1, 48, 90],
[ 'note_on', 480, 1, 49, 90],
[ 'note_off', 576, 0, 48, 64],
[ 'note_on', 576, 0, 49, 64],
[ 'note_off', 576, 1, 48, 90],
[ 'note_on', 576, 1, 49, 90],
[ 'note_off', 672, 0, 48, 64],
[ 'note_on', 672, 0, 49, 64],
[ 'note_off', 672, 1, 48, 90],
[ 'note_on', 672, 1, 49, 90],
[ 'note_off', 768, 0, 48, 64],
[ 'note_on', 768, 0, 49, 64],
[ 'note_off', 768, 1, 48, 90],
[ 'note_on', 768, 1, 49, 90],
[ 'note_off', 864, 0, 48, 64],
[ 'note_on', 864, 0, 49, 64],
[ 'note_off', 864, 1, 48, 90],
[ 'note_on', 864, 1, 49, 90],
[ 'note_off', 960, 0, 48, 64],
[ 'note_on', 960, 0, 49, 64],
[ 'note_off', 960, 1, 48, 90],
[ 'note_on', 960, 1, 49, 90],
[ 'note_off', 1056, 0, 48, 64],
[ 'note_off', 1056, 1, 48, 90]
);
my $opus = MIDI::Opus->new();
$opus->format(0);
$opus->ticks(1056);
$opus->tracks($organ_track);
# {'format' => 0, 'ticks' => 100, 'tracks' => [$organ_track]});
$opus->write_to_file("test.mid");
Code: Select all
#!/usr/bin/perl
# I don't know if this is a legally binding copyright, but
# Copyright 2016 oldtechaa (Easily found on the Internet.)
# This software is redistributable as long as it is not modified for inclusion or copied verbatim into non-free software as defined by the FSF and DFSG.
use strict;
use warnings;
use MIDI;
# writes the MIDI output to a file based on the list of events and the filename
sub midiWrite {
my $midiEventsRef = shift;
my $midiTicks = shift;
my $midiFile = shift;
my $midiTrack = MIDI::Track->new({'events' => $midiEventsRef});
my $midiPiece = MIDI::Opus->new({'format' => 0, 'ticks' => $midiTicks, 'tracks' => [$midiTrack]});
$midiPiece->write_to_file($midiFile);
};
my $events = [
['patch_change', 0, 0, 19],
['patch_change', 0, 1, 124],
[ 'note_on', 0, 0, 50, 64],
[ 'note_on', 0, 1, 50, 96],
[ 'note_off', 96, 0, 50, 64],
[ 'note_on', 96, 0, 49, 64],
[ 'note_off', 96, 1, 50, 96],
[ 'note_on', 96, 1, 49, 90],
[ 'note_off', 192, 0, 48, 64],
[ 'note_on', 192, 0, 49, 64],
[ 'note_off', 192, 1, 48, 90],
[ 'note_on', 192, 1, 49, 90],
[ 'note_off', 288, 0, 48, 64],
[ 'note_on', 288, 0, 49, 64],
[ 'note_off', 288, 1, 48, 90],
[ 'note_on', 288, 1, 49, 90],
[ 'note_off', 384, 0, 48, 64],
[ 'note_on', 384, 0, 49, 64],
[ 'note_off', 384, 1, 48, 90],
[ 'note_on', 384, 1, 49, 90],
[ 'note_off', 480, 0, 48, 64],
[ 'note_on', 480, 0, 49, 64],
[ 'note_off', 480, 1, 48, 90],
[ 'note_on', 480, 1, 49, 90],
[ 'note_off', 576, 0, 48, 64],
[ 'note_on', 576, 0, 49, 64],
[ 'note_off', 576, 1, 48, 90],
[ 'note_on', 576, 1, 49, 90],
[ 'note_off', 672, 0, 48, 64],
[ 'note_on', 672, 0, 49, 64],
[ 'note_off', 672, 1, 48, 90],
[ 'note_on', 672, 1, 49, 90],
[ 'note_off', 768, 0, 48, 64],
[ 'note_on', 768, 0, 49, 64],
[ 'note_off', 768, 1, 48, 90],
[ 'note_on', 768, 1, 49, 90],
[ 'note_off', 864, 0, 48, 64],
[ 'note_on', 864, 0, 49, 64],
[ 'note_off', 864, 1, 48, 90],
[ 'note_on', 864, 1, 49, 90],
[ 'note_off', 960, 0, 48, 64],
[ 'note_on', 960, 0, 49, 64],
[ 'note_off', 960, 1, 48, 90],
[ 'note_on', 960, 1, 49, 90],
[ 'note_off', 1056, 0, 48, 64],
[ 'note_off', 1056, 1, 48, 90]
];
midiWrite($events, 1056,"Milestone1Test.mid");
Edit: I changed the license. I still have to decide on the eventual license for the software, so I changed this second script to redistributable for use in free software as defined by either the FSF or DFSG.
Check out SeekMIDI, a simple, lightweight MIDI sequencer at https://github.com/oldtechaa/seekmidi/!
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Your first Perl script
Thanks for sharing these, they seem to work ok, my kid confirmed , on the sound,
but he said it was "chido" (cool) .
but he said it was "chido" (cool) .
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Your first Perl script
The link in my signature is the Git repository for my MIDI sequencer, if you ever want to keep up with it and see how my learning is progressing.
Check out SeekMIDI, a simple, lightweight MIDI sequencer at https://github.com/oldtechaa/seekmidi/!
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Your first Perl script
Ok, thanks, I had noticed that,thanks.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?