Results 1 to 2 of 2

Thread: Not exactly a productivity tool, but...

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Brno - Czech Republic
    Blog Entries
    Rep Power

    Not exactly a productivity tool, but...

    ... did you ever wondered, how productive you would be in writing anything, if every touch to the keyboard would cause different sound?


    Well, that indicates you are... sane But just in case, try this script:
    Uses "WinMM", "UI"
    Begin Const
      %MIDI_ChangeInstrument = 192
      %MIDI_NoteOn           = 144
      %MIDI_NoteOff          = 128
    End Const
    Function TBMain() 
      Long   hmidiOut
      Long   instrument, duration, note, i
      Single velocity
      velocity = 50
      note     = 50
      duration = 4 
      Long Device = 0
      Long tNow, tLast
      MidiOut_Close hmidiOut
      If MidiOut_Open hmidiOut, 0, Device, 0, 0 <> 0 Then
        MsgBox 0, "Unable to open MidiOut port!" 
        Exit Function
      End If
      tLast = GetTickCount
        tNow = GetTickCount
        For i = 1 To 255                                                                              
          If GetAsyncKeyState(i) Then           
            velocity = Rnd(0,127)
            note = Rnd(0,127) 
            instrument = Rnd(0,127)        
            MidiOut_ShortMsg hmidiOut, Rgb(%MIDI_ChangeInstrument, instrument, 127)
            MidiOut_ShortMsg hmidiOut, Rgb(%MIDI_NoteOn, 12 + note, velocity)   
            Sleep duration
            MidiOut_ShortMsg hmidiOut, Rgb(%MIDI_NoteOff, 12 + note, 127)            
            tLast = GetTickCount
          End If
        If GetAsyncKeyState(%VK_ESCAPE) Then
          Exit Do
        End If  
      MidiOut_Close hmidiout
    End Function
    Once the headache comes, simply press ESC anytime, and the keyboard will stop doing those... noises.

    Have a nice weekend!,

    P.S. Tip: Do not run this script from thinAir, but launch it by clicking. This will allow smooth thinAir "experience"
    Last edited by Petr Schreiber; 17-10-2014 at 20:46.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    Join Date
    Nov 2012
    Missouri, USA
    Rep Power

    It sure is a neat program. Plus, what I've noticed
    that's different from others that even come close is
    that the sound is different each time you press the
    same key.

    Great little program.


Similar Threads

  1. TBGL-DisplayList-Tinker-Tool
    By ReneMiner in forum TBGL Scripts and Projects
    Replies: 12
    Last Post: 20-11-2012, 18:58
  2. qt: idea for general tb user tool
    By Lionheart008 in forum Shout Box Area
    Replies: 21
    Last Post: 29-03-2010, 22:14
  3. RegExp tool
    By marcel in forum VBRegExp
    Replies: 1
    Last Post: 11-03-2008, 11:21
  4. cool landscape tool
    By kryton9 in forum 3rd party tools
    Replies: 17
    Last Post: 29-07-2007, 16:58
  5. [TOOL] TypeLib Browser
    By Josť Roca in forum Power Basic
    Replies: 2
    Last Post: 16-07-2007, 06:18

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts