I thought it could be fun to make the clock able to speak the current time by using the say-command available from the command line in OS X:
NAME
say - Convert text to audible speech
SYNOPSIS
say [-v voice] [-r rate] [-o outfile [audio format options] | -n name:port | -a device] [-f file | string ...]
DESCRIPTION
This tool uses the Speech Synthesis manager to convert input text to
audible speech and either play it through the sound output device
chosen in System Preferences or save it to an AIFF filI made a shell script to produce audio files with spoken numbers from 0 to 59 and converted them to AD4.
Using this small routine, the clock speaks the current time when the play/pause-button on the Apple remote is pressed:
/*
* Speak current HH and MM using voice files from 0 to 59 starting at position 400
*/
void say_clock()
{
// hours
wtv020_cmd(400 + lcl_time->tm_hour);
_delay_ms(1000);
// extend delay for long hour numbers
if (lcl_time->tm_hour > 20)
_delay_ms(500);
// leading zero when single digit minutes
if (lcl_time->tm_min < 10)
{
wtv020_cmd(400);
_delay_ms(600);
}
// minutes
wtv020_cmd(400 + lcl_time->tm_min);
_delay_ms(1500);
// silence
wtv020_cmd(0xffff);
}
Tobias Rathje
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.