This is in reference to the vibrator in the Neo FreeRunner, however it is likely identical to the Neo 1973, as best I can tell.
The vibrator is controlled through:
When off, it will read 0. Valid ranges appear to be 0-255, with 255 being the fastest.
Vibrate only on Ring
The general means of configuring the ringtone is done in the file /etc/pulse/session:
load-sample ringtone /usr/share/openmoko/sounds/ringtone_class.wav
Without that file, the phone will be silent, but still continue to vibrate on ring. A convenient way is to gzip the ringtone file:
The pulseaudio daemon (or the phone) will need to be restarted:
Python Script For Playing Beats
Reads beats from a file and plays them on the openmoko vibrator.
File format is human readable text, consisting of a simple sequence of integer pairs. The first number in the pair representing the intensity of the vibration from 0 to 255. The second number represents the duration in milliseconds to hold that intensity. Any non digit characters in the file count as a separators between numbers, but are otherwise ignored.
It requires packages python-core and python-re from opkg.
#!/usr/bin/python """Vibrator Beat Player Usage: python beatplay.py [filename] """ import sys import time import re def loadFromTextFile(filename): infile = open(filename) contents = infile.read() return re.findall("(\d+)\D*(\d+)", contents) def playNote(frequency, duration): outfile.write(str(frequency) + "\n") time.sleep(float(duration) / 1000.0) def playNotes(notes): for frequency, duration in notes: #print frequency + ", " + duration playNote(frequency, duration) def playFile(filename): global outfile notes = loadFromTextFile(filename) outfile = open("/sys/class/leds/neo1973:vibrator/brightness", "w", 1) playNotes(notes) playNote(0, 0) outfile.close() if __name__ == "__main__": playFile(sys.argv)
The following is an example "song" file that can be used to test the beat player.
125 400 0 200 250 600 0 400 125 400 0 200 250 600 0 400 125 400 0 200 250 600 0 400 125 400 0 200 250 600 0 400