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

Use Platform-independent audio output #188

Closed
Holzhaus opened this issue Sep 19, 2014 · 3 comments
Closed

Use Platform-independent audio output #188

Holzhaus opened this issue Sep 19, 2014 · 3 comments
Assignees
Labels

Comments

@Holzhaus
Copy link
Member

AbstractSpeaker's play() method currently uses aplay for wav file playback. To make Jasper more platform independent, Jasper should use a more generic way of playing wav files.

Currently we can't get PyAudio to work, because this code may result in choppy playback in some configurations:

f = wave.open(filename, 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(f.getsampwidth()),
                channels=f.getnchannels(),
                rate=f.getframerate(),
                output=True)
data = f.readframes(chunksize)
while data:
    stream.write(data)
    data = f.readframes(chunksize)
stream.stop_stream()
stream.close()
p.terminate()

Therefore, we switched back to aplay for now. Still, this is something we need to fix.

Holzhaus added a commit to Holzhaus/jasper-client that referenced this issue Sep 19, 2014
Holzhaus added a commit to Holzhaus/jasper-client that referenced this issue Sep 24, 2014
Holzhaus added a commit to Holzhaus/jasper-client that referenced this issue Sep 26, 2014
@Holzhaus
Copy link
Member Author

The Evil line is here. I hope we can at least remove the -D hw:1,0 at some point, so that we no longer need to break our existing audio setups to use jasper.
By using hw:1,0, we also prevent user setups with different sound cards that do not support the sample rates we use in jasper by hardware. ALSA can be configured to do rate conversion automatically via dmix (or even via PulseAudio with device pulse). We break this possibility by hardcoding the hardware device.

@Holzhaus Holzhaus added bug and removed enhancement labels Oct 15, 2014
Holzhaus added a commit to Holzhaus/jasper-client that referenced this issue Oct 15, 2014
By hardcoding the device, we're forcing users to break their audio setups in order to use jasper. Instead, users should use ~/.asoundrc to configure ALSA so that arecord/aplay work without arguments.

This is a partial fix for issue jasperproject#188
@Holzhaus
Copy link
Member Author

Holzhaus commented Dec 2, 2014

This will hopefully be fixed by #247.

@Holzhaus
Copy link
Member Author

#247 was merged into the v2.0 dev branch, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants