You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 11, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+20-9Lines changed: 20 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
usfxr
2
2
=====
3
3
4
-
usfxr is a C# library used to generate game-like procedural audio effects inside Unity. With usfxr, one can easily synthesize sound in real time for actions such as item pickups, jumps, lasers, hits, explosions, and more.
4
+
usfxr is a C# library used to generate and play game-like procedural audio effects inside Unity. With usfxr, one can easily synthesize original sound in real time for actions such as item pickups, jumps, lasers, hits, explosions, and more, without ever leaving the Unity editor.
5
5
6
-
usfxr is a port of Thomas Vian's [as3sfxr](https://code.google.com/p/as3sfxr/), which itself is an ActionScript 3 port of Tomas Pettersson's [sfxr](http://www.drpetter.se/project_sfxr.html).
6
+
usfxr comes with code that allows for real-time audio synthesizing in games, and an in-editor interface for creating and testing effects before you use them in your code.
7
7
8
-
[This video](https://vimeo.com/15769163) explains the ideas behind as3sfxr, and the ideas that I want to support with usfxr.
8
+
usfxr is a port of Thomas Vian's [as3sfxr](https://code.google.com/p/as3sfxr/), which itself is an ActionScript 3 port of Tomas Pettersson's [sfxr](http://www.drpetter.se/project_sfxr.html). And as if the acronym collection is not enough, it also supports additional features first introduced by [BFXR](http://www.bfxr.net/) such as new waveform types and filters.
9
9
10
-
Despite my name not being Thomas or a variant of it, I found myself wishing for a (free) library to procedurally generate audio inside Unity in real time, and usfxr is the result. Since it is a Unity project, usfxr also includes an in-editor window to easily generate and test sounds without leaving the Unity.
10
+
[This video](https://vimeo.com/15769163) explains the ideas behind as3sfxr, and the ideas supported by usfxr.
11
11
12
12
13
13
Introduction
@@ -20,7 +20,7 @@ However, by using a runtime library like usfxr, you can generate the same audio
20
20
* Audio is generated in real time; there's no storage of audio files as assets necessary, making compiled project sizes smaller
21
21
* Easily play variations of every sound you play; adds more flavor to the gameplay experience
22
22
23
-
I make no claims in regards to the source code or interface, since it was simply adapted from Thomas Vian's own code and (elegant) interface. As such, usfxr contains the same features offered by as3sfxr, such as caching of generated audio and ability to play sounds with variations. But because it is adapted to work on a different platform, however, it has advantages of its own:
23
+
I make no claims in regards to the source code or interface, since it was simply adapted from Thomas Vian's own code and (elegant) as3sfxr interface, as well as Stephen Lavelle's BFXR additional features. As such, usfxr contains the same features offered by these two ports, such as caching of generated audio and ability to play sounds with variations. But because the code is adapted to work on a different platform (Unity), it has advantages of its own:
24
24
25
25
* Fast audio synthesis
26
26
* Ability to cache sounds the first time they're played
@@ -31,7 +31,9 @@ I make no claims in regards to the source code or interface, since it was simply
31
31
Installation
32
32
------------
33
33
34
-
Download the latest "usfxr" zip file from the "/build" folder of the GitHub repository and extract the contents of this file into the "Scripts" (or equivalent) folder of your Unity project. After doing that, you should have the usfxr interface available inside Unity, as well as being able to instantiate and play SfxrSyth objects inside your project.
34
+
Download the latest "usfxr" zip file from the "/build" folder of the GitHub repository and extract the contents of this file into the "Scripts" (or equivalent) folder of your Unity project. Alternatively, you can also download and install usfxr [from the asset store](https://www.assetstore.unity3d.com/en/#!/content/18619).
35
+
36
+
After doing that, you should have the usfxr interface available inside Unity, as well as being able to instantiate and play SfxrSyth objects inside your project.
35
37
36
38
37
39
Usage
@@ -138,7 +140,6 @@ To-do/ideas
138
140
* Show final duration in GUI
139
141
* Undo/Redo
140
142
* Add option to "lock" GUI items like BFXR's interface
141
-
* Implement BFXR's new parameters (new waveforms, new filters)
142
143
143
144
144
145
Acknowledgments
@@ -147,12 +148,22 @@ Acknowledgments
147
148
* Tomas Pettersson created the original [sfxr](http://www.drpetter.se/project_sfxr.html), where all the concepts for usfxr come from.
148
149
* Thomas Vian created [as3sfxr](https://code.google.com/p/as3sfxr/), the original code that was ported to C# for usfxr.
149
150
*[Tiaan Geldenhuys](http://tiaan.com/) contributed to usfxr by cleaning the code and creating the original version of the in-editor window that I bastardized later.
150
-
151
+
*[Stephen Lavelle](http://www.increpare.com/) created [BFXR](http://www.bfxr.net/), an AS3 port of SFXR with several new features of its own, many of which have been adopted by usfxr.
151
152
152
153
Changelog
153
154
---------
154
155
155
-
#### 2014-06-10
156
+
#### 2014-07-12
157
+
158
+
* Added support for BFXR's new filters: compression, harmonics, and bitcrusher
159
+
* Added support for BFXR's expanded pitch jump effects
160
+
* Added support for BFXR's parameter strings (standard SFXR parameter strings still work)
161
+
162
+
#### 2014-07-08
163
+
164
+
* Added support for BFXR's new waveform types: triangle, breaker, tan, whistle, and pink noise
waveTypeAsEnum=(WaveType)EditorGUILayout.EnumPopup(newGUIContent("Wave Type","Shape of the wave"),waveTypeAsEnum,waveTypeStyle);
222
+
parameters.waveType=(uint)waveTypeAsEnum;
223
+
GUILayout.Space(12);
213
224
214
-
//RenderToolbar(new string[] { "Square Wave", "Sawtooth", "Sine wave", "Noise" }, (value => parameters.waveType = ((uint)value)), new GUIContent("Wave Type", "Shape of the wave"));
215
225
//RenderPopup(waveTypeOptions, ((int)(parameters.waveType)), (value => parameters.waveType = ((uint)(value))), new GUIContent("Wave Type", "Shape of the wave"));
216
226
boolisSquareWaveType=(parameters.waveType==0);
217
227
RenderSlider(+0,+1,parameters.masterVolume,(value =>parameters.masterVolume=value),newGUIContent("Volume","Overall volume of the sound (0 to 1)"));
@@ -222,6 +232,9 @@ public bool RenderParameters(SfxrParams parameters) {
222
232
RenderSlider(+0,+1,parameters.sustainPunch,(value =>parameters.sustainPunch=value),newGUIContent("Sustain Punch","Tilts the sustain envelope for more 'pop' (0 to 1)"));
223
233
RenderSlider(+0,+1,parameters.decayTime,(value =>parameters.decayTime=value),newGUIContent("Decay Time","Length of the volume envelope decay (yes, I know it's called release) (0 to 1)"));
224
234
235
+
// BFXR
236
+
RenderSlider(+0,+1,parameters.compressionAmount,(value =>parameters.compressionAmount=value),newGUIContent("Compression","Pushes amplitudes together into a narrower range to make them stand out more. Very good for sound effects, where you want them to stick out against background music (0 to 1)"));
237
+
225
238
RenderHeading("Frequency");
226
239
RenderSlider(+0,+1,parameters.startFrequency,(value =>parameters.startFrequency=value),newGUIContent("Start Frequency","Base note of the sound (0 to 1)"));
227
240
RenderSlider(+0,+1,parameters.minFrequency,(value =>parameters.minFrequency=value),newGUIContent("Minimum Frequency","If sliding, the sound will stop at this frequency, to prevent really low notes (0 to 1)"));
@@ -230,9 +243,20 @@ public bool RenderParameters(SfxrParams parameters) {
230
243
RenderSlider(+0,+1,parameters.vibratoDepth,(value =>parameters.vibratoDepth=value),newGUIContent("Vibrato Depth","Strength of the vibrato effect (0 to 1)"));
231
244
RenderSlider(+0,+1,parameters.vibratoSpeed,(value =>parameters.vibratoSpeed=value),newGUIContent("Vibrato Speed","Speed of the vibrato effect (i.e. frequency) (0 to 1)"));
232
245
233
-
RenderHeading("Tone Change");
234
-
RenderSlider(-1,+1,parameters.changeAmount,(value =>parameters.changeAmount=value),newGUIContent("Change Amount","Shift in note, either up or down (-1 to 1)"));
235
-
RenderSlider(+0,+1,parameters.changeSpeed,(value =>parameters.changeSpeed=value),newGUIContent("Change Speed","How fast the note shift happens (only happens once) (0 to 1)"));
246
+
// BFXR
247
+
RenderSlider(+0,+1,parameters.overtones,(value =>parameters.overtones=value),newGUIContent("Harmonics","Overlays copies of the waveform with copies and multiples of its frequency. Good for bulking out or otherwise enriching the texture of the sounds (warning: this is the number 1 cause of usfxr slowdown!) (0 to 1)"));
248
+
RenderSlider(+0,+1,parameters.overtoneFalloff,(value =>parameters.overtoneFalloff=value),newGUIContent("Harmonics falloff","The rate at which higher overtones should decay (0 to 1)"));
249
+
250
+
RenderHeading("Tone Change/Pitch Jump");
251
+
// BFXR
252
+
RenderSlider(+0,+1,parameters.changeRepeat,(value =>parameters.changeRepeat=value),newGUIContent("Change Repeat Speed","Larger Values means more pitch jumps, which can be useful for arpeggiation (0 to 1)"));
253
+
254
+
RenderSlider(-1,+1,parameters.changeAmount,(value =>parameters.changeAmount=value),newGUIContent("Change Amount 1","Shift in note, either up or down (-1 to 1)"));
255
+
RenderSlider(+0,+1,parameters.changeSpeed,(value =>parameters.changeSpeed=value),newGUIContent("Change Speed 1","How fast the note shift happens (only happens once) (0 to 1)"));
256
+
257
+
// BFXR
258
+
RenderSlider(-1,+1,parameters.changeAmount2,(value =>parameters.changeAmount2=value),newGUIContent("Change Amount 2","Shift in note, either up or down (-1 to 1)"));
259
+
RenderSlider(+0,+1,parameters.changeSpeed2,(value =>parameters.changeSpeed2=value),newGUIContent("Change Speed 2","How fast the note shift happens (only happens once) (0 to 1)"));
236
260
237
261
RenderHeading("Square Waves");
238
262
RenderSlider(+0,+1,parameters.squareDuty,(value =>parameters.squareDuty=value),newGUIContent("Square Duty","Controls the ratio between the up and down states of the square wave, changing the tibre (0 to 1)"),isSquareWaveType);
@@ -251,11 +275,14 @@ public bool RenderParameters(SfxrParams parameters) {
251
275
RenderSlider(+0,+1,parameters.lpFilterResonance,(value =>parameters.lpFilterResonance=value),newGUIContent("Low-Pass Resonance","Changes the attenuation rate for the low-pass filter, changing the timbre (0 to 1)"));
252
276
RenderSlider(+0,+1,parameters.hpFilterCutoff,(value =>parameters.hpFilterCutoff=value),newGUIContent("High-Pass Cutoff","Frequency at which the high-pass filter starts attenuating lower frequencies (0 to 1)"));
253
277
RenderSlider(-1,+1,parameters.hpFilterCutoffSweep,(value =>parameters.hpFilterCutoffSweep=value),newGUIContent("High-Pass Cutoff Sweep","Sweeps the high-pass cutoff up or down (-1 to 1)"));
254
-
}
255
-
finally
256
-
{
257
-
if(EditorGUI.EndChangeCheck())
258
-
{
278
+
279
+
RenderHeading("Bit Crushing");
280
+
281
+
// BFXR
282
+
RenderSlider(+0,+1,parameters.bitCrush,(value =>parameters.bitCrush=value),newGUIContent("Bit Crush","Resamples the audio at a lower frequency (0 to 1)"));
283
+
RenderSlider(-1,+1,parameters.bitCrushSweep,(value =>parameters.bitCrushSweep=value),newGUIContent("Bit Crush Sweep","Sweeps the Bit Crush filter up or down (-1 to 1)"));
284
+
}finally{
285
+
if(EditorGUI.EndChangeCheck()){
259
286
parameters.paramsDirty=true;
260
287
mustPlaySound=true;
261
288
}
@@ -264,8 +291,7 @@ public bool RenderParameters(SfxrParams parameters) {
0 commit comments