Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

simpleaudio

Pygator on March 1, 2020

What is 2**15 -1 doing? and it’s not clear what you did with the play buffer call. Thanks.

Joe Tatusko RP Team on March 2, 2020

Hi Pygator,

This one is a bit more complicated as it synthesizes a sound from a sine function. Since the goal is to produce a 16-bit sound, 2**15 -1 will create the ‘ceiling’ for the volume, applied to the note array made earlier to scale the data.

Because audio is now an array that maxes out at 16 bits, it can be passed into play_buffer to generate a tone. It accepts arguments for the audio data, number of channels, number of bytes per sample, and the sample rate.

Pygator on March 2, 2020

Thanks the 16 bits part makes more sense.

Become a Member to join the conversation.