Cambrea’s Status Report for March 27

For this week, I worked on fixing some audio issues with the audio device code.  The issue was that when I went to play the output audio on the speaker(this should be the output audio from users), this was not the correct audio and instead was just computer noise.  I was trying to play raw audio using pyaudio like

    stream = p.open(
            rate=RESPEAKER_RATE,
            format=p.get_format_from_width(RESPEAKER_WIDTH),
            channels=RESPEAKER_CHANNELS,
            output=True,
            frames_per_buffer=CHUNK,
            input_device_index=RESPEAKER_INDEX,
          )
stream.write(data)
This code to stream.write(data) was not working with raw audio but was working when instead I wrote this audio to a wav file and stream.write() the data from the file after.
I am thinking that the raw audio data was not the correct format or type to be played using the stream, but when I print the type of the raw data I can see that it is “bytes” which is very ambiguous,  the stream documentation says that it is also meant to play “byte” like objects.
Going forward I just instead chose to write this raw data to wav and then play the wav file through the stream since that gives clear audio.
This week I also received the equipment for the second audio device and assembled it.  I have downloaded the necessary code onto the device and am testing currently using my computer as the server(by this I mean I am running basic server code on my computer with both devices connected to it).  I am currently testing that the devices send and receive the correct data to eachother.
I am currently on track with my progress, next week I will work on using the AWS server for the audio devices and integrating this code with Ellen’s speech to text code.

Leave a Reply

Your email address will not be published. Required fields are marked *