Documentation
Play Methods
There are many play methods for the line to help you say what you want.
PlayCharacters
Speaks out the digits in the string.
await line.PlayCharactersAsync("abc", cancellationToken);
PlayDate
Plays a DateTime object given based on the mask parameter.
Mask parts can be separated by the following characters: ":", " ", or "-".
Mask Parts | Description |
---|---|
"m" "mm", or "mmm" | Speaks the month. Example: December |
"d" or "dd" | Speaks the day of the month. Example: 3rd |
"ddd" or "dddd" | Speaks the day of the week. Example: Saturday |
"yyy" or "yyyy" | Speaks the year. Speak years 2010 to 2099 with the word "thousand". |
"h" or "hh" | Speaks the hours. If your mask contains "a/p", it is 12-hour time; otherwise, it is 24-hour time. |
"n" or "nn" | Speaks the minutes. |
"a/p" | Speaks either "am" or "pm". |
await line.PlayDateAsync(myDateTime,"m-d-yyy h:m a/p", cancellationToken);
PlayFile
Plays a wav file which must be in the format of 8000hz 1 channel unsigned 8 bit PCM.
await line.PlayFileAsync("myFile.Wav", cancellationToken);
PlayFileOrPhrase
Plays a file or phrase based on the provided string. If the string contains "|" then it is considered a phrase and will call PlayStringAsync otherwise it is a file and it will call PlayFileAsync.
await line.PlayFileorPhraseAsync(someString, cancellationToken);
PlayInteger
Speaks out an integer. For example 523 would be spoken as 'five hundred and twenty three'
await line.PlayIntegerAsync(523, cancellationToken);
PlayMoney
Speaks a number in money format. For example 5.23 would be spoken as 'five dollars and twenty three cents'
await line.PlayMoneyAsync(5.23, cancellationToken);
PlayNumber
Speaks out a number. For example 5.23 would be spoken as 'five point two three'
await line.PlayNumberAsync(5.23, cancellationToken);
PlayOrdinal
Plays a number from 1 to 31. Example 31 would speak 'thirty first'.
await line.PlayOrdinalAsync(31, cancellationToken);
PlayPhoneNumber
Plays a phone number as long as it is 7, 10 or 11 characters long.
// example "3334444" or "2223334444" or "12223334444"
await line.PlayPhoneNumberAsync(myPhoneNumber, cancellationToken);
PlayString
Plays a collection of one or more string parts which are separated with a comma. Each string part is in the format of 'data|code'. You would string them together like: 'data|code,data|code,data|code' etc.
Codes | Data |
---|---|
C | Characters that will be played with the PlayCharater method |
D | Expects the data to be a date in month/day/year format. Can be a date, time or both date and time. Uses DateTime.Parse(data, new CultureInfo("en-US")); |
F | A file name |
M | A string that can convert to a double value and spoken with the PlayMoney method |
N | A string that can convert to a double value and spoken with the PlayNumber method |
O | A string number between 1 and 31 that will be spoken with the PlayOrdinal method |
var myString = "C|abc,M|5.23,O|31";
await line.PlayStringAsync(myString, cancellationToken);