class Ev3dev::Sound
Constants
- PATH
Public Class Methods
new()
click to toggle source
Calls superclass method
Ev3dev::Device::new
# File lib/ev3dev/sound.rb, line 5 def initialize Dir.glob("#{PATH}/*").each do |path| if File.exist?("#{path}/tone") super path return end end raise "couldn't find sound attributes" end
Public Instance Methods
aplay(*args)
click to toggle source
# File lib/ev3dev/sound.rb, line 31 def aplay(*args) `aplay #{args.first}` end
beep(*args)
click to toggle source
# File lib/ev3dev/sound.rb, line 27 def beep(*args) `beep #{args.first}` end
espeak(arg)
click to toggle source
# File lib/ev3dev/sound.rb, line 35 def espeak(arg) `espeak #{arg} --stdout | aplay` end
mpg123(*args)
click to toggle source
# File lib/ev3dev/sound.rb, line 39 def mpg123(*args) `mpg123 #{args.first}` end
tone(*args)
click to toggle source
# File lib/ev3dev/sound.rb, line 15 def tone(*args) raise "couldn't find sound attributes" if @device_path.nil? param = File.join @device_path, "tone" raise "no such attribute: #{param}" unless File.exist? param if args.first.nil? IO.read(param).strip else IO.write param, args.join(" ") self end end