Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A JavaScript port of [The "Quite OK Audio" (QOA) format](https://github.com/phoboslab/qoa), a lossy audio compression that achieves relatively decent compression with fast decoding and not much complexity. Also see [this](https://phoboslab.org/log/2023/02
A JavaScript port of The "Quite OK Audio" (QOA) format, a lossy audio compression that achieves relatively decent compression with fast decoding and not much complexity. Also see this blog post by @phoboslab.
Features:
decodeAudioData
This software is still experimental, unstable, and likely to change or break. Use at your own risk.
If you are hacking and experimenting with this, take care when using headphones as garbage data may produced loud noises that can damage hearing.
As the spec is still in flux, this may not correctly decode files generated by different versions of the C encoder or third-party implementations. This has been tested against this particular QOA commit tree when building from source on macOS.
import { encode, decode } from 'qoa-format';
// or just the decode/encode function -
// import decode from 'qoa-format/decode.js';
// Encoding raw audio samples
const audioData = {
sampleRate: 44100
channelData: [
new Float32Array([ /* audio samples */ ])
]
}
// lossy encode raw audio samples to Uint8Array QOA file
const qoaFile = encode(audioData)
// Decode QOA file back to audio data
const decodedAudio = decode(qoaFile);
// Show info about the decoded file
console.log(decodedAudio.sampleRate); // 44100
console.log(decodedAudio.channels); // 1
console.log(decodedAudio.samples); // (number of samples in audio signal)
console.log(decodedAudio.channelData); // [ Float32Array(samples) ]
See test/sine.js for encoding/decoding a 441 Hz sine wave, and test/webaudio.js for a decoder and web audio QOA player.
Use npm to install.
npm install qoa-format --save
data = encode({ channelData, sampleRate })
Encodes the audio signal in channelData
with sampleRate
as a QOA file, returning data
as a Uint8Array
. The length of channelData
determines the number of channels (mono, stereo, multi-channel), and each element is expected to be a Float32Array
with the same length (i.e. samples
or number of sample frames). The signal is expected to range from -1..1
.
audio = decode(Uint8Array | Buffer)
Decodes the Uint8Array
or Buffer
object into an audio
specifier which has the following format:
{
sampleRate, // in Hz
channels, // number of channels
samples, // number of frame samples per channel
channelData: [
// an array of audio samples for each channel
Float32Array(samples),
...
]
}
Once cloned, you can npm install
and then run the test:
npm run test
Or the HTML/WebAudio test, run the below command and then open http://localhost:8000/test/webaudio.html. Note: Take caution when wearing headphones if you are hacking with this. 🎧
npm run test:browser
Or run the CLI to convert files:
# encode WAV to QOA
node test/cli.js input.wav output.qoa
# decode QOA to WAV
node test/cli.js output.qoa converted.wav
MIT, see LICENSE.md for details.
FAQs
A JavaScript port of [The "Quite OK Audio" (QOA) format](https://github.com/phoboslab/qoa), a lossy audio compression that achieves relatively decent compression with fast decoding and not much complexity. Also see [this](https://phoboslab.org/log/2023/02
We found that qoa-format demonstrated a not healthy version release cadence and project activity because the last version was released 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.