Hae tietoja odotettavissa olevista tai valmiista transkriptioista
Puhtaaksi kirjoita live-puhe mikrofonista tai live-suoratoisto
Valvo ja hallitse transkriptiotilan istuntoja
Käännä transkriptoitu teksti toiselle kielelle
Luo väliaikainen todennustunnus asiakaspuolen pyyntöjä varten
Kaikkien transkriptio-operaatioiden yhteiset pyyntöasetukset ja vastaukset
Luo istunto, jota voidaan käyttää lähettämään live-puhekirjotusta julkisesti jaettavan linkin kautta
JavaScriptimport { UrlTranscription } from '@vocalstack/js-sdk';
const sdk = new UrlTranscription({ apiKey: 'YOUR-API-KEY' });
const transcription = await sdk.connect({
url: 'http://example.com/files/meaningless.mp3',
});
transcription.start();
// This will print the transcription data as it comes in
transcription.onData(console.log);
/*
{
status: 'processing',
data: {
id: 'd1e7b3b0-7b3b-4b3b-8b3b-0b3b7b3b3b3b',
operation: 'transcription-prerecorded',
progress: 0.1,
timeline: [
{
start: 0,
end: 7.52,
text: 'Meaningless, meaningless, says the teacher, utterly meaningless, everything is meaningless.',
language: 'en',
translations: { ... },
},
...
]
}
}
*/
JavaScript// Run "npm install @voca l-stack/js-sdk" to install the package
import { UrlTranscription } from '@vocalstack/js-sdk';
// Get your key here ⇢ https://www.vocalstack.com/dashboard/api-keys
const sdk = new UrlTranscription({ apiKey: 'YOUR-API-KEY' });
const transcription = await sdk.connect({
// URL to the audio file
url: 'http://example.com/files/audio.mp3',
// Optional: language of the speech spoken
// (this can be used to improve the transcription accuracy)
language: 'en',
// Optional: the maximum duration to transcribe, in seconds
// (if not provided, the entire audio file will be transcribed)
max_duration_s: 1800,
// Optional: the actual duration of the audio file, in seconds
// (the transcription starts only if the audio file matches this duration)
duration_s: 3600,
});
// Start the transcription
transcription.start();
// Listen for transcription data
transcription.onData((response) => {
const { status, data } = response;
console.log(status); // 'waiting', 'processing', 'done', or 'error'
if (data) {
console.log(data.progress); // a value between 0 and 1
console.log(data.timeline); // an object with the transcription timeline
}
if (status === 'done') {
console.log(data.summary); // a summary of the transcription
console.log(data.keywords); // an array of keywords
console.log(data.paragraphs); // the entire transcription in paragraph form
}
});