Skip to content

Use 32768.0 instead of 255.0 when converting the audio bytes to a NumPy array  #4

@Snow9666

Description

@Snow9666

Hey man, should we use 32768.0 instead of 255.0 ?

@app.post("/predict")
async def predict(audio_data: bytes = Depends(parse_body)):
# Convert the audio bytes to a NumPy array
# audio_data_array: np.ndarray = np.frombuffer(audio_data, np.int16).astype(np.float32) / 255.0
audio_data_array: np.ndarray = np.frombuffer(audio_data, np.int16).astype(np.float32) / 32768.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions