Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does in-code streaming sound different (flatter)? #698

Open
jhfoo opened this issue Jan 11, 2025 · 0 comments
Open

Why does in-code streaming sound different (flatter)? #698

jhfoo opened this issue Jan 11, 2025 · 0 comments

Comments

@jhfoo
Copy link

jhfoo commented Jan 11, 2025

Tried the examples:

  1. Pipe raw piper output from shell to aplay:
echo 'This sentence is spoken first. This sentence is synthesized while the first sentence is spoken.' | \
  ./piper --model en_US-lessac-medium.onnx --output-raw | \
  aplay -r 22050 -f S16_LE -t raw -

  1. Stream from code (python):
dtype = 'int16'
DeviceId = 3
stream = sd.OutputStream(
  samplerate=voice.config.sample_rate, 
  channels=1, 
  device = DeviceId, 
  dtype=dtype
)
stream.start()
for bytes in voice.synthesize_stream_raw(text):
    data = np.frombuffer(bytes, dtype=np.int16)
    stream.write(data)

Option 2 works but the sound is not as bold as Option 1. Plus the first word is not enunciated as clearly. Both output to the same speaker device.

What might be causing this?

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

No branches or pull requests

1 participant