Text-To-Speech with Windows 10 IoT Core & UWP on Raspberry Pi Part 2

In my previous post, I've written about using Raspberry Pi running Windows 10 IoT Core for Text-To-Speech services for my smart home. As I've mentioned in that post, I have speakers in two floors wired to an amplifier, connected to a Raspberry Pi. The thing is that each of the speakers is wired to its own audio channel - ground floor speaker is wired to the left and 1st floor speaker is wired to the right channel. It may not be what you'd call a true stereo when listening to music, but it plays a big deal with speech running through the house. With such wiring, I can target the floor I want to convey the speech through, exclusively or with subtle mix, e.g. 100% volume to ground floor and only 10% to 1st floor (it's basically how audio balancing works). This basically lets me cover these use cases and more:

  • Want to call your children that are playing in their rooms upstairs, to lunch? Use 1st floor speaker.
  • Somebody at the door? Send the message to upstairs and ground floor speakers equally.
  • Late at night, kids are sleeping? Maybe use ground floor speakers at full and upstairs speakers at a minimum?
  • Etc...

Scenarios are limitless. And the MediaPlayer class from my previous example offers just what I needed to implement this - audio balance. You can simply set the balance prior to playing your audio, like this:

public async Task SayAsync(string text, double balance)
{
    speechPlayer.AudioBalance = balance;
    using (var stream = await speechSynthesizer.SynthesizeTextToStreamAsync(text))
    {
        speechPlayer.Source = MediaSource.CreateFromStream(stream, stream.ContentType);
    }
    speechPlayer.Play();
}
This code is from my previous blog post, with additional parameter for setting the AudioBalance property prior to playing the synthesized speech.

Playing speech remotely

Of course the real fun begins when you're able to control your audio player remotely, e.g. from an application or even web browser. To achieve this, I have put together a simple "web server" that runs as a background service on Windows 10 IoT Core. I've used the SimpleWebServer from IoTBlockly code sample as a base for my own implementation of a "poor man's Web API server", just trying to simulate controllers, etc. I won't go into that code as it's very hacky, absolutely not production ready, complete or even tested, but it appears to work OK for my current needs. Full source code I've used for this blog post is included in my sample project; I'm only listing the part that controls the speech here:

internal class SayController : Controller
{
    private readonly SpeechService _speechService;
    public SayController(SpeechService speechService)
    {
        _speechService = speechService;
    }
    public async Task<WebServerResponse> Get(string text, string floor)
    {
        if (string.IsNullOrEmpty(floor)) { await _speechService.SayAsync(text, 0) } else if (floor.ToLower() == "up")         {
            await _speechService.SayAsync(text, -1);
        }
        else
        {
            await _speechService.SayAsync(text, 1);
        }
        return WebServerResponse.CreateOk("OK");
    }
}
The code is pretty much self explaining - the first parameter contains the text that should be spoken and the second parameter is the name of the floor the text should be spoken on ("up" sets the audio balance to the left channel and "down" to the right).

With such server set up on Raspberry Pi (the sample is set to listening on port 8085), it's easy for me to make my home say the synthesized text on a specific floor by simply calling its URL:

http://<IP>:8085/say?text=Hello&floor=up

Sample source code for this post is available on GitHub.

Avtor: Anonymous, objavljeno na portalu SloDug.si (Arhiv)

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.

Jamesdob
Jamesdob - četrtek, 25. julij 2024

paxlovid covid: <a href=" http://paxloviddelivery.pro/# ">Paxlovid buy online</a> - paxlovid pill

Jamesdob
Jamesdob - četrtek, 25. julij 2024

paxlovid pharmacy: <a href=" http://paxloviddelivery.pro/# ">Paxlovid buy online</a> - Paxlovid buy online

Jamesdob
Jamesdob - sreda, 24. julij 2024

amoxicillin 500 mg where to buy: <a href=" http://amoxildelivery.pro/# ">amoxicillin 250 mg price in india</a> - amoxicillin 775 mg

Jamesdob
Jamesdob - sreda, 24. julij 2024

paxlovid price: <a href=" http://paxloviddelivery.pro/# ">paxlovid pill</a> - paxlovid price

CharlesInvar
CharlesInvar - sreda, 24. julij 2024

where to buy doxycycline 100mg: <a href=" http://doxycyclinedelivery.pro/# ">doxycycline pills for sale</a> - odering doxycycline http://amoxildelivery.pro/# generic amoxicillin cost

ThomasHew
ThomasHew - sreda, 24. julij 2024

https://clomiddelivery.pro/# where to buy generic clomid

MyronMus
MyronMus - sreda, 24. julij 2024

http://paxloviddelivery.pro/# paxlovid pill paxlovid covid <a href=http://paxloviddelivery.pro/#>paxlovid cost without insurance</a> buy paxlovid online

MyronMus
MyronMus - sreda, 24. julij 2024

https://ciprodelivery.pro/# buy cipro online can i order clomid pill <a href=https://clomiddelivery.pro/#>cost of clomid online</a> order clomid no prescription

ThomasHew
ThomasHew - sreda, 24. julij 2024

http://ciprodelivery.pro/# ciprofloxacin order online

CharlesInvar
CharlesInvar - sreda, 24. julij 2024

doxycycline over the counter south africa: <a href=" http://doxycyclinedelivery.pro/# ">doxycycline 225 mg</a> - generic doxycycline 200 mg https://clomiddelivery.pro/# can i purchase clomid without rx

Jamesdob
Jamesdob - sreda, 24. julij 2024

п»їcipro generic: <a href=" https://ciprodelivery.pro/# ">buy cipro online usa</a> - cipro ciprofloxacin

Jamesdob
Jamesdob - sreda, 24. julij 2024

buying clomid prices: <a href=" https://clomiddelivery.pro/# ">where can i buy clomid without insurance</a> - where can i buy clomid without rx

CharlesInvar
CharlesInvar - sreda, 24. julij 2024

buy ciprofloxacin: <a href=" http://ciprodelivery.pro/# ">ciprofloxacin 500 mg tablet price</a> - ciprofloxacin mail online https://clomiddelivery.pro/# how to get generic clomid without prescription

ThomasHew
ThomasHew - sreda, 24. julij 2024

http://clomiddelivery.pro/# can i buy generic clomid now

MyronMus
MyronMus - torek, 23. julij 2024

http://doxycyclinedelivery.pro/# where can i get doxycycline over the counter buy generic ciprofloxacin <a href=https://ciprodelivery.pro/#>buy cipro online</a> where can i buy cipro online

ThomasHew
ThomasHew - torek, 23. julij 2024

https://doxycyclinedelivery.pro/# cost doxycycline 100mg

CharlesInvar
CharlesInvar - torek, 23. julij 2024

buy cipro online canada: <a href=" https://ciprodelivery.pro/# ">buy cipro</a> - cipro https://clomiddelivery.pro/# order cheap clomid without dr prescription

MyronMus
MyronMus - torek, 23. julij 2024

https://doxycyclinedelivery.pro/# doxycycline best price can i get clomid price <a href=http://clomiddelivery.pro/#>where can i buy clomid prices</a> can i order cheap clomid no prescription

ThomasHew
ThomasHew - torek, 23. julij 2024

https://ciprodelivery.pro/# ciprofloxacin 500mg buy online

CharlesInvar
CharlesInvar - torek, 23. julij 2024

can i purchase generic clomid without prescription: <a href=" https://clomiddelivery.pro/# ">where buy cheap clomid without prescription</a> - can i get clomid price https://clomiddelivery.pro/# cost cheap clomid pills

Jamesdob
Jamesdob - torek, 23. julij 2024

paxlovid pill: <a href=" https://paxloviddelivery.pro/# ">paxlovid india</a> - paxlovid covid

ThomasHew
ThomasHew - torek, 23. julij 2024

http://clomiddelivery.pro/# get cheap clomid without insurance

Jamesdob
Jamesdob - torek, 23. julij 2024

п»їcipro generic: <a href=" https://ciprodelivery.pro/# ">buy ciprofloxacin</a> - cipro

MyronMus
MyronMus - torek, 23. julij 2024

http://paxloviddelivery.pro/# paxlovid india paxlovid price <a href=http://paxloviddelivery.pro/#>paxlovid generic</a> buy paxlovid online

CharlesInvar
CharlesInvar - torek, 23. julij 2024

order doxycycline 100mg: <a href=" https://doxycyclinedelivery.pro/# ">doxycycline 100mg capsules uk</a> - cost of doxycycline prescription 100mg https://amoxildelivery.pro/# amoxicillin over counter

MyronMus
MyronMus - torek, 23. julij 2024

https://clomiddelivery.pro/# can i get generic clomid without a prescription doxycycline 150 mg price <a href=http://doxycyclinedelivery.pro/#>buy doxycycline pills online</a> doxycycline 100mg tablet price

ThomasHew
ThomasHew - torek, 23. julij 2024

https://doxycyclinedelivery.pro/# doxycycline 40 mg cost

CharlesInvar
CharlesInvar - torek, 23. julij 2024

can i order cheap clomid no prescription: <a href=" https://clomiddelivery.pro/# ">cost generic clomid no prescription</a> - how to buy cheap clomid tablets https://doxycyclinedelivery.pro/# price doxycycline

ThomasHew
ThomasHew - torek, 23. julij 2024

http://doxycyclinedelivery.pro/# doxycycline price

MyronMus
MyronMus - torek, 23. julij 2024

http://amoxildelivery.pro/# amoxicillin 875 mg tablet doxycycline 100mg for sale <a href=https://doxycyclinedelivery.pro/#>doxycycline 1000mg best buy</a> can you buy doxycycline over the counter australia

ThomasHew
ThomasHew - torek, 23. julij 2024

http://amoxildelivery.pro/# amoxicillin from canada

Jamesdob
Jamesdob - torek, 23. julij 2024

doxycycline tablets in india: <a href=" https://doxycyclinedelivery.pro/# ">doxycycline mono</a> - doxycycline 100mg price 1mg

CharlesInvar
CharlesInvar - torek, 23. julij 2024

п»їpaxlovid: <a href=" https://paxloviddelivery.pro/# ">paxlovid covid</a> - paxlovid generic http://ciprodelivery.pro/# buy cipro online canada

MyronMus
MyronMus - torek, 23. julij 2024

https://amoxildelivery.pro/# buy amoxicillin without prescription buying amoxicillin in mexico <a href=https://amoxildelivery.pro/#>buy amoxicillin 500mg uk</a> amoxicillin 500mg no prescription

Jamesdob
Jamesdob - torek, 23. julij 2024

doxycycline buy online us: <a href=" http://doxycyclinedelivery.pro/# ">20 doxycycline</a> - doxycycline prices australia

ThomasHew
ThomasHew - ponedeljek, 22. julij 2024

http://clomiddelivery.pro/# order generic clomid

CharlesInvar
CharlesInvar - ponedeljek, 22. julij 2024

п»їpaxlovid: <a href=" https://paxloviddelivery.pro/# ">paxlovid india</a> - Paxlovid over the counter https://ciprodelivery.pro/# ciprofloxacin 500mg buy online

ThomasHew
ThomasHew - ponedeljek, 22. julij 2024

http://clomiddelivery.pro/# order cheap clomid without dr prescription

MyronMus
MyronMus - ponedeljek, 22. julij 2024

https://clomiddelivery.pro/# how can i get clomid price prescription for amoxicillin <a href=http://amoxildelivery.pro/#>generic amoxicillin cost</a> amoxicillin capsules 250mg

CharlesInvar
CharlesInvar - ponedeljek, 22. julij 2024

ciprofloxacin 500mg buy online: <a href=" http://ciprodelivery.pro/# ">buy cipro online without prescription</a> - buy cipro online https://clomiddelivery.pro/# order cheap clomid without dr prescription

Jamesdob
Jamesdob - ponedeljek, 22. julij 2024

buy ciprofloxacin over the counter: <a href=" https://ciprodelivery.pro/# ">cipro for sale</a> - buy cipro no rx

MichaelBek
MichaelBek - ponedeljek, 22. julij 2024

paxlovid india: <a href=" https://paxloviddelivery.pro/# ">paxlovid india</a> - paxlovid covid http://paxloviddelivery.pro/# Paxlovid buy online cheap doxycycline <a href=http://doxycyclinedelivery.pro/#>doxycycline capsules for sale</a> buy doxycycline canada

ThomasHew
ThomasHew - ponedeljek, 22. julij 2024

https://ciprodelivery.pro/# purchase cipro

MichaelBek
MichaelBek - ponedeljek, 22. julij 2024

cost generic clomid now: <a href=" https://clomiddelivery.pro/# ">can i get generic clomid without insurance</a> - order cheap clomid without rx https://ciprodelivery.pro/# ciprofloxacin 500mg buy online doxycycline 100mg no prescription fast delivery <a href=http://doxycyclinedelivery.pro/#>buy doxycycline 40 mg</a> cost of doxycycline canada

MyronMus
MyronMus - ponedeljek, 22. julij 2024

https://paxloviddelivery.pro/# п»їpaxlovid doxycycline 20 mg cost <a href=https://doxycyclinedelivery.pro/#>doxycycline 100mg buy online</a> doxycycline hyclate 100 mg capsules

ThomasHew
ThomasHew - ponedeljek, 22. julij 2024

https://doxycyclinedelivery.pro/# buy doxycycline cheap

MyronMus
MyronMus - ponedeljek, 22. julij 2024

https://ciprodelivery.pro/# ciprofloxacin generic doxycycline 100 mg cap over the counter <a href=https://doxycyclinedelivery.pro/#>buy doxycycline online no prescription</a> doxycycline 100 capsules

CharlesInvar
CharlesInvar - ponedeljek, 22. julij 2024

where can i buy amoxicillin online: <a href=" http://amoxildelivery.pro/# ">where to buy amoxicillin over the counter</a> - medicine amoxicillin 500mg http://ciprodelivery.pro/# buy generic ciprofloxacin

CharlesInvar
CharlesInvar - ponedeljek, 22. julij 2024

amoxicillin generic: <a href=" https://amoxildelivery.pro/# ">amoxicillin 500 mg without a prescription</a> - amoxicillin 825 mg http://amoxildelivery.pro/# amoxicillin pharmacy price

ThomasHew
ThomasHew - ponedeljek, 22. julij 2024

https://clomiddelivery.pro/# where to buy generic clomid tablets

Jamesdob
Jamesdob - ponedeljek, 22. julij 2024

amoxicillin 500mg cost: <a href=" http://amoxildelivery.pro/# ">amoxicillin 500 mg price</a> - order amoxicillin online

ThomasHew
ThomasHew - nedelja, 21. julij 2024

https://amoxildelivery.pro/# buy amoxicillin 500mg online

Jamesdob
Jamesdob - nedelja, 21. julij 2024

cost generic clomid: <a href=" https://clomiddelivery.pro/# ">order cheap clomid without a prescription</a> - can you get clomid tablets

MyronMus
MyronMus - nedelja, 21. julij 2024

https://clomiddelivery.pro/# buy clomid without rx doxycycline india <a href=https://doxycyclinedelivery.pro/#>buy doxycycline 100mg capsules</a> doxycycline 3626

MyronMus
MyronMus - nedelja, 21. julij 2024

https://amoxildelivery.pro/# purchase amoxicillin online without prescription buy generic ciprofloxacin <a href=https://ciprodelivery.pro/#>ciprofloxacin 500mg buy online</a> cipro for sale

CharlesInvar
CharlesInvar - nedelja, 21. julij 2024

amoxicillin 500 mg capsule: <a href=" https://amoxildelivery.pro/# ">can you buy amoxicillin uk</a> - where can you get amoxicillin https://doxycyclinedelivery.pro/# average price of doxycycline

ThomasHew
ThomasHew - nedelja, 21. julij 2024

https://paxloviddelivery.pro/# paxlovid pill

CharlesInvar
CharlesInvar - nedelja, 21. julij 2024

amoxicillin 500 mg tablet: <a href=" http://amoxildelivery.pro/# ">purchase amoxicillin online without prescription</a> - amoxicillin buy online canada https://amoxildelivery.pro/# can i buy amoxicillin over the counter in australia

MichaelBek
MichaelBek - nedelja, 21. julij 2024

buying cheap clomid without insurance: <a href=" https://clomiddelivery.pro/# ">where can i get cheap clomid without insurance</a> - where to buy generic clomid http://ciprodelivery.pro/# cipro for sale paxlovid generic <a href=https://paxloviddelivery.pro/#>paxlovid covid</a> paxlovid price

DavidCrorp
DavidCrorp - nedelja, 21. julij 2024

top 10 pharmacies in india: <a href=" https://indiapharmast.com/# ">cheapest online pharmacy india</a> - world pharmacy india

Michaeltep
Michaeltep - nedelja, 21. julij 2024

indian pharmacies safe: <a href=" http://indiapharmast.com/# ">top 10 online pharmacy in india</a> - Online medicine home delivery

EdwardVeW
EdwardVeW - nedelja, 21. julij 2024

https://indiapharmast.com/# india pharmacy mail order

EdwardVeW
EdwardVeW - nedelja, 21. julij 2024

http://canadapharmast.com/# canadian pharmacy ltd

MerlinRagma
MerlinRagma - nedelja, 21. julij 2024

certified canadian pharmacy: <a href=" http://canadapharmast.com/# ">canadian pharmacy world</a> - canada pharmacy reviews http://canadapharmast.com/# canada pharmacy reviews mexico drug stores pharmacies <a href=https://foruspharma.com/#>п»їbest mexican online pharmacies</a> medicine in mexico pharmacies

Michaeltep
Michaeltep - nedelja, 21. julij 2024

Online medicine home delivery: <a href=" https://indiapharmast.com/# ">reputable indian online pharmacy</a> - best india pharmacy

Charleskic
Charleskic - nedelja, 21. julij 2024

top online pharmacy india <a href=https://indiapharmast.com/#>п»їlegitimate online pharmacies india</a> pharmacy website india

DavidCrorp
DavidCrorp - nedelja, 21. julij 2024

buy prescription drugs from india: <a href=" https://indiapharmast.com/# ">india pharmacy mail order</a> - cheapest online pharmacy india

DavidCrorp
DavidCrorp - sobota, 20. julij 2024

medicine in mexico pharmacies: <a href=" http://foruspharma.com/# ">mexico drug stores pharmacies</a> - buying prescription drugs in mexico

Michaeltep
Michaeltep - sobota, 20. julij 2024

buying prescription drugs in mexico: <a href=" https://foruspharma.com/# ">buying prescription drugs in mexico online</a> - buying prescription drugs in mexico online

EdwardVeW
EdwardVeW - sobota, 20. julij 2024

http://foruspharma.com/# mexico drug stores pharmacies

EdwardVeW
EdwardVeW - sobota, 20. julij 2024

http://canadapharmast.com/# safe canadian pharmacy

Charleskic
Charleskic - sobota, 20. julij 2024

reputable mexican pharmacies online <a href=http://foruspharma.com/#>mexico pharmacies prescription drugs</a> buying prescription drugs in mexico online

DavidCrorp
DavidCrorp - sobota, 20. julij 2024

mexican mail order pharmacies: <a href=" https://foruspharma.com/# ">reputable mexican pharmacies online</a> - mexican border pharmacies shipping to usa

Michaeltep
Michaeltep - sobota, 20. julij 2024

online pharmacy india: <a href=" http://indiapharmast.com/# ">mail order pharmacy india</a> - top online pharmacy india

Charleskic
Charleskic - sobota, 20. julij 2024

india online pharmacy <a href=https://indiapharmast.com/#>pharmacy website india</a> Online medicine order

Michaeltep
Michaeltep - sobota, 20. julij 2024

cheapest online pharmacy india: <a href=" http://indiapharmast.com/# ">cheapest online pharmacy india</a> - reputable indian online pharmacy

DavidCrorp
DavidCrorp - sobota, 20. julij 2024

indianpharmacy com: <a href=" https://indiapharmast.com/# ">п»їlegitimate online pharmacies india</a> - world pharmacy india

Charleskic
Charleskic - sobota, 20. julij 2024

mexico drug stores pharmacies <a href=http://foruspharma.com/#>mexico pharmacy</a> mexican online pharmacies prescription drugs

DavidCrorp
DavidCrorp - sobota, 20. julij 2024

canada drugs online reviews: <a href=" https://canadapharmast.com/# ">pharmacy canadian</a> - pharmacy in canada

MerlinRagma
MerlinRagma - sobota, 20. julij 2024

mexico drug stores pharmacies: <a href=" https://foruspharma.com/# ">mexican online pharmacies prescription drugs</a> - mexico drug stores pharmacies https://canadapharmast.com/# canadian pharmacy buy medicines online in india <a href=http://indiapharmast.com/#>world pharmacy india</a> reputable indian online pharmacy

EdwardVeW
EdwardVeW - sobota, 20. julij 2024

http://canadapharmast.com/# best canadian online pharmacy

EdwardVeW
EdwardVeW - sobota, 20. julij 2024

https://indiapharmast.com/# indian pharmacy online

Michaeltep
Michaeltep - sobota, 20. julij 2024

mexican drugstore online: <a href=" http://foruspharma.com/# ">mexico drug stores pharmacies</a> - pharmacies in mexico that ship to usa

Charleskic
Charleskic - sobota, 20. julij 2024

cheapest online pharmacy india <a href=http://indiapharmast.com/#>world pharmacy india</a> Online medicine order

DavidCrorp
DavidCrorp - sobota, 20. julij 2024

top 10 pharmacies in india: <a href=" http://indiapharmast.com/# ">cheapest online pharmacy india</a> - Online medicine order

Michaeltep
Michaeltep - sobota, 20. julij 2024

mexico pharmacy: <a href=" http://foruspharma.com/# ">п»їbest mexican online pharmacies</a> - buying from online mexican pharmacy

Charleskic
Charleskic - sobota, 20. julij 2024

buying prescription drugs in mexico <a href=https://foruspharma.com/#>mexico drug stores pharmacies</a> best online pharmacies in mexico

HenrySeami
HenrySeami - četrtek, 11. julij 2024

purple pharmacy mexico price list: <a href=" https://cmqpharma.com/# ">mexican pharmacy</a> - buying prescription drugs in mexico