frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

01-HarmonyOS5-CoreSpeechKit-Case

1•zhousg•3h ago
import { textToSpeech } from '@kit.CoreSpeechKit' import { promptAction } from '@kit.ArkUI'

@Entry @ComponentV2 struct CoreSpeechKit { text: string = ` In March at 45 degrees north latitude, time ties a gentle knot here. The morning mist by the Songhua River wraps fine snow, carving each branch into transparent glass. Ice crystals stack on the branches to form magnolias with a thousand petals. What rustles down when the wind passes through the branches is not snowflakes, but clearly the fragments of stars falling into the world. At this time, the apricot blossoms in Jiangnan are brewing honey against the warm wind. The pink clouds of flower shadows spread over the white walls and black tiles, and even the air is permeated with a slightly intoxicating sweetness. The colorist of the seasons quietly divides the palette in half - the north is still persistently continuing the end of winter, using icicles as a pen to outline frost flowers on the window panes; the south is already eager to open the first page of spring, letting the swallows fly over the ink - painted alleys with the willow color. This temperature difference of three thousand miles weaves two silk brocades at both ends of the twilight line: the north is a plain brocade embroidered with silver threads, wrapped with unspoken whispers in the cold; the south is a soft silk dyed by silk - reeling women, rippling with the newborn whispers in the warmth. When the rime in Harbin melts the first drop of brilliance in the morning sun, the magnolias in Hangzhou just shake off the third piece of moonlight on their shoulders. It turns out that spring is stepping on the latitude and longitude lines, composing the most moving polyphony between the harshness and the warmth in the world. ` ttsEngine?: textToSpeech.TextToSpeechEngine

  @Local isPlaying: boolean = false

  async initTextToSpeechEngine() {
    if (canIUse('SystemCapability.AI.TextToSpeech')) {
      const params: textToSpeech.CreateEngineParams = {
        language: 'zh-CN',
        person: 0,
        online: 1
      }
      this.ttsEngine = await textToSpeech.createEngine(params)
    }
  }

  aboutToAppear(): void {
    this.initTextToSpeechEngine()
  }

  aboutToDisappear(): void {
    if (canIUse('SystemCapability.AI.TextToSpeech')) {
      this.ttsEngine?.stop()
      this.ttsEngine?.shutdown()
    }
  }

  play() {
    if (canIUse('SystemCapability.AI.TextToSpeech')) {
      if (this.ttsEngine?.isBusy()) {
        return promptAction.showToast({ message: 'Playing...' })
      }
      const params: textToSpeech.SpeakParams = {
        requestId: '10000'
      }
      this.ttsEngine?.speak(this.text, params)
      this.isPlaying = true
    }
  }

  build() {
    Stack({ alignContent: Alignment.BottomEnd }) {
      List() {
        ListItem() {
          Text(this.text)
            .lineHeight(32)
        }
      }
      .padding({ left: 15, right: 15 })
      .height('100%')
      .width('100%')

      Row() {
        Image(this.isPlaying ? $r('sys.media.AI_playing') : $r('sys.media.AI_play'))
          .width(24)
          .onClick(() => this.play())
      }
      .borderRadius(24)
      .shadow({
        color: Color.Gray,
        offsetX: 5,
        offsetY: 5,
        radius: 15
      })
      .width(48)
      .aspectRatio(1)
      .justifyContent(FlexAlign.Center)
      .margin({ right: 50, bottom: 50 })
    }
    .height('100%')
    .width('100%')
  }
}

Comments

dngray•2h ago
More spam? https://news.ycombinator.com/item?id=44001768

Learning German: A Two-Way Street for International Professionals and Companies

https://germancareer.substack.com/p/learning-german-a-two-way-street
1•rustoo•2m ago•0 comments

Show HN: Visualize nested list properties in the CodeLLDB debugger

https://github.com/ahrm/codelldb-visualizers
1•hexomancer•6m ago•0 comments

Self-Powered Artificial Synapse Mimics Human Color Vision

https://www.tus.ac.jp/en/mediarelations/archive/20250528_9424.html
1•rustoo•8m ago•0 comments

Code development platform for open source projects by the EU

https://code.europa.eu/info/about/-/blob/master/README.md
1•doener•8m ago•0 comments

Djgpp

https://www.delorie.com/djgpp/
1•BruceEel•12m ago•0 comments

I Program with Agents

https://sketch.dev/blog/programming-with-agents
1•weinzierl•13m ago•0 comments

Nvidia VA-API Driver 0.0.14 Improves Compatibility and Fixes Various Issues

https://www.phoronix.com/news/NVIDIA-VAAPI-Driver-0.0.14
1•doener•13m ago•0 comments

EU OS for the Public Sector

https://eu-os.eu/
2•doener•14m ago•0 comments

Life and Insecurities

https://www.jerry.wtf/posts/life-and-insecurities/
1•personjerry•15m ago•0 comments

In praise of Japanese small, Hokkaido as Wisconsin, and pachinko memories

https://walkingtheworld.substack.com/p/in-praise-of-japanese-small-hokkaido
1•Michelangelo11•17m ago•0 comments

Tim Bray's AI Angst

https://www.tbray.org/ongoing/When/202x/2025/06/06/My-AI-Angst
2•AndrewDucker•17m ago•0 comments

Show HN: SDFY: Fast Vector Shapes and Shadows with Signed Distance Functions

https://github.com/elcritch/sdfy
1•elcritch•23m ago•0 comments

We came to be ruled by Death Eaters (2014)

https://georgiebc.wordpress.com/2014/12/05/how-we-came-to-be-ruled-by-death-eaters/
2•rendx•25m ago•0 comments

Congress Passes Socialized Medicine and Mandates Health Insurance -In 1798

https://www.forbes.com/sites/rickungar/2011/01/17/congress-passes-socialized-medicine-and-mandates-health-insurance-in-1798/
2•Bluestein•25m ago•0 comments

AI plundering scripts poses 'direct threat' to UK screen sector, says BFI

https://www.theguardian.com/technology/2025/jun/09/ai-plundering-scripts-poses-direct-threat-to-uk-screen-sector-says-bfi
1•chrisjj•27m ago•0 comments

How YouTube Golf Is Driving Acushnet's Sales

https://jackdry.com/search-interest-indicates-8-q2-sales-growth-for-acushnet
2•jdry1729•34m ago•0 comments

What DOGE and its affiliates are doing with government systems and data [pdf]

https://oversight.house.gov/wp-content/uploads/2025/06/Schneier-Written-Testimony.pdf
3•ripe•34m ago•0 comments

Show HN: A feature-rich, efficient and flexible image compression application

https://github.com/AkiraBit/PicSharp
2•AkiraBit•34m ago•0 comments

Getty's landmark UK lawsuit on copyright and AI set to begin

https://www.reuters.com/sustainability/boards-policy-regulation/gettys-landmark-uk-lawsuit-copyright-ai-set-begin-2025-06-09/
3•aspenmayer•46m ago•0 comments

Subscribers

https://www.rxjourney.net/24-subscribers
1•blessingblossom•50m ago•0 comments

IonQ to acquire UK-based Oxford Ionics for $1.08B

https://www.reuters.com/world/uk/quantum-computing-firm-ionq-acquire-uk-based-oxford-ionics-108-billion-2025-06-09/
2•donutloop•58m ago•0 comments

AI's Challenge Will Be Extreme" – Ilya Sutskever, Toronto (June 6, 2025) [video]

https://www.youtube.com/watch?v=LRqNLcejnOE
5•emot•1h ago•0 comments

Dubious statistical results are becoming less common in psychology

https://www.science.org/content/article/big-win-dubious-statistical-results-are-becoming-less-common-psychology
3•pseudolus•1h ago•1 comments

Schneier tries to rip the rose-colored AI glasses from the eyes of Congress

https://www.theregister.com/2025/06/06/schneier_doge_risks/
5•pseudolus•1h ago•1 comments

Crawl URLs and scan for endpoints, secrets, file extensions

https://github.com/edoardottt/cariddi
1•speerer•1h ago•0 comments

NumPy 2.3 Introduces OpenMP Parallelization Support

https://www.phoronix.com/news/NumPy-2.3-Released
1•cl3misch•1h ago•0 comments

Built my first iOS App – A converter app for units/currency/time

https://apps.apple.com/en/app/convertergo/id6746034629?l=en-GB
1•TYZILLA•1h ago•1 comments

Whether having a baby ruins your life or not

https://goodanger.substack.com/p/on-whether-having-a-baby-ruins-your
12•walterbell•1h ago•4 comments

Me and a friend are making a no-compile app building/data exploration tool

https://tailrmade.app/
1•el_magnificus•1h ago•0 comments

Earthquake Map · Streamlit

https://mybestproject-earthquake-data-visualizer-earthquake-app.streamlit.app
2•url_king•1h ago•0 comments