hello, my volcengine realtime model reaturn pcm(fl...
# agents
f
hello, my volcengine realtime model reaturn pcm(float32) before, i have the working code for it. now it supports pcm int16, i want to use that, but my new code results in noisy, could audio experts help me to have a look?
Copy code
# working with pcm      
float32_data = np.frombuffer(payload, dtype=np.float32)

      # Convert float32 (-1.0 to 1.0) to int16 (-32768 to 32767)
      int16_data = (float32_data * 32767).astype(np.int16)

      frame = rtc.AudioFrame(
        data=int16_data.tobytes(),
        sample_rate=OUTPUT_SAMPLE_RATE,
        num_channels=NUM_CHANNELS,
        samples_per_channel=len(int16_data),
      )
# not working with pcm_s16le
int16_data = data = np.frombuffer(payload, dtype=np.int16)
frame = rtc.AudioFrame(
        data=int16_data.tobytes(),
        sample_rate=OUTPUT_SAMPLE_RATE,
        num_channels=NUM_CHANNELS,
        samples_per_channel=len(int16_data) // NUM_CHANNELS,
      )