GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix the sleep logic for streaming as per sample rate by puneith · Pull Request #279 · GoogleCloudPlatform/java-docs-samples

Conversation

@puneith

@puneith puneith commented Jul 28, 2016

Copy link
Copy Markdown
Contributor

@jerjou @tswast Please review. Changed the sleep time to absolute 100ms because for 32KKHz the Speech API was complaining about

message: "Audio data is being streamed too slow. Please stream audio data approximately at real time."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@puneithk
sleep 100ms instead of sleeping as function of rate
80eb6da
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 28, 2016
@codecov-io

codecov-io commented Jul 28, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Current coverage is 47.22% (diff: 85.71%)

Merging #279 into master will increase coverage by 2.31%

@@             master       #279   diff @@
==========================================
  Files            78         78          
  Lines          2267       2270     +3   
  Methods           0          0          
  Messages          0          0          
  Branches        154        154          
==========================================
+ Hits           1018       1072    +54   
+ Misses         1216       1167    -49   
+ Partials         33         31     -2   

Powered by Codecov. Last update d7f1d7f...a44e692

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jerjou
jerjou reviewed Jul 29, 2016
View reviewed changes
Comment thread speech/grpc/src/main/java/com/examples/cloud/speech/StreamingRecognizeClient.java Outdated
// For 16000 Hz sample rate, sleep 100 milliseconds.
Thread.sleep(samplingRate / 160);
// Sleep 100ms
Thread.sleep(100);

@jerjou jerjou Jul 29, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approximating realtime is dependent on the samplingRate, so you can't hard-code 100ms unless you're also hard-coding the samplingRate.

The calculation here should instead be dependent on samplingRate, buffer size, and encoding. Since encoding is hard-coded to 2 bytes per sample, you should sleep for:

int BYTES_PER_SAMPLE = 2;  // because LINEAR16 - ie 16 bits per sample, at 8 bits per byte
int BYTES_PER_BUFFER = 3200;
int SAMPLES_PER_BUFFER = BYTES_PER_BUFFER / BYTES_PER_SAMPLE; // 1600

int samplesPerMillisecond = samplingRate / 1000;
int millisecondsPerBuffer = SAMPLES_PER_BUFFER / samplesPerMillisecond;
Thread.sleep(millisecondsPerBuffer);

which for 16000 Hz is 1600 / 16 = 100 (as expected), and for 32000 Hz is 1600 / 32 = 50 (which is faster than the original 32000 / 160 = 200). I suspect there was just an error in the original calculation. (feel free to check my math as well - but at least it gives a shorter sleep duration, which is what you'd expect if you increase the sample rate while keeping the buffer size the same)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
puneithk added 3 commits July 28, 2016 20:47
@puneithk
added sleep as inverse of sampling rate
7d8f4b5
@puneithk
added LINEAR16 bytes per sample constant
d87d691
@puneithk
added few variables
ff7ffbc
@puneith

puneith commented Jul 29, 2016

Copy link
Copy Markdown
Contributor Author

@jerjou PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jerjou

jerjou commented Jul 29, 2016

Copy link
Copy Markdown
Contributor

Cool.
Can you add a test with a non-16kHz audio file?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

puneithk added 5 commits August 3, 2016 17:38
@puneithk
added truth and log4j
a23abdc
@puneithk
added 32khz audio
0cee557
@puneithk
added Streaming Test
df11062
@puneithk
added unit tests for 16 and 32 khz audio
a253ebf
@puneithk
checkstyle fixes
d1fdc61
@puneith

puneith commented Aug 4, 2016

Copy link
Copy Markdown
Contributor Author

@jerjou PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jerjou
jerjou reviewed Aug 4, 2016
View reviewed changes
Comment thread speech/grpc/src/test/java/com/examples/cloud/speech/StreamingRecognizeClientTest.java
private Writer writer;
private WriterAppender appender;

@Before

@jerjou jerjou Aug 4, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should this be a @BeforeClass, since it's adding an appender (rather than replacing it)? ie if this ones once per test, won't new appenders get added as many times as there are tests?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@puneith puneith Aug 4, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I have to do it for each test so that StringWriter is new. There is an After which I now think should be AfterClass where all added appenders will be removed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jerjou jerjou Aug 4, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oh I see. No - having it in an After makes sense. Sorry - didn't see the After.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jerjou

jerjou commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Travis was unhappy because the api wasn't enabled in the test project. I enabled it and kicked off the build again (I think?).

Thanks for adding the tests! Didn't realize there weren't already tests -_-;

Anyway - looks good from my end - just a couple minor comments. Can you get someone from the java team to sign off on it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@puneith

puneith commented Aug 4, 2016

Copy link
Copy Markdown
Contributor Author

@tswast @lesv PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@puneithk
renamed to KHz
a44e692
@jerjou

jerjou commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Oh - would you mind updating the title to the PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@puneith puneith changed the title sleep 100ms instead of sleeping as function of rate Fix the sleep logic for streaming as per sample rate Aug 4, 2016
@lesv

lesv commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Minor comment, consider it, change if you wish, then LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@puneithk
added comment
4ac456e
@lesv

lesv commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

LGTM - once travis passes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lesv
lesv merged commit 16407a9 into master Aug 4, 2016
@lesv
lesv deleted the streaming_sleep branch August 11, 2016 16:30
ivanmkc pushed a commit that referenced this pull request Nov 3, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud:libraries-bom to v12.…
496b06a
…1.0 (#279)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | minor | `12.0.0` -> `12.1.0` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datalabeling).
@ivanmkc ivanmkc mentioned this pull request Nov 3, 2022
migrate code from googleapis/java-datalabeling #7386
Merged
9 tasks
averikitsch pushed a commit that referenced this pull request Nov 9, 2022
@renovate-bot @averikitsch
chore(deps): update dependency com.google.cloud:libraries-bom to v12.…
756502b
…1.0 (#279)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | minor | `12.0.0` -> `12.1.0` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datalabeling).
minherz pushed a commit that referenced this pull request Nov 9, 2022
@release-please
chore: release 0.120.5 (#279)
8abd405
🤖 I have created a release \*beep\* \*boop\* 
---
### [0.120.5](https://www.github.com/googleapis/java-errorreporting/compare/v0.120.4...v0.120.5) (2020-10-21)


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.13.0 ([#277](https://www.github.com/googleapis/java-errorreporting/issues/277)) ([372fca0](https://www.github.com/googleapis/java-errorreporting/commit/372fca01cbac38951689f533b8d76d2a0bdc74e9))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Shabirmean pushed a commit that referenced this pull request Nov 9, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
9b6d561
…3.0 (#279)
This was referenced Nov 9, 2022
(WIP) samples: migrate code from googleapis/java-servicedirectory #7396
Closed
[WIP] samples: migrate code from googleapis/java-servicedirectory #7397
Closed
Shabirmean pushed a commit that referenced this pull request Nov 9, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
81981cb
…3.0 (#279)
@Shabirmean Shabirmean mentioned this pull request Nov 9, 2022
[WIP] samples: migrate code from googleapis/java-servicedirectory #7398
Closed
9 tasks
Shabirmean pushed a commit that referenced this pull request Nov 9, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
6c5c8f4
…3.0 (#279)
@Shabirmean Shabirmean mentioned this pull request Nov 9, 2022
samples: migrate code from googleapis/java-servicedirectory #7399
Merged
9 tasks
Shabirmean pushed a commit that referenced this pull request Nov 10, 2022
@renovate-bot @Shabirmean
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
279e398
…3.0 (#279)
minherz pushed a commit that referenced this pull request Nov 10, 2022
@release-please @minherz
chore: release 0.120.5 (#279)
98129da
🤖 I have created a release \*beep\* \*boop\* 
---
### [0.120.5](https://www.github.com/googleapis/java-errorreporting/compare/v0.120.4...v0.120.5) (2020-10-21)


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.13.0 ([#277](https://www.github.com/googleapis/java-errorreporting/issues/277)) ([372fca0](https://www.github.com/googleapis/java-errorreporting/commit/372fca01cbac38951689f533b8d76d2a0bdc74e9))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
minherz pushed a commit that referenced this pull request Nov 10, 2022
@release-please @minherz
chore: release 0.120.5 (#279)
e740970
🤖 I have created a release \*beep\* \*boop\* 
---
### [0.120.5](https://www.github.com/googleapis/java-errorreporting/compare/v0.120.4...v0.120.5) (2020-10-21)


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.13.0 ([#277](https://www.github.com/googleapis/java-errorreporting/issues/277)) ([372fca0](https://www.github.com/googleapis/java-errorreporting/commit/372fca01cbac38951689f533b8d76d2a0bdc74e9))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Shabirmean pushed a commit that referenced this pull request Nov 11, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud.samples:shared-config…
936d243
…uration to v1.0.21 (#279)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.cloud.samples:shared-configuration](com/google/cloud/samples/shared-configuration) | patch | `1.0.18` -> `1.0.21` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-recommender).
@Shabirmean Shabirmean mentioned this pull request Nov 11, 2022
samples: migrate code from googleapis/java-recommender #7410
Closed
9 tasks
Sita04 pushed a commit that referenced this pull request Nov 11, 2022
@renovate-bot
chore(deps): update dependency com.google.cloud:google-cloud-security…
4883026
…-private-ca to v2.1.1 (#279)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-security-private-ca](https://togithub.com/googleapis/java-) | `2.1.0` -> `2.1.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/compatibility-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/confidence-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-security-private-ca).
@Sita04 Sita04 mentioned this pull request Nov 11, 2022
chore: migrate code from googleapis/java-security-private-ca #7413
Merged
9 tasks
Shabirmean pushed a commit that referenced this pull request Nov 16, 2022
@galdawave @gcf-owl-bot
samples: add create agent code sample (#279)
c5c6e7c
* samples: add create agent code sample

* Lint fix

* Fix failing test

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Rebased

* Revised Code per comments

* lint fix

* Added Comment for timezone

* Fixed lint

* Used String.format

* Added stdOut Var

* removed parent variable

* Update Tests

* lint fix

* removed parentPath

* removed unreachable statemt

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Revised Code Per Comments

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
@Shabirmean Shabirmean mentioned this pull request Nov 16, 2022
samples: migrate code from googleapis/java-dialogflow-cx #7435
Merged
9 tasks
Shabirmean pushed a commit that referenced this pull request Nov 17, 2022
@galdawave @gcf-owl-bot @Shabirmean
samples: add create agent code sample (#279)
ff1a0ab
* samples: add create agent code sample

* Lint fix

* Fix failing test

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Rebased

* Revised Code per comments

* lint fix

* Added Comment for timezone

* Fixed lint

* Used String.format

* Added stdOut Var

* removed parent variable

* Update Tests

* lint fix

* removed parentPath

* removed unreachable statemt

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Revised Code Per Comments

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sita04 pushed a commit that referenced this pull request Jan 17, 2023
@renovate-bot @Sita04
chore(deps): update dependency com.google.cloud:google-cloud-security…
ff2799e
…-private-ca to v2.1.1 (#279)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-security-private-ca](https://togithub.com/googleapis/java-) | `2.1.0` -> `2.1.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/compatibility-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-security-private-ca/2.1.1/confidence-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-security-private-ca).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@puneith @codecov-io @jerjou @lesv @googlebot @puneithk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.