Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 30 Sep 2016, 16:26
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Thomas Virtual Piano
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
TecnoGuy458


Joined: 26 Jan 2015
Posts: 121
Location: Ohio

PostPosted: Sat 21 Nov 2015, 16:56    Post subject:  Thomas Virtual Piano
Subject description: Virtual PC speaker Piano
 

GitHub: https://github.com/ThomasTheSpaceFox/Thomas-Virtual-Piano

.PET attached below.

uses Bash, gtkdialog and beep, to allow the user to play a small virtual piano through their PC speaker.

piano specs: 4 piece percussion. keys 21-40.
ThomasVirtualPiano-v1.3.pet
Description 
pet

 Download 
Filename  ThomasVirtualPiano-v1.3.pet 
Filesize  21.69 KB 
Downloaded  70 Time(s) 
Back to top
View user's profile Send private message 
TecnoGuy458


Joined: 26 Jan 2015
Posts: 121
Location: Ohio

PostPosted: Sat 21 Nov 2015, 16:59    Post subject: Thomas Virtual Piano  

screenshot:
piano-capture29690.png
Description 
png

 Download 
Filename  piano-capture29690.png 
Filesize  12 KB 
Downloaded  163 Time(s) 
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6309
Location: Valåmoen, Norway

PostPosted: Tue 24 Nov 2015, 00:40    Post subject:  

Like it - even if beep don't give sound on my system Very Happy

If you would like to consider it, I have rearranged your code. Just to give an example of another coding structure. Thomas-Virtual-Piano.sh has gone from 224 to 68 codelines, and the gui is more compact. - Narrower, but with the same key-size.

Code:
#!/bin/bash
WHEREAMI="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd && echo)"
cd $WHEREAMI

build_key (){
   SOUND=$(cut -d_ -f1 <<< "$1")
   COLOR=$(cut -d_ -f2 <<< "$1")
   echo '<vbox>
     <pixmap><input file>'$2'.png</input></pixmap>
      <button relief="2">
        <action>"beep -f '$SOUND'"</action>
        <input file>"key'$COLOR'.png"</input>
      </button>
   </vbox>'
}
export -f build_key

export DIALOG='
<window resizable="false" title="Thomas Virtual Piano" image-name="Thomas-Virtual-Piano.png">
  <vbox>
    <hbox>
      <pixmap>
        <input file>speaker.png</input>
      </pixmap>
      <button ok></button>
      <button>
        <label>"About"</label>
        <action>"'$WHEREAMI'/about.sh"</action>
      </button>
      <hbox scrollable="true" width-request="10" height="30" >
        <pixmap>
          <input file>bar.png</input>
        </pixmap>
      </hbox>
      <button>
        <action>"beep -f 300 -l 40 -n -f 400 -l 5 -n -f 250 -l 15 -n -f 100 -l 10"</action>
        <input file>"cymbal.png"</input>
      </button>
      <button>
        <action>"beep -f 300 -l 40 -n -f 400 -l 5 -n -f 300 -l 10"</action>
        <input file>"hithat.png"</input>
      </button>
      <button>
        <action>"beep -f 60 -l 40"</action>
        <input file>"bdrum.png"</input>
      </button>
      <button>
        <action>"beep -f 100 -l 40"</action>
        <input file>"ldrum.png"</input>
      </button>
      <text>
        <label>"Thomas Virtual Piano"</label>
      </text>
      <pixmap>
        <input file>speaker.png</input>
      </pixmap>
    </hbox>
    <hbox spacing="0">'
    NR=21
    for KEY in 87_w 92_b 98_w 104_b 110_w 116_b 123_w 131_w 138_b 147_w 155_b 165_w 175_w 185_b 196_w 208_b 220_w 233_b 247_w 262_w; do
      export DIALOG="$DIALOG $(build_key $KEY $NR)"
      NR=$(($NR+1))
    done
   export DIALOG="$DIALOG </hbox>
  </vbox>
</window>"

gtkdialog --space-expand=true --space-fill=true --program DIALOG

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
TecnoGuy458


Joined: 26 Jan 2015
Posts: 121
Location: Ohio

PostPosted: Tue 24 Nov 2015, 22:11    Post subject: ill look into it later.  

looks nice! Very Happy i will try it later. currently busy extending my Terminal Image System's color pallet. Cool

btw on a side note,

that $WHEREAMI thing is a neat trick isn't it? Very Happy
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1703
Location: USA

PostPosted: Wed 25 Nov 2015, 00:18    Post subject:  

Ever considered the chromatic keyboard?
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6731
Location: Earth

PostPosted: Wed 25 Nov 2015, 02:43    Post subject:  

This would be a nice musical app for a touch-screen PC. Would be nice if it came with distro's Menu>Games folder, as, say "20key Piano" I will try it, later.

Question
As it currently is 20keys, is the number of keys selectable; say, 44keys or 88keys for large touch screens?

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 4380
Location: Ontario

PostPosted: Thu 26 Nov 2015, 20:45    Post subject:  

There are other ways to generate a beep noise like the command speaker-test
Code:
speaker-test -c2 -t sine

Quote:


You might look at speaker-test, which (on an Arch machine) I find in alsa-utils package.

speaker-test -c2 -t sine run from an xterm, gave me a 440 Hz sine wave for about 6 seconds each, alternating left and right speakers. In the xterm, it gave some information about which speaker it thought it was using.

According to the man page, it can do sine waves of arbitrary frequency and pink noise.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0825s ][ Queries: 12 (0.0045s) ][ GZIP on ]