Skip to content

I can't generate audio using standard version  #42

@longhtd

Description

@longhtd

Hi, I can't generate audio using standard version
It said bad request.
Could you please check if I missed any information?

Error generating audio: { message: 'Request failed with status code 400', code: 'ERR_BAD_REQUEST', statusCode: undefined, statusMessage: undefined }

My code is below:
`
// Import the PlayHT SDK
const PlayHT = require('playht');

// Initialize PlayHT with API credentials
PlayHT.init({
apiKey: 'key',
userId: 'userId',
});

// Function to generate audio
async function generateAudio() {
try {
const text = '在中国,传统节日和美食文化丰富多彩。每年农历新年,人们都会和家人团聚,吃饺子、年糕等传统食品,以庆祝新的一年。';

// Generate audio from text
const generated = await PlayHT.generate(text, {
  voiceEngine: 'Standard',
  voiceId: 'zh-CN-XiaoshuangNeural',
  quality: 'low',
  speed: 0.8,
});

// Grab the generated file URL
const { audioUrl } = generated;

console.log('The url for the audio file is', audioUrl);

} catch (error) {
console.error('Error generating audio:', error);
}
}

// Run the function to generate audio
generateAudio();
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions