-
Notifications
You must be signed in to change notification settings - Fork 53
Sounder
HASUMI Hitoshi edited this page Aug 29, 2022
·
8 revisions
Feature | Version |
---|---|
Sounder | 0.9.18+ |
PRK can not only make a beep sound but also a music.
As of 0.9.18, Piezoelectric sounder is supported by Sound
class.
require 'sounder'
sounder = Sounder.new(2) # A pin number that connecs to the sounder
sounder.play "c d e f g a b < c"
This plays "Do Re Mi Fa So La Ti Do"
It creates a new song but doesn't play it. This method accepts variable-length arguments of String.
sounder.create_song "c e g f", "e f d c"
It plays the last created song.
sounder.replay
A wrapper method for Sounder#create_song
and Sounder#replay
.
As in, it accepts variable-length arguments of String.
sounder.play "c e g f", "e f d c"
The list of preset songs:
Name |
---|
beepo |
pobeep |
beepbeep |
oneup |
sounder.play Sounder::SONGS[:beepo]
sounder = Sounder.new(2)
sounder.play "T200 L8 O5 e16. r32 e r e r c e r g r4. > g"
sounder = Sounder.new(2)
kbd.before_report do
if kbd.key_reporting?
sounder.play Sounder::SONGS[:beepo]
else
sounder.playing = false
end
end
See Music Macro Language.
- Getting started
- Keyboard features
- Keycodes (ja)
- Mouse (ja)
- Layers and mode key (ja)
- Debounce
- Composite key
- Split-type keyboard
- Keyscan matrix
- Num Lock, Caps Lock and Scroll Lock
- Useful methods that make you free
- BIOS mode
- Other features
- Examples
- Development
- Contribute to the Wiki
- FAQ