Skip to content

Add Nemotron samples multi-lang test samples#672

Merged
samuel100 merged 20 commits intomainfrom
add-nemotron-samples-multilang
Apr 27, 2026
Merged

Add Nemotron samples multi-lang test samples#672
samuel100 merged 20 commits intomainfrom
add-nemotron-samples-multilang

Conversation

@rui-ren
Copy link
Copy Markdown
Contributor

@rui-ren rui-ren commented Apr 23, 2026

Summary

Add Nemotron live-audio transcription samples across JS, C#, Python, Rust, and C++ in their language-specific sample folders.

What’s included

JavaScript

  • Updated samples/js/live-audio-transcription-example/app.js
  • Synced to the final PR [Refactor] improve the JS example #588 behavior:
    • single-copy buffer handling in audio callback
    • improved queue/backpressure stability behavior retained

C#

  • Updated samples/cs/live-audio-transcription-example/Program.cs
  • Uses spinner-based EP registration flow for consistency with other C# samples

Python

  • Added new sample:
    • samples/python/live-audio-transcription/src/app.py
    • samples/python/live-audio-transcription/requirements.txt
  • Implements live microphone transcription with Nemotron (create_live_transcription_session pattern)

Rust

  • Added new sample:
    • samples/rust/live-audio-transcription-example/src/main.rs
    • samples/rust/live-audio-transcription-example/Cargo.toml
    • samples/rust/live-audio-transcription-example/README.md
  • Added listing entry in samples/rust/README.md

C++

Notes

  • Only sample-related files are included.
  • Unrelated local artifacts (e.g. .tgz, local temp folders) were intentionally excluded.

ruiren_microsoft and others added 2 commits April 3, 2026 21:23
Adds JS/C#/Python/Rust/C++ nemotron-focused live audio transcription samples and updates the Rust samples index.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 21:49
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Apr 27, 2026 6:39pm

Request Review

@rui-ren rui-ren changed the title Add nemotron samples multilang Add Nemotron samples multi-lang test samples Apr 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/updates Nemotron live-audio transcription samples across multiple languages to demonstrate real-time microphone (or synthetic) audio ingestion and streaming transcription results using Foundry Local SDKs.

Changes:

  • Add new Rust live-audio transcription sample crate + docs and link it from the Rust samples README.
  • Add new Python live-audio transcription sample (PyAudio-based) + requirements.
  • Update existing JS and C# samples for improved behavior/consistency; add a new C++ synthetic-audio sample.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
samples/rust/live-audio-transcription-example/src/main.rs New Rust live-audio transcription sample implementation.
samples/rust/live-audio-transcription-example/README.md Run instructions for the new Rust sample.
samples/rust/live-audio-transcription-example/Cargo.toml New Rust sample crate manifest and dependencies.
samples/rust/README.md Adds the new Rust sample to the samples index.
samples/python/live-audio-transcription/src/app.py New Python live microphone transcription sample.
samples/python/live-audio-transcription/requirements.txt Python dependencies for the new sample.
samples/js/live-audio-transcription-example/app.js Updates JS live-audio sample output handling and queue/backpressure behavior.
samples/cs/live-audio-transcription-example/Program.cs Updates EP registration flow to use spinner helper.
samples/cpp/live-audio-transcription-example/main.cpp New C++ sample pushing synthetic PCM and reading streaming/final results.
samples/cpp/live-audio-transcription-example/README.md Documentation for the new C++ sample.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/rust/live-audio-transcription/src/main.rs
Comment thread samples/rust/live-audio-transcription-example/src/main.rs Outdated
Comment thread samples/rust/live-audio-transcription-example/src/main.rs Outdated
Comment thread samples/rust/live-audio-transcription-example/README.md Outdated
Comment thread samples/python/live-audio-transcription/src/app.py
Comment thread samples/python/live-audio-transcription/src/app.py Outdated
Comment thread samples/cpp/live-audio-transcription-example/main.cpp Outdated
Comment thread samples/cpp/live-audio-transcription-example/main.cpp Outdated
rui-ren pushed a commit that referenced this pull request Apr 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rui-ren pushed a commit that referenced this pull request Apr 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- C++: Use explicit little-endian PCM encoding for portability
- C++: Continue on TryGetNext timeout with max-retry guard
- Rust: Safe-access r.content via .first() to avoid panic on empty
- Rust: Add sleep pacing in --synth mode for realistic ingestion
- Rust: Update README run instructions (crate not in workspace)
- Rust: Add SDK availability note in README
- Python: Add exception handling in capture_mic thread
- Python: Add SDK availability note in header comment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve conflicts:
- samples/cs/live-audio-transcription-example/Program.cs: keep (deleted on main)
- samples/js/live-audio-transcription-example/app.js: keep (deleted on main)
- samples/rust/README.md: adopt main's table format, add live-audio entry
- Add SDK availability notes to C++ sample

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The 'local-sdk' source (../../local-packages) was removed in PR #573 and
the ORT-Nightly feed was removed in PR #633, leaving only nuget.org.
Since Microsoft.AI.Foundry.Local is not published to nuget.org, all C#
sample builds fail during NuGet restore.

Restore the local-sdk source with package source mapping so the CI
'Build SDK from source' step output is discoverable by sample builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/python/live-audio-transcription/src/app.py
Comment thread samples/js/live-audio-transcription/README.md
Comment thread samples/rust/live-audio-transcription/Cargo.toml
Comment thread samples/cs/live-audio-transcription-example/Program.cs Outdated
Comment thread samples/python/live-audio-transcription/requirements.txt Outdated
Comment thread samples/python/live-audio-transcription/src/app.py Outdated
Comment thread samples/rust/live-audio-transcription-example/README.md Outdated
Comment thread samples/rust/live-audio-transcription-example/src/main.rs Outdated
Comment thread samples/rust/live-audio-transcription/src/main.rs
Comment thread samples/cs/nuget.config
- Map Microsoft.AI.Foundry.Local* to local-sdk so CI-built SDK (0.9.0-dev)
  is used instead of nuget.org's stable v1.0.0 which lacks newer APIs
- Add Microsoft.AI.Foundry.Local.Core* to nuget.org (longest-prefix wins)
  so Core native packages still resolve from nuget.org
- This fixes cs-samples CI failures caused by missing APIs in stable SDK

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Python: add download_and_register_eps() call, platform markers in
  requirements.txt, clarify forward-looking header comment
- JS: add package.json with type:module for ESM support, update README
- Rust: add winml feature for Windows, fix resample() panic on empty
  input, warn on non-f32 CPAL format, clarify README run instructions
- C#: replace fire-and-forget AppendAsync with bounded channel pattern,
  add comment explaining local-packages source in nuget.config

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The cs-samples CI job shows only 'exit code 1' without the actual
build errors. Capture build output and emit error lines as ::error::
annotations so they appear in the PR checks tab.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CI-built SDK transitively depends on Microsoft.Extensions.Logging
>= 9.0.15 (via Core.WinML -> WindowsAppSDK). The previous pin to
9.0.10 in Directory.Packages.props caused NU1605 package downgrade
errors. Also surface build errors as GitHub annotations for better
CI debugging.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… all samples

Update the model name from 'nemotron' to 'nemotron-speech-streaming-en-0.6b'
in all 5 language samples (JS, C#, Python, Rust, C++). Also align the JS
sample with the reference at ruiren/build-js-sdk-packaging (appName, banner).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mirror the JS sample's naudiodon2 mic capture pattern in C++ using PortAudio:
- Background thread reads transcription results (like JS readPromise)
- PortAudio callback pushes PCM to bounded AudioQueue (like JS appendQueue)
- Main thread pumps queue to session->Append() (like JS pumpAudio)
- Ctrl+C graceful shutdown (like JS SIGINT handler)
- Falls back to synthetic PCM if PortAudio unavailable or --synth passed
- Compile with -DHAS_PORTAUDIO to enable mic capture

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/cs/live-audio-transcription-example/LiveAudioTranscriptionExample.sln Outdated
Comment thread samples/cpp/live-audio-transcription/main.cpp
Comment thread samples/cs/live-audio-transcription-example/Program.cs Outdated
Comment thread samples/python/live-audio-transcription/requirements.txt Outdated
Comment thread samples/js/live-audio-transcription-example/package.json Outdated
Comment thread samples/cs/nuget.config
Comment thread samples/cs/live-audio-transcription-example/LiveAudioTranscriptionExample.sln Outdated
Comment thread samples/cpp/live-audio-transcription-example/README.md Outdated
Comment thread samples/js/live-audio-transcription/app.js
- C++ main.cpp: align with actual SDK API (Manager::Create/Instance,
  OpenAIAudioClient(*model), Manager::Destroy, download progress callback)
- JS app.js: auto-stop session after synthetic audio fallback (prevents hang)
- JS package.json: move naudiodon2 to optionalDependencies
- C# Program.cs: add OS check for WaveInEvent (Windows-only), add --synth
  flag and synthetic PCM fallback for non-Windows platforms
- C# .sln: fix Any CPU/x86 config mapped to ARM64 -> use proper platforms
- Python requirements.txt: remove pyaudio (optional, can break CI); add
  install instructions as comments
- Skip nuget.config comment (longest-prefix-match works correctly)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/rust/live-audio-transcription/src/main.rs
Comment thread samples/rust/live-audio-transcription/README.md
Comment thread samples/rust/README.md
Comment thread samples/js/live-audio-transcription/package.json
Comment thread samples/python/live-audio-transcription/README.md
Comment thread samples/rust/live-audio-transcription/src/main.rs Outdated
Comment thread samples/cpp/live-audio-transcription/main.cpp
Comment thread samples/cpp/live-audio-transcription/main.cpp
Comment thread samples/js/live-audio-transcription/app.js
Comment thread samples/cpp/live-audio-transcription/main.cpp Outdated
Comment thread samples/cpp/live-audio-transcription/README.md Outdated
@samuel100 samuel100 merged commit 573dbde into main Apr 27, 2026
54 checks passed
@samuel100 samuel100 deleted the add-nemotron-samples-multilang branch April 27, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants