Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
0485ba0
Design tweaks - centering everything and making the design 'responsiv…
chr15m Jul 27, 2015
075aa33
Implemented serialize/deserialize to JSON for persistence.
chr15m Jul 27, 2015
47d0345
Fit on a tiny mobile device screen (320px).
chr15m Jul 31, 2015
18b8234
Fit on a tiny mobile device screen (320px).
chr15m Jul 31, 2015
d1d006b
SoundEffect.generate(raw) takes a new parameter - raw which returns a…
chr15m Jul 31, 2015
0ba6f69
Add normalized buffer to return value of generate() instead.
chr15m Jul 31, 2015
9710de0
Play back with procedural audio if available.
chr15m Jul 31, 2015
6190cec
Use Float32 array instead of javascript array to try and speed things…
chr15m Aug 1, 2015
f6c8893
Ignore vim files.
chr15m Aug 6, 2015
e27cf29
node.js style import.
chr15m Aug 6, 2015
fd4c931
Changed to a version of imports that supports commonjs and amd, node.…
chr15m Aug 6, 2015
0847fbc
Merge branch 'master' into gh-pages
chr15m Aug 6, 2015
5ad5eca
Oops - calling Float32Array with no 'new'.
chr15m Aug 11, 2015
2763064
Silence the console output of parameters (can get this from 'deserial…
chr15m Aug 11, 2015
c0db387
Default wave type for some presets (coin, random).
chr15m Aug 11, 2015
068ec88
Encoding parameter set in a b58 string for URL sharing.
chr15m Aug 11, 2015
d656f9e
Use b58 encoding in index page to create a permalink and read any per…
chr15m Aug 11, 2015
a102b9d
Update the hash if there is one already, when changing values.
chr15m Aug 11, 2015
fa60926
Fixed regression with SAWTOOTH wave name.
chr15m Aug 11, 2015
65bea84
Added domain name.
chr15m Aug 11, 2015
ff685a8
Updated README to demonstrate how to use sounds in your own code.
chr15m Aug 11, 2015
3d23f01
Added myself as contributor.
chr15m Aug 11, 2015
dfe4a25
README tweak.
chr15m Aug 12, 2015
f4ad717
Updated documentation, screenshot.
chr15m Aug 12, 2015
fee0364
Nit.
chr15m Aug 12, 2015
5a59508
Made sharing links more obvious after feedback from LD blog.
chr15m Aug 13, 2015
b8cb1a6
Move JSON deserialising function into sfxr itself.
chr15m Aug 23, 2015
7d468a1
new getAudio() method on the SoundEffect().generate() object returns …
chr15m Aug 30, 2015
8ae63b0
Pass in b58 encoded parameters to SoundEffect() to init with them.
chr15m Aug 30, 2015
80edfae
Updated doc to reflect the different ways of loading and playing sounds.
chr15m Aug 30, 2015
f9e7399
Made sfxr import node.js friendly.
chr15m Jan 15, 2016
5cd8405
Command line script to convert sfxr synth definition to wav.
chr15m Jan 15, 2016
08b015b
Tip on the homepage about using sfxr-to-wav to convert sounds.
chr15m Jan 15, 2016
2e86e3a
If only a b58 sound definition is supplied, use it as the default fil…
chr15m Jan 15, 2016
9e39c5a
New preset - synth.
chr15m Jul 19, 2016
9cd3a35
Prevent permalink from forcing scroll.
chr15m Jan 4, 2018
6189f92
Change permalink text.
chr15m Jan 4, 2018
079dde3
Copy buttons etc.
chr15m Jan 4, 2018
daf7b93
Removed superfluous Knobs code.
chr15m Jan 4, 2018
a768da0
Removing more unused code and refactoring.
chr15m Jan 4, 2018
d19e686
Add more convenient play button.
chr15m Jan 4, 2018
b29c044
Re-arranging interface.
chr15m Jan 4, 2018
968b39a
Refactoring and comments.
chr15m Jan 4, 2018
fee8fe0
Refactoring.
chr15m Jan 4, 2018
f16efa3
More refactoring.
chr15m Jan 4, 2018
6395724
New namespaced functional API.
chr15m Jan 4, 2018
8ddb5f4
Modified module exports.
chr15m Jan 4, 2018
9659115
Expose old getAudio function.
chr15m Jan 4, 2018
1eea3f9
Extract bas58 decode function.
chr15m Jan 4, 2018
3efd914
Fixed audiocontext duplication bug.
chr15m Nov 13, 2018
42a643f
Attempted fix for #1.
chr15m Jul 25, 2020
8e8c589
Instructions for including scripts in page.
chr15m Sep 7, 2020
ac2217a
README and link tweaks.
chr15m Oct 15, 2020
af25cbf
Volume setting.
chr15m Oct 18, 2020
fa95614
Update riffwave.js and fix issue with .wav file output
charasyn Nov 7, 2020
fe26daa
Fix a bug with synth generator.
chr15m Mar 24, 2021
08312d1
Moving stuff around.
chr15m Mar 24, 2021
ac03d36
Bump version.
chr15m Mar 24, 2021
480f349
Bump version.
chr15m Mar 24, 2021
ccadec7
Added new 'click' generator.
chr15m Apr 7, 2021
08dd550
Bump version. Don't require express.
chr15m Apr 7, 2021
d7bbcb9
Remove stray console log.
chr15m May 9, 2021
9c7bac8
Bump version. Remove dev dep.
chr15m May 9, 2021
e0a2795
Return webaudio node on play.
chr15m Jun 24, 2021
fce755f
Correct midi base note frequency.
chr15m Jun 24, 2021
d91ccce
Bump version.
chr15m Jun 24, 2021
8a5144a
Lower octave possible in synth gen.
chr15m Jun 24, 2021
4c47d97
Fix ByteRate always being zero
rparrett Sep 2, 2021
2ce4956
Merge pull request #6 from rparrett/fix-byte-rate
chr15m Sep 2, 2021
80a97e9
Merge branch 'master' into gh-pages
chr15m Sep 7, 2021
c03dcd2
Added descriptions for search engines etc.
chr15m Sep 7, 2021
33727a8
Remove link to my game.
chr15m Sep 7, 2021
4f4a3ee
Improve 'about' copy.
chr15m Sep 9, 2021
52be1ed
Smaller link to game.
chr15m Sep 9, 2021
38a7152
Title clarity.
chr15m Sep 9, 2021
7a305de
Merge branch 'master' into gh-pages
chr15m Sep 9, 2021
7e717d3
Remove link to game.
chr15m Sep 20, 2021
f0f58c7
Fix typos, update copy.
chr15m Sep 20, 2021
7475abf
Update site copy.
chr15m Sep 20, 2021
fc05b64
Give download link a default filename.
chr15m Nov 8, 2021
aab8c25
Fixed mid-section wiggle. Fixes #7
chr15m Jan 1, 2022
b2324ce
Specify main file and dev deps.
chr15m May 23, 2022
495c399
Moved README to Markdown and updated.
chr15m May 25, 2022
d6875fb
Moved conversion functions into the library.
chr15m May 25, 2022
35ddcd5
Namespaced package.
chr15m May 25, 2022
4ae00d9
Updated README with npm command.
chr15m May 25, 2022
0de601d
Ignore files.
chr15m May 25, 2022
17dcbf0
Changed package name back and fixed main file.
chr15m May 25, 2022
0a5d5fd
Fix npm command.
chr15m May 25, 2022
d520a7a
Updated README with generator example.
chr15m May 25, 2022
51a123e
Fixed convert1k reference.
chr15m May 25, 2022
3110fc0
Added a note about presets.
chr15m May 25, 2022
c8dd592
Publish a functional API.
chr15m May 25, 2022
8bc27a3
Documentation tweak.
chr15m May 25, 2022
406883c
Added b58encode function and updated docs.
chr15m May 25, 2022
18a7322
Renamed conversion functions.
chr15m May 25, 2022
36306b2
Bumped major version number and added metadata for npm publish.
chr15m May 25, 2022
a0abd11
Update npm command.
chr15m May 25, 2022
6901b5d
Bump version.
chr15m May 25, 2022
727ff8e
Removed old files.
chr15m May 30, 2022
b7620ae
Don't bundle the UI for npm.
chr15m May 30, 2022
454cb69
Version bump.
chr15m May 30, 2022
febc429
Changed permissions on riffwave file.
chr15m May 30, 2022
134ef74
Prevent extreme synth cutoffs.
chr15m May 30, 2022
a7c75a3
Version bump.
chr15m May 30, 2022
4abf0a6
Fixed frequency display regression.
chr15m May 30, 2022
7b39c47
Version bump.
chr15m May 30, 2022
39a6cc2
Fix old 16-bit normalized buffer bug.
chr15m Jun 5, 2022
5a010bd
Fix old riffwave 16-bit save regression fa95614e.
chr15m Jun 5, 2022
34d6585
Semver bump for major bug fix.
chr15m Jun 5, 2022
07f37c0
More concise display of freq delta.
chr15m Jun 10, 2022
9c69c8e
Bump version.
chr15m Jun 10, 2022
a708164
Layout tweaks. Restored 'play' button position.
chr15m Jun 13, 2022
ca47b7b
Added a list of signed parameters.
chr15m Dec 12, 2022
a05a32f
New fns calculating domain and inverse.
chr15m Dec 12, 2022
d152794
Simple tests to verify function tables.
chr15m Dec 12, 2022
1b7decb
Version bump.
chr15m Dec 12, 2022
9745c12
Add note to README about Jsfxr Pro.
chr15m Dec 14, 2022
e682198
Tweak table of contents.
chr15m Dec 14, 2022
106fa84
Fix relative AMD import for webpack.
chr15m Feb 27, 2023
bf74c3c
Version bump.
chr15m Feb 27, 2023
256927a
List sfxr.js and riffwave.js in the module exports.
Jezzamonn Apr 23, 2023
d4b7270
Note about dataURI.
chr15m Apr 23, 2023
d265c73
Bump version number.
chr15m Apr 23, 2023
2385958
Round off freq_dramp at 4 digits to match others.
chr15m May 4, 2023
dd9d1a1
Add the ability to save and upload JSON saves.
SomeRanDev Mar 31, 2025
2ee7265
Hide file input element
SomeRanDev Mar 31, 2025
8cf8a64
Add tests to package.json.
chr15m Apr 1, 2025
c0abca3
Green play buttons. Fixes #8
chr15m Apr 2, 2025
b1eef9b
Brighter play button.
chr15m Apr 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.*.swp
workspace
node_modules
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sfxr.me
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

147 changes: 147 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
Quick 'n' easy game sound effects generator.

App 👉 https://sfxr.me

[About](#about) | [Use as a library](#library) | [Jsfxr Pro](#jsfxr-pro)

# About

A port of [sfxr](http://www.drpetter.se/project_sfxr.html) to HTML5 by Eric Fredricksen.
Maintained by Chris McCormick.

![jsfxr screenshot](screenshot.png)

# Library

You can use the jsxfr library to generate and play sounds in your JavaScript game code.

## Node

Install it:

```
npm i jsfxr
```

Require it:

```
const sfxr = require("jsfxr").sfxr;
```

See [API](#API) below for usage examples.

## Browser

Include the scripts in your page:

```
<script src="https://sfxr.me/riffwave.js"></script>
<script src="https://sfxr.me/sfxr.js"></script>
```

You can then directly use the `sfxr` namespace without requiring it.

## API

Generate a sound effect using a preset algorithm and play it using webaudio API.

```javascript
const sfxr = require("jsfxr").sfxr;

const preset = "pickupCoin";
const sound = sfxr.generate(preset);

sfxr.play(sound);
```

Available presets are `pickupCoin`, `laserShoot`, `explosion`, `powerUp`, `hitHurt`, `jump`, `blipSelect`, `synth`, `tone`, `click`, and `random`.

You can also use the interface at https://sfxr.me to find the sound you want and then use the sound definition.
Click the "serialize" button and copy the JSON code for the sound you want.
You will get a datastructure that you can use like this:

```javascript
var sound = {
"oldParams": true,
"wave_type": 1,
"p_env_attack": 0,
"p_env_sustain": 0.31718502829007483,
"p_env_punch": 0,
"p_env_decay": 0.2718540993592685,
"p_base_freq": 0.2612<F2>6191208337196,
"p_freq_limit": 0,
"p_freq_ramp": 0.43787689856926615,
"p_freq_dramp": 0,
"p_vib_strength": 0,
"p_vib_speed": 0,
"p_arp_mod": 0,
"p_arp_speed": 0,
"p_duty": 1,
"p_duty_ramp": 0,
"p_repeat_speed": 0.7558565452384385,
"p_pha_offset": 0,
"p_pha_ramp": 0,
"p_lpf_freq": 1,
"p_lpf_ramp": 0,
"p_lpf_resonance": 0,
"p_hpf_freq": 0,
"p_hpf_ramp": 0,
"sound_vol": 0.25,
"sample_rate": 44100,
"sample_size": 8
};

var a = sfxr.toAudio(sound);
a.play();
```

You can also use the short URL compressed version of the sound:

```javascript
var a = sfxr.toAudio("5EoyNVSymuxD8s7HP1ixqdaCn5uVGEgwQ3kJBR7bSoApFQzm7E4zZPW2EcXm3jmNdTtTPeDuvwjY8z4exqaXz3NGBHRKBx3igYfBBMRBxDALhBSvzkF6VE2Pv");
a.play();
```

You can also access an array of samples.
By default the buffer contains audio rendered at a sample rate of `44100`.

```
var buffer = sfxr.toBuffer(sound);
console.log(buffer);
```

Additionally you can get a dataURI for a wav file of the sound:

```
var a = sfxr.toWave(sound);
console.log(a.dataURI);
```

You can convert between the base58 short-url encoded format and JSON using `b58encode` and `b58decode`:

```
var b58string = sfxr.b58encode(sound);
var sound = sfxr.b58decode(b58string);
```

You can also access the lower level classes `SoundEffect` and `Params` if you need to.
This can be useful for caching the internal representation for efficiency, or mutating the sound with `params.mutate()`.

# Jsfxr Pro

A [Pro version of Jsfxr](https://pro.sfxr.me/) is available with enhanced features like the ability to save sounds to packs and download a zip file of all wavs.

[![Jsfxr Pro Screenshot](./jsfxr-pro-screenshot.png)](https://pro.sfxr.me)

# Links

* Application: http://sfxr.me/
* Source code: https://github.com/chr15m/jsfxr/

# Thanks

* Dr. Petter for inventing sfxr.
* Eric Fredricksen for creating this port.
* riffwave.js: http://www.codebase.es/riffwave/
* jquery-ui: http://jqueryui.com/
22 changes: 0 additions & 22 deletions README.rst

This file was deleted.

Loading