
Security News
Google’s OSV Fix Just Added 500+ New Advisories — All Thanks to One Small Policy Change
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
sofya.transcription
Advanced tools
a JavaScript library that provides a robust and flexible solution for real-time audio transcription. It is designed to transcribe audio streams and can be easily integrated into web applications.
Sofya Transcription is a JavaScript library that provides a robust and flexible solution for real-time audio transcription. It is designed to transcribe audio streams and can be easily integrated into web applications. The library also includes a functionality for capturing audio from media elements.
<video>
and <audio>
.To install Sofya Transcription, you can use npm:
npm install sofya.transcription
Here's a basic example of how to use Sofya Transcription in your project:
Import the Library:
import { MediaElementAudioCapture, SofyaTranscriber } from 'sofya.transcription';
Create a Transcription Service Instance:
// Using API key connection
const transcriber = new SofyaTranscriber({
apiKey: 'YOUR_API_KEY',
config: {
language: 'en-US'
}
});
// Or using a specific provider
const transcriber = new SofyaTranscriber({
provider: 'sofya_compliance',
endpoint: 'YOUR_ENDPOINT',
config: {
language: 'en-US',
token: 'YOUR_TOKEN',
compartmentId: 'YOUR_COMPARTMENT_ID',
region: 'YOUR_REGION'
}
});
Initialize and Start Transcription:
// Wait for the transcriber to be ready
transcriber.on('ready', () => {
// Get media stream
navigator.mediaDevices.getUserMedia({ audio: true })
.then(mediaStream => {
// Start transcription
transcriber.startTranscription(mediaStream);
})
.catch(error => {
console.error('Error accessing microphone:', error);
});
});
Handle Transcription Events:
transcriber.on('recognizing', (text) => {
console.log('Recognizing: ' + text);
});
transcriber.on('recognized', (text) => {
console.log('Recognized: ' + text);
});
transcriber.on('error', (error) => {
console.error('Transcription error:', error);
});
transcriber.on('stopped', () => {
console.log('Transcription stopped');
});
Control Transcription:
// Pause transcription
transcriber.pauseTranscription();
// Resume transcription
transcriber.resumeTranscription();
// Stop transcription
await transcriber.stopTranscription();
SofyaTranscriber
constructor(connection: Connection): Creates a new instance of the transcription service with a connection object.
startTranscription(mediaStream: MediaStream): void: Starts the transcription process with a given MediaStream
.
stopTranscription(): void: Stops the transcription process.
pauseTranscription(): void: Pauses the transcription process.
resumeTranscription(): void: Resumes the transcription process.
on(event: string, callback: Function): this: Registers an event handler for transcription events. Possible events include:
recognizing
: Fired when transcription is in progress.recognized
: Fired when transcription is complete.error
: Fired when an error occurs.ready
: Fired when the transcription service is ready to start.stopped
: Fired when the transcription process is stopped.connected
: Fired when the transcription service is connected to the provider.The SDK supports different connection modes based on the provider:
{
apiKey: string;
config?: BaseConfig;
}
{
provider: "sofya_compliance";
endpoint: string;
config: SofyaComplianceConfig;
}
{
provider: "sofya_as_service";
endpoint: string;
config: SofyaSpeechConfig;
}
{
provider: "stt_wvad";
endpoint: string;
config: SofyaSpeechConfig;
}
interface BaseConfig {
language: string;
}
interface SofyaComplianceConfig extends BaseConfig {
token: string;
compartmentId: string;
region: string;
}
interface SofyaSpeechConfig extends BaseConfig {}
import React from 'react'
import { SofyaTranscriber } from 'sofya.transcription'
const App = () => {
const transcriberRef = React.useRef<SofyaTranscriber | null>(null)
const [transcription, setTranscription] = React.useState('')
const transcriptionRef = React.useRef('')
const getMediaStream = async () => {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
return stream
}
const startTranscription = async () => {
try {
const stream = await getMediaStream()
// Create transcriber with API key connection
const transcriber = new SofyaTranscriber({
apiKey: 'your_api_key',
config: {
language: 'en-US'
}
})
transcriberRef.current = transcriber
transcriber.on("ready", () => {
transcriber.startTranscription(stream)
})
transcriber.on('recognizing', (result: string) => {
transcriptionRef.current = result
setTranscription(result)
})
transcriber.on('recognized', (result: string) => {
transcriptionRef.current = result
setTranscription(result)
})
transcriber.on('error', (error: Error) => {
console.error('Transcription error:', error)
})
} catch (error) {
console.error('Error starting transcription:', error)
}
}
const stopTranscription = async () => {
if (transcriberRef.current) {
await transcriberRef.current.stopTranscription()
}
}
return (
<div>
<button onClick={startTranscription}>Start Transcription</button>
<button onClick={stopTranscription}>Stop Transcription</button>
<div>
<h3>Transcription:</h3>
<p>{transcription}</p>
</div>
</div>
)
}
export default App
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
a JavaScript library that provides a robust and flexible solution for real-time audio transcription. It is designed to transcribe audio streams and can be easily integrated into web applications.
We found that sofya.transcription demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
Research
/Security News
175 malicious npm packages (26k+ downloads) used unpkg CDN to host redirect scripts for a credential-phishing campaign targeting 135+ organizations worldwide.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.