Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Music-Player

by dbw (Beadle)
on Sep 04, 2007 at 22:03 UTC ( #637032=note: print w/ replies, xml ) Need Help??


in reply to Re: Music-Player
in thread Music-Player

I like your version a bit better than his, but I've still got to give a (--) for your initial complaint

...and for posting code without use strict; use warnings.
Read a nice little rant about the "usestrictusewarnings" dogma at point #9 (line 702) of this page. And most of your corrections are cosmetic anyway.

Anyway, a REALLY old school player would play the song by running various loops of instructions that cause the machine to hum at different frequencies. (My dad claims to have done this with punch cards in the 70s.) But I don't think that's even possible on modern hardware or in Perl. (/me waits eagerly to be proven wrong.)


/usr/bin/perl '-nemap$.%$_||redo,2..$.++;print$.--'


Comment on Re^2: Music-Player
Download Code
Re^3: Music-Player
by jdporter (Canon) on Sep 05, 2007 at 03:16 UTC

    It's an interesting discussion (I don't think I'd call it a "rant") and as usual MJD makes a lot of sense. What I don't get from it is that I was somehow wrong to have suggested that the OP include the pragmas.

    Of course, it isn't really about having the use strict; use warnings in the code as posted. It's about posting code which is strict safe and warnings clean. In fact, if the OP had enabled strict, he would have caught a non-trivial bug having to do with variable naming ($Dir vs. $Direction). And warnings would have (or could have, if he paid close enough attention) helped him catch the bug in the line

    if ( $Volume =~ /a-z/ or /A-Z/ ) . . .

    A word spoken in Mind will reach its own level, in the objective world, by its own weight
Re^3: Music-Player
by Polyglot (Monk) on Jun 11, 2009 at 11:56 UTC
    Alright, so, "back in the day" I programmed a lovely music player in BASIC, which later upgraded to QBASIC, and was eventually compiled with Quick BASIC. Because of the way the sound was produced (using the BASIC "play" command), I was able to control the music tempo, key, etc. using some fairly simple subroutines. My music program would play any one of several hundred hymns that I programmed into it, and each was user-selectable for any key or tempo within a certain range. So, if "Amazing Grace" were written in the key of C but a bass singer wanted it transposed to Eb, no problem. Want that song a little faster? Can do!

    I've never seen any "modern" music player match that. Can an mp3 player, for example, transpose the key for you?

    Like you, dbw, I question if this is even possible on the modern hardware and software. I know for a fact that Visual Basic (the logical upgrade for Quick BASIC), does NOT have music capability. That has frustrated me to no end. All it can do is a pitiful beep. But then, is Perl any better?

    Blessings,

    ~ Polyglot ~

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://637032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-11-24 00:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls