Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stagas/pretty-fast-fft
WebAssembly build of a small, pretty fast FFT library (PFFFT).
https://github.com/stagas/pretty-fast-fft
Last synced: 13 days ago
JSON representation
WebAssembly build of a small, pretty fast FFT library (PFFFT).
- Host: GitHub
- URL: https://github.com/stagas/pretty-fast-fft
- Owner: stagas
- License: mit
- Created: 2022-09-05T06:34:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-28T07:19:52.000Z (almost 2 years ago)
- Last Synced: 2024-08-10T10:57:38.683Z (3 months ago)
- Language: TypeScript
- Size: 73.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pretty-fast-fftWebAssembly build of a small, pretty fast FFT library (PFFFT).
npm i pretty-fast-fft
pnpm add pretty-fast-fft
yarn add pretty-fast-fft
## Examples
#
web
- #
view source
example/web.ts
```ts
import { createRunner } from 'pretty-fast-fft'
const blockSize = 4096
const stepSize = 1024
const main = async () => {
const runner = await createRunner(blockSize, stepSize)
const buffer = await (await fetch('./test/fixtures/sound.ogg')).arrayBuffer()
const ctx = new OfflineAudioContext(1, 1, 44100)
const audioBuffer = await ctx.decodeAudioData(buffer)
const floats = audioBuffer.getChannelData(0)
const stft_magnitudes = runner.processAudio(floats)
console.log(stft_magnitudes)
}
main()
```
This is simply npm packaging for this project:
> https://github.com/JorenSix/pffft.wasm
## API
# createRunner
(blockSize, stepSize)
# blockSize
= 1024
number
stepSize
= 128
number
createRunner(blockSize, stepSize) =>
Promise<{
# destroy
()
destroy() =>
- void
processAudio
(samples) # samples
Float32Array
processAudio(samples) =>
- number [] []
## Contributing
[Fork](https://github.com/stagas/pretty-fast-fft/fork) or [edit](https://github.dev/stagas/pretty-fast-fft) and submit a PR.
All contributions are welcome!
## License
MIT © 2022 [stagas](https://github.com/stagas)