Compare commits
91 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3eb6704f2f | |||
| cd24beb8a6 | |||
| fa287305eb | |||
| 3fb656b693 | |||
| f514993525 | |||
| 81787260c9 | |||
| f9ad396228 | |||
| 8976f2e359 | |||
| 187c3edaf6 | |||
| 02e85fb354 | |||
| 289834021f | |||
| 04fea4acb2 | |||
| 54739b0a75 | |||
| ea5520a729 | |||
| 0a19d8d308 | |||
| 4dbe3e23b7 | |||
| c43cfc3b69 | |||
| babd3d2052 | |||
| 9464839b4d | |||
| bcf7875414 | |||
| 732894a0fb | |||
| 146bf5a3c2 | |||
| b05bfde094 | |||
| 37d372b8f5 | |||
| c01fee3b73 | |||
| c907e735c6 | |||
| 7545e33d2f | |||
| ebf961449a | |||
| 45d6882527 | |||
| 2ec370ad61 | |||
| 63d5c4af8e | |||
| 9619fd574e | |||
| adeb42070d | |||
| d207d246bf | |||
| 4dd3a3b874 | |||
| 52b04a754c | |||
| c0efd152e8 | |||
| 9bda80d40d | |||
| 0e12995063 | |||
| 424ebafab5 | |||
| 73d4feb679 | |||
| 887b2a9205 | |||
| 927eb3e1ff | |||
| fd19f5befe | |||
| 382775d6ab | |||
| c41ee27069 | |||
| e5b395ffa5 | |||
| b55f76c855 | |||
| 28a8bd3c51 | |||
| 9adcd89cd5 | |||
| 14e6709c29 | |||
| 024626019d | |||
| c0d86d5753 | |||
| 175281537c | |||
|
|
abb26288c6 | ||
| f5c0d5bbfc | |||
| ff08db3e44 | |||
| 7431550d61 | |||
| 448910b8d7 | |||
| 991c4fbf8e | |||
| ced0aaa597 | |||
| 498247c793 | |||
| ad5c3808cd | |||
| c658dc6a50 | |||
|
|
100adec397 | ||
|
|
f4b793574d | ||
| d8c52575fb | |||
| 1b2945d9c4 | |||
| 1244bd60ed | |||
| b566b9e89e | |||
| 4a4d7f2a38 | |||
| f7848228a2 | |||
| 8c22315b15 | |||
| 718c982578 | |||
| be0f6a9f56 | |||
| 35874f5ca2 | |||
| a7fdfce094 | |||
| 5947c9a020 | |||
| 05408915b1 | |||
| 4635b5af0f | |||
| b362217d75 | |||
| cc48d49b5c | |||
| 391e54b993 | |||
| 49b6a92865 | |||
| fbe05367fa | |||
| eaf3080859 | |||
| 6ceec9ef85 | |||
| ac73711122 | |||
| 3cb0471027 | |||
| 38e7434730 | |||
| d8cd72809c |
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
77
ExampleFilters/README.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
Filters are simply XML files with the extension ".eff"
|
||||||
|
|
||||||
|
Place them in a folder called `System` within your recordings folder.
|
||||||
|
|
||||||
|
The format is:
|
||||||
|
|
||||||
|
<effect name="Filter Name">
|
||||||
|
<filter....>
|
||||||
|
[optional sub-components or filters]
|
||||||
|
</filter>
|
||||||
|
[<filter...>]
|
||||||
|
</effect>
|
||||||
|
|
||||||
|
Currently implemented filters:
|
||||||
|
|
||||||
|
<amplifier gain="1.0" />
|
||||||
|
|
||||||
|
Amplify (or attenuate) the sample by the given factor (1 = unity gain, 0 = silence, 2 = double, etc)
|
||||||
|
|
||||||
|
<lfo frequency="10" depth="0.2" />
|
||||||
|
|
||||||
|
Modulate the audio with a low-frequency oscillator. Specify the frequency and a factor of how much to modulate the audio signal. You can also specify an optional `phase="..."` (specified in radians) as an initial phase offset for the modulation.
|
||||||
|
|
||||||
|
<biquad type="..." fc="..." q="..." gain="..." />
|
||||||
|
|
||||||
|
A Biquad filter of the given type with a center frequency `fc` in Hz, a Q `q` and gain in Decibals of `gain`.
|
||||||
|
Valid types are:
|
||||||
|
|
||||||
|
* lowpass
|
||||||
|
* highpass
|
||||||
|
* bandpass
|
||||||
|
* notch
|
||||||
|
* peak
|
||||||
|
* lowshelf
|
||||||
|
* highshelf
|
||||||
|
|
||||||
|
<delay>
|
||||||
|
<delayline samples="..." gain="...">
|
||||||
|
[optional effects to apply to the delay line]
|
||||||
|
</delayline>
|
||||||
|
</delay>
|
||||||
|
|
||||||
|
A multi-tap delay line where each tap can have its own additional filters applied. The delay is given in samples and the gain as
|
||||||
|
a factor where 1.0 is unity gain.
|
||||||
|
|
||||||
|
<group name="Name">
|
||||||
|
effects in the group
|
||||||
|
</group>
|
||||||
|
|
||||||
|
Allows you to group effects together within a chain. Not of any real use yet (except that the outer wrapper of an effect chain is
|
||||||
|
actually an effect group) but may be used in the future.
|
||||||
|
|
||||||
|
|
||||||
|
An example: the "Ethereal Voice" - echoes starting off quiet and getting louder with a variable high-pass filter on the pre-echoes. Also
|
||||||
|
includes a notch filter at 140Hz to cut out a specific annoying hum generated by my computer fans.
|
||||||
|
|
||||||
|
<effect name="Ethereal Voice">
|
||||||
|
<biquad type="notch" fc="140" q="20" gain="-50" />
|
||||||
|
<amplifier gain="0.1" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="4000" gain="1.0">
|
||||||
|
<biquad type="highpass" fc="400" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="8000" gain="1.5">
|
||||||
|
<biquad type="highpass" fc="300" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="12000" gain="2.0">
|
||||||
|
<biquad type="highpass" fc="200" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="16000" gain="3.0">
|
||||||
|
<biquad type="highpass" fc="100" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="20000" gain="15.0" />
|
||||||
|
</delayline>
|
||||||
|
<biquad type="lowshelf" fc="1000" q="2.2" gain="-10" />
|
||||||
|
<amplifier gain="1.5" />
|
||||||
|
</effect>
|
||||||
7
ExampleFilters/alien.eff
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<effect name="Alien">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowpass" fc="10000" q="1" gain="-10" />
|
||||||
|
<lfo frequency="100" depth="0.5" />
|
||||||
|
</effect>
|
||||||
13
ExampleFilters/bigecho.eff
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<effect name="Big Echo">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="22000" gain="0.2" pan="-0.3">
|
||||||
|
<biquad type="highpass" fc="300" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="44000" gain="0.05" pan="0.3">
|
||||||
|
<biquad type="highpass" fc="600" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
</delayline>
|
||||||
|
</effect>
|
||||||
6
ExampleFilters/cuthum.eff
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<effect name="Cut Computer Hum">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowpass" fc="10000" q="1" gain="-10" />
|
||||||
|
</effect>
|
||||||
7
ExampleFilters/cuthumagc.eff
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<effect name="Cut Computer Hum (with AGC)">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowpass" fc="10000" q="1" gain="-10" />
|
||||||
|
<agc ceiling="0.666" limit="1" attack="0.1" decay="0.01" />
|
||||||
|
</effect>
|
||||||
23
ExampleFilters/ethereal.eff
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<effect name="Ethereal Voice">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<amplifier gain="0.1" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="2000" gain="1.0" pan="-0.3">
|
||||||
|
<biquad type="highpass" fc="400" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="4000" gain="1.1" pan="0.3">
|
||||||
|
<biquad type="highpass" fc="800" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="8000" gain="1.2" pan="-0.5">
|
||||||
|
<biquad type="highpass" fc="1000" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="10000" gain="1.3" pan="0.5">
|
||||||
|
<biquad type="highpass" fc="1500" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="12000" gain="15.0" pan="0" />
|
||||||
|
</delayline>
|
||||||
|
<biquad type="lowshelf" fc="2000" q="2.2" gain="-10" />
|
||||||
|
<amplifier gain="1.5" />
|
||||||
|
</effect>
|
||||||
2
ExampleFilters/flat.eff
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<effect name="Flat">
|
||||||
|
</effect>
|
||||||
18
ExampleFilters/largeroom.eff
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<effect name="Large Room (quiet)">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowpass" fc="10000" q="1" gain="-10" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="5500" gain="0.2" pan="-0.3">
|
||||||
|
<biquad type="highpass" fc="300" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="11000" gain="0.05" pan="0.3">
|
||||||
|
<biquad type="highpass" fc="600" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="16500" gain="0.01" pan="0.0">
|
||||||
|
<biquad type="highpass" fc="600" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
</delayline>
|
||||||
|
<amplifier gain="0.3" />
|
||||||
|
</effect>
|
||||||
18
ExampleFilters/largeroomloud.eff
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<effect name="Large Room (loud)">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowpass" fc="10000" q="1" gain="-10" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="5500" gain="0.2" pan="-0.3">
|
||||||
|
<biquad type="highpass" fc="300" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="11000" gain="0.05" pan="0.3">
|
||||||
|
<biquad type="highpass" fc="600" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
<delay samples="16500" gain="0.01" pan="0.0">
|
||||||
|
<biquad type="highpass" fc="600" q="1" gain="0" />
|
||||||
|
</delay>
|
||||||
|
</delayline>
|
||||||
|
<amplifier gain="0.9" />
|
||||||
|
</effect>
|
||||||
11
ExampleFilters/phone.eff
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<effect name="Telephone">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowshelf" fc="400" q="10" gain="-20" />
|
||||||
|
<biquad type="highshelf" fc="8000" q="10" gain="-20" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="100" gain="0.5" />
|
||||||
|
</delayline>
|
||||||
|
<amplifier gain="1.4" />
|
||||||
|
</effect>
|
||||||
14
ExampleFilters/radio.eff
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<effect name="Radio">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<amplifier gain="0.1" />
|
||||||
|
<biquad type="peak" fc="1000" q="10" gain="45" />
|
||||||
|
<lfo frequency="5000" depth="0.3" />
|
||||||
|
<clipping clip="0.3" />
|
||||||
|
<biquad type="highshelf" fc="8000" q="1" gain="-20" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="100" gain="0.7" />
|
||||||
|
<delay samples="200" gain="0.5" />
|
||||||
|
</delayline>
|
||||||
|
</effect>
|
||||||
13
ExampleFilters/robotic.eff
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<effect name="Robotic">
|
||||||
|
<biquad type="notch" fc="28" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="91" q="20" gain="-50" />
|
||||||
|
<biquad type="notch" fc="120" q="20" gain="-50" />
|
||||||
|
<biquad type="lowshelf" fc="100" q="2" gain="-20" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="400" gain="1" pan="-0.3" />
|
||||||
|
<delay samples="800" gain="1" pan="-0.3" />
|
||||||
|
<delay samples="1200" gain="1" pan="-0.3" />
|
||||||
|
<delay samples="1600" gain="1" pan="-0.3" />
|
||||||
|
<delay samples="2000" gain="1" pan="-0.3" />
|
||||||
|
</delayline>
|
||||||
|
</effect>
|
||||||
22
README.md
@@ -8,6 +8,7 @@ A system for easing the task of recording and editing audiobooks.
|
|||||||
* Zero editing
|
* Zero editing
|
||||||
* MP3 export
|
* MP3 export
|
||||||
* Chapter management
|
* Chapter management
|
||||||
|
* Audio effect chains (biquad, delay line, etc)
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
@@ -27,6 +28,7 @@ From here on much is controlled by key presses.
|
|||||||
* Press and hold "R" to record a new phrase - the screen flashes red while it's recording. The phrase is
|
* Press and hold "R" to record a new phrase - the screen flashes red while it's recording. The phrase is
|
||||||
appended to the currently selected chapter, or to the last chapter if none is selected.
|
appended to the currently selected chapter, or to the last chapter if none is selected.
|
||||||
* Press and hold "T" to record a new phrase that is the start of a new paragraph. This adds the "post paragraph" gap to the previous sentence. Otherwise it does the same as "R".
|
* Press and hold "T" to record a new phrase that is the start of a new paragraph. This adds the "post paragraph" gap to the previous sentence. Otherwise it does the same as "R".
|
||||||
|
* Press and hold "F" to record a "continuation" phrase. This sets the previous phrase's post-gap to be the "short" gap instead of the normal length gap.
|
||||||
* Press "D" to delete the last phrase you recorded.
|
* Press "D" to delete the last phrase you recorded.
|
||||||
* Press "E" to re-record the currently selected phrase.
|
* Press "E" to re-record the currently selected phrase.
|
||||||
|
|
||||||
@@ -51,17 +53,13 @@ edit the text of this ID to identify the recordings. You
|
|||||||
may, for instance, change it to have the same text as the
|
may, for instance, change it to have the same text as the
|
||||||
audio contains.
|
audio contains.
|
||||||
|
|
||||||
To help with this CMU Sphinx (US EN dictionary) is bundled
|
To help with this the Haven On-Demand online speech recognition
|
||||||
with the system and can be used to try and convert the
|
service is integrated with the system and can be used to try and convert the
|
||||||
audio into text. Right clicking on a recording brings
|
audio into text. Right clicking on a recording brings
|
||||||
up a menu which includes the option to try and convert
|
up a menu which includes the option to try and convert
|
||||||
the audio into text. The detected text is then used to
|
the audio into text. The detected text is then used to
|
||||||
replace the current recording ID / text.
|
replace the current recording ID / text.
|
||||||
|
|
||||||
It's far from perfect (especially for a British English
|
|
||||||
speaker), but it can help you to navigate your way around
|
|
||||||
a chapter.
|
|
||||||
|
|
||||||
File layout
|
File layout
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
@@ -71,3 +69,15 @@ files) is placed.
|
|||||||
|
|
||||||
When you export the book as MP3 a new folder "export" is created within the book's folder where the MP3 files are placed.
|
When you export the book as MP3 a new folder "export" is created within the book's folder where the MP3 files are placed.
|
||||||
MP3 files are all tagged with the book title, chapter title, chapter number and comment.
|
MP3 files are all tagged with the book title, chapter title, chapter number and comment.
|
||||||
|
|
||||||
|
|
||||||
|
Building
|
||||||
|
========
|
||||||
|
|
||||||
|
1. Check out this repo
|
||||||
|
2. Install `ant` and `default-jdk`
|
||||||
|
3. Install [git LFS support](https://help.github.com/articles/installing-git-large-file-storage/)
|
||||||
|
4. Pull the large files with `git lfs pull`
|
||||||
|
5. Build with `ant build`
|
||||||
|
6. Run with `java -jar ./AudiobookRecorder.jar`
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
debug="true"
|
debug="true"
|
||||||
debuglevel="lines,vars,source"
|
debuglevel="lines,vars,source"
|
||||||
encoding="UTF-8"
|
encoding="UTF-8"
|
||||||
bootclasspath="${bootclass.path}"
|
bootclasspath="/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar"
|
||||||
includeAntRuntime="false"
|
includeAntRuntime="false"
|
||||||
deprecation="true"
|
deprecation="true"
|
||||||
srcdir="src"
|
srcdir="src"
|
||||||
|
|||||||
BIN
deps/commons-codec-1.10.jar
LFS
vendored
Normal file
BIN
deps/commons-logging-1.2.jar
LFS
vendored
Normal file
BIN
deps/fluent-hc-4.5.6.jar
LFS
vendored
Normal file
BIN
deps/httpclient-4.5.6.jar
LFS
vendored
Normal file
BIN
deps/httpclient-cache-4.5.6.jar
LFS
vendored
Normal file
BIN
deps/httpclient-win-4.5.6.jar
LFS
vendored
Normal file
BIN
deps/httpcore-4.4.10.jar
LFS
vendored
Normal file
BIN
deps/httpmime-4.5.6.jar
LFS
vendored
Normal file
BIN
deps/jna-4.4.0.jar
LFS
vendored
Normal file
BIN
deps/jna-platform-4.4.0.jar
LFS
vendored
Normal file
BIN
deps/json-20180813.jar
LFS
vendored
Normal file
BIN
deps/mp3agic-0.9.1.jar
vendored
BIN
deps/sphinx4-core-5prealpha-SNAPSHOT.jar
vendored
BIN
deps/sphinx4-data-5prealpha-SNAPSHOT.jar
vendored
13
dist/linux/audiobookrecorder.desktop
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=AudiobookRecorder
|
||||||
|
GenericName=Audiobook Recorder
|
||||||
|
X-GNOME-FullName=AudiobookRecorder
|
||||||
|
Comment=Record audiobooks with ease
|
||||||
|
Keywords=audio
|
||||||
|
Exec=AudiobookRecorder
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
StartupNotify=true
|
||||||
|
Icon=AudiobookRecorder
|
||||||
|
Categories=AudioVideo;Audio;Recorder;
|
||||||
|
X-AppStream-Ignore=true
|
||||||
76
iircoeff
@@ -1,76 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use Math::Trig;
|
|
||||||
|
|
||||||
my $fs = 96000;
|
|
||||||
|
|
||||||
printCo(0, 20, 25, $fs);
|
|
||||||
printCo(20, 25, 31.5, $fs);
|
|
||||||
printCo(25, 31.5, 40, $fs);
|
|
||||||
printCo(31.5, 40, 50, $fs);
|
|
||||||
printCo(40, 50, 63, $fs);
|
|
||||||
printCo(50, 63, 80, $fs);
|
|
||||||
printCo(63, 80, 100, $fs);
|
|
||||||
printCo(80, 100, 125, $fs);
|
|
||||||
printCo(100, 125, 160, $fs);
|
|
||||||
printCo(125, 160, 200, $fs);
|
|
||||||
printCo(160, 200, 250, $fs);
|
|
||||||
printCo(200, 250, 315, $fs);
|
|
||||||
printCo(250, 315, 400, $fs);
|
|
||||||
printCo(315, 400, 500, $fs);
|
|
||||||
printCo(400, 500, 630, $fs);
|
|
||||||
printCo(500, 630, 800, $fs);
|
|
||||||
printCo(630, 800, 1000, $fs);
|
|
||||||
printCo(800, 1000, 1250, $fs);
|
|
||||||
printCo(1000, 1250, 1600, $fs);
|
|
||||||
printCo(1250, 1600, 2000, $fs);
|
|
||||||
printCo(1600, 2000, 2500, $fs);
|
|
||||||
printCo(2000, 2500, 3150, $fs);
|
|
||||||
printCo(2500, 3150, 4000, $fs);
|
|
||||||
printCo(3150, 4000, 5000, $fs);
|
|
||||||
printCo(4000, 5000, 6300, $fs);
|
|
||||||
printCo(5000, 6300, 8000, $fs);
|
|
||||||
printCo(6300, 8000, 10000, $fs);
|
|
||||||
printCo(8000, 10000, 12500, $fs);
|
|
||||||
printCo(10000, 12500, 16000, $fs);
|
|
||||||
printCo(12500, 16000, 20000, $fs);
|
|
||||||
printCo(16000, 20000, $fs / 2, $fs);
|
|
||||||
|
|
||||||
sub printCo($$$$) {
|
|
||||||
my $fl = shift;
|
|
||||||
my $f0 = shift;
|
|
||||||
my $fh = shift;
|
|
||||||
my $fs = shift;
|
|
||||||
|
|
||||||
my $f1 = $f0 - (($f0 - $fl) / 2);
|
|
||||||
my $f2 = $f0 + (($fh - $f0) / 2);
|
|
||||||
|
|
||||||
@coeff = coefficient($f0, $fs, $f1, $f2);
|
|
||||||
print "/* $f0 Hz */\n";
|
|
||||||
printf("new IIRCoefficients(%.10e, %.10e, %.10e),\n" , $coeff[1] * 2, $coeff[0] * 2, $coeff[2] * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub coefficient($$$$) {
|
|
||||||
my $f0 = shift;
|
|
||||||
my $fs = shift;
|
|
||||||
my $f1 = shift;
|
|
||||||
my $f2 = shift;
|
|
||||||
|
|
||||||
my $q = $f0 / ($f2 - $f1);
|
|
||||||
|
|
||||||
my $pi = 3.141592653;
|
|
||||||
|
|
||||||
my $theta0 = 2 * $pi * ($f0 / $fs);
|
|
||||||
|
|
||||||
my $thetaOverTwoQ = $theta0 / (2 * $q);
|
|
||||||
|
|
||||||
my $beta = 0.5 * ((1 - tan($thetaOverTwoQ)) / (1 + tan($thetaOverTwoQ)));
|
|
||||||
|
|
||||||
my $gamma = (0.5 + $beta) * cos($theta0);
|
|
||||||
|
|
||||||
my $alpha = (0.5 - $beta) / 2;
|
|
||||||
|
|
||||||
return ($alpha, $beta, $gamma);
|
|
||||||
}
|
|
||||||
|
|
||||||
133
iircoeff.c
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2002-2006 Felipe Rivera <liebremx at users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Coefficient stuff
|
||||||
|
*
|
||||||
|
* $Id: iir_cfs.c,v 1.2 2006/01/15 00:17:46 liebremx Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static const double band_f031[] =
|
||||||
|
{ 20,25,31.5,40,50,63,80,100,125,160,200,250,315,400,500,630,800,
|
||||||
|
1000,1250,1600,2000,2500,3150,4000,5000,6300,8000,10000,12500,16000,20000
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GAIN_F0 1.0
|
||||||
|
#define GAIN_F1 GAIN_F0 / M_SQRT2
|
||||||
|
|
||||||
|
#define SAMPLING_FREQ 44100.0
|
||||||
|
#define TETA(f) (2*M_PI*(double)f/sample_frequency)
|
||||||
|
#define TWOPOWER(value) (value * value)
|
||||||
|
|
||||||
|
#define BETA2(tf0, tf) \
|
||||||
|
(TWOPOWER(GAIN_F1)*TWOPOWER(cos(tf0)) \
|
||||||
|
- 2.0 * TWOPOWER(GAIN_F1) * cos(tf) * cos(tf0) \
|
||||||
|
+ TWOPOWER(GAIN_F1) \
|
||||||
|
- TWOPOWER(GAIN_F0) * TWOPOWER(sin(tf)))
|
||||||
|
#define BETA1(tf0, tf) \
|
||||||
|
(2.0 * TWOPOWER(GAIN_F1) * TWOPOWER(cos(tf)) \
|
||||||
|
+ TWOPOWER(GAIN_F1) * TWOPOWER(cos(tf0)) \
|
||||||
|
- 2.0 * TWOPOWER(GAIN_F1) * cos(tf) * cos(tf0) \
|
||||||
|
- TWOPOWER(GAIN_F1) + TWOPOWER(GAIN_F0) * TWOPOWER(sin(tf)))
|
||||||
|
#define BETA0(tf0, tf) \
|
||||||
|
(0.25 * TWOPOWER(GAIN_F1) * TWOPOWER(cos(tf0)) \
|
||||||
|
- 0.5 * TWOPOWER(GAIN_F1) * cos(tf) * cos(tf0) \
|
||||||
|
+ 0.25 * TWOPOWER(GAIN_F1) \
|
||||||
|
- 0.25 * TWOPOWER(GAIN_F0) * TWOPOWER(sin(tf)))
|
||||||
|
|
||||||
|
#define GAMMA(beta, tf0) ((0.5 + beta) * cos(tf0))
|
||||||
|
#define ALPHA(beta) ((0.5 - beta)/2.0)
|
||||||
|
|
||||||
|
/*************
|
||||||
|
* Functions *
|
||||||
|
*************/
|
||||||
|
|
||||||
|
/* Get the band_f031 at both sides of F0. These will be cut at -3dB */
|
||||||
|
static void find_f1_and_f2(double f0, double octave_percent, double *f1, double *f2)
|
||||||
|
{
|
||||||
|
double octave_factor = pow(2.0, octave_percent/2.0);
|
||||||
|
*f1 = f0/octave_factor;
|
||||||
|
*f2 = f0*octave_factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the quadratic root
|
||||||
|
* Always return the smallest root */
|
||||||
|
static int find_root(double a, double b, double c, double *x0) {
|
||||||
|
double k = c-((b*b)/(4.*a));
|
||||||
|
double h = -(b/(2.*a));
|
||||||
|
double x1 = 0.;
|
||||||
|
if (-(k/a) < 0.)
|
||||||
|
return -1;
|
||||||
|
*x0 = h - sqrt(-(k/a));
|
||||||
|
x1 = h + sqrt(-(k/a));
|
||||||
|
if (x1 < *x0)
|
||||||
|
*x0 = x1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void calc_coeffs(double sample_frequency)
|
||||||
|
{
|
||||||
|
int i, n;
|
||||||
|
double f1, f2;
|
||||||
|
double x0;
|
||||||
|
|
||||||
|
printf(" public final static IIRCoefficients iir_cf31_%d[] = {\n", (int)sample_frequency);
|
||||||
|
for (i = 0; i < 31; i++) {
|
||||||
|
|
||||||
|
/* Find -3dB frequencies for the center freq */
|
||||||
|
find_f1_and_f2(band_f031[i], 1.0/3.0, &f1, &f2);
|
||||||
|
/* Find Beta */
|
||||||
|
if ( find_root(
|
||||||
|
BETA2(TETA(band_f031[i]), TETA(f1)),
|
||||||
|
BETA1(TETA(band_f031[i]), TETA(f1)),
|
||||||
|
BETA0(TETA(band_f031[i]), TETA(f1)),
|
||||||
|
&x0) == 0)
|
||||||
|
{
|
||||||
|
/* Got a solution, now calculate the rest of the factors */
|
||||||
|
/* Take the smallest root always (find_root returns the smallest one)
|
||||||
|
*
|
||||||
|
* NOTE: The IIR equation is
|
||||||
|
* y[n] = 2 * (alpha*(x[n]-x[n-2]) + gamma*y[n-1] - beta*y[n-2])
|
||||||
|
* Now the 2 factor has been distributed in the coefficients
|
||||||
|
*/
|
||||||
|
/* Now store the coefficients */
|
||||||
|
printf(" /* %.1f Hz */\n", band_f031[i]);
|
||||||
|
printf(" new IIRCoefficients(%.10e, %010e, %.10e),\n",
|
||||||
|
(double)(2.0 * x0),
|
||||||
|
(double)(2.0 * ALPHA(x0)),
|
||||||
|
(double)(2.0 * GAMMA(x0, TETA(band_f031[i])))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
printf(" **** Where are the roots?\n");
|
||||||
|
}
|
||||||
|
}// for i
|
||||||
|
printf(" };\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("Usage: iircoeff <sample frequency>\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
double f = strtod(argv[1], NULL);
|
||||||
|
calc_coeffs(f);
|
||||||
|
}
|
||||||
76
iircoeff.pl
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use Math::Trig;
|
||||||
|
|
||||||
|
my $fs = 48000;
|
||||||
|
my $q = 1.414;
|
||||||
|
|
||||||
|
printCo(20, $fs, $q);
|
||||||
|
printCo(25, $fs, $q);
|
||||||
|
printCo(31.5, $fs, $q);
|
||||||
|
printCo(40, $fs, $q);
|
||||||
|
printCo(50, $fs, $q);
|
||||||
|
printCo(63, $fs, $q);
|
||||||
|
printCo(80, $fs, $q);
|
||||||
|
printCo(100, $fs, $q);
|
||||||
|
printCo(125, $fs, $q);
|
||||||
|
printCo(160, $fs, $q);
|
||||||
|
printCo(200, $fs, $q);
|
||||||
|
printCo(250, $fs, $q);
|
||||||
|
printCo(315, $fs, $q);
|
||||||
|
printCo(400, $fs, $q);
|
||||||
|
printCo(500, $fs, $q);
|
||||||
|
printCo(630, $fs, $q);
|
||||||
|
printCo(800, $fs, $q);
|
||||||
|
printCo(1000, $fs, $q);
|
||||||
|
printCo(1250, $fs, $q);
|
||||||
|
printCo(1600, $fs, $q);
|
||||||
|
printCo(2000, $fs, $q);
|
||||||
|
printCo(2500, $fs, $q);
|
||||||
|
printCo(3150, $fs, $q);
|
||||||
|
printCo(4000, $fs, $q);
|
||||||
|
printCo(5000, $fs, $q);
|
||||||
|
printCo(6300, $fs, $q);
|
||||||
|
printCo(8000, $fs, $q);
|
||||||
|
printCo(10000, $fs, $q);
|
||||||
|
printCo(12500, $fs, $q);
|
||||||
|
printCo(16000, $fs, $q);
|
||||||
|
printCo(20000, $fs, $q);
|
||||||
|
|
||||||
|
sub printCo($$$$) {
|
||||||
|
my $f0 = shift;
|
||||||
|
my $fs = shift;
|
||||||
|
my $q = shift;
|
||||||
|
|
||||||
|
|
||||||
|
@coeff = coefficient($f0, $fs, $q);
|
||||||
|
print "/* $f0 Hz */\n";
|
||||||
|
printf("new IIRCoefficients(%.10e, %.10e, %.10e),\n" , $coeff[1] * 2, $coeff[0] * 2, $coeff[2] * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub coefficient($$$$) {
|
||||||
|
my $f0 = shift;
|
||||||
|
my $fs = shift;
|
||||||
|
my $q = shift;
|
||||||
|
|
||||||
|
my $q2 = $q * $q;
|
||||||
|
|
||||||
|
my $f1 = $f0 * (sqrt(1 + (1 / (4 * $q2))) - (1 / (2 * $q)));
|
||||||
|
my $f2 = $f0 * (sqrt(1 + (1 / (4 * $q2))) + (1 / (2 * $q)));
|
||||||
|
|
||||||
|
my $pi = 3.141592653;
|
||||||
|
|
||||||
|
my $theta0 = 2 * $pi * ($f0 / $fs);
|
||||||
|
|
||||||
|
my $thetaOverTwoQ = $theta0 / (2 * $q);
|
||||||
|
|
||||||
|
my $beta = 0.5 * ((1 - tan($thetaOverTwoQ)) / (1 + tan($thetaOverTwoQ)));
|
||||||
|
|
||||||
|
my $gamma = (0.5 + $beta) * cos($theta0);
|
||||||
|
|
||||||
|
my $alpha = (0.5 - $beta) / 2;
|
||||||
|
|
||||||
|
return ($alpha, $beta, $gamma);
|
||||||
|
}
|
||||||
|
|
||||||
558
licenses/apache-commons/LICENSE.txt
Normal file
@@ -0,0 +1,558 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
=========================================================================
|
||||||
|
|
||||||
|
This project includes Public Suffix List copied from
|
||||||
|
<https://publicsuffix.org/list/effective_tld_names.dat>
|
||||||
|
licensed under the terms of the Mozilla Public License, v. 2.0
|
||||||
|
|
||||||
|
Full license text: <http://mozilla.org/MPL/2.0/>
|
||||||
|
|
||||||
|
Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
1.1. "Contributor"
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
6
licenses/apache-commons/NOTICE.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Apache HttpComponents Client
|
||||||
|
Copyright 1999-2018 The Apache Software Foundation
|
||||||
|
|
||||||
|
This product includes software developed at
|
||||||
|
The Apache Software Foundation (http://www.apache.org/).
|
||||||
|
|
||||||
77
licenses/apache-commons/README.txt
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
Apache HttpComponents Client
|
||||||
|
============================
|
||||||
|
|
||||||
|
Welcome to the HttpClient component of the Apache HttpComponents project.
|
||||||
|
|
||||||
|
Building Instructions
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
For building from source instructions please refer to BUILDING.txt.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
HttpClient main module requires Java 6 compatible runtime and
|
||||||
|
depends on the following external libraries:
|
||||||
|
|
||||||
|
* Apache HttpComponents HttpCore
|
||||||
|
* Apache Commons Logging
|
||||||
|
* Apache Commons Codec
|
||||||
|
|
||||||
|
(for detailed information on external dependencies please see pom.xml)
|
||||||
|
|
||||||
|
HttpMime module is optional and requires Java 6 compatible runtime
|
||||||
|
and depends on the following external libraries:
|
||||||
|
|
||||||
|
* Apache HttpComponents HttpCore
|
||||||
|
* Apache Commons Logging
|
||||||
|
|
||||||
|
(for detailed information on external dependencies please see pom.xml)
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
---------
|
||||||
|
|
||||||
|
Apache HttpComponents Client is licensed under the Apache License 2.0.
|
||||||
|
See the files called LICENSE.txt and NOTICE.txt for more information.
|
||||||
|
|
||||||
|
Cryptographic Software Notice
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
This distribution may include software that has been designed for use
|
||||||
|
with cryptographic software. The country in which you currently reside
|
||||||
|
may have restrictions on the import, possession, use, and/or re-export
|
||||||
|
to another country, of encryption software. BEFORE using any encryption
|
||||||
|
software, please check your country's laws, regulations and policies
|
||||||
|
concerning the import, possession, or use, and re-export of encryption
|
||||||
|
software, to see if this is permitted. See <http://www.wassenaar.org/>
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
The U.S. Government Department of Commerce, Bureau of Industry and
|
||||||
|
Security (BIS), has classified this software as Export Commodity
|
||||||
|
Control Number (ECCN) 5D002.C.1, which includes information security
|
||||||
|
software using or performing cryptographic functions with asymmetric
|
||||||
|
algorithms. The form and manner of this Apache Software Foundation
|
||||||
|
distribution makes it eligible for export under the License Exception
|
||||||
|
ENC Technology Software Unrestricted (TSU) exception (see the BIS
|
||||||
|
Export Administration Regulations, Section 740.13) for both object
|
||||||
|
code and source code.
|
||||||
|
|
||||||
|
The following provides more details on the included software that
|
||||||
|
may be subject to export controls on cryptographic software:
|
||||||
|
|
||||||
|
Apache HttpComponents Client interfaces with the
|
||||||
|
Java Secure Socket Extension (JSSE) API to provide
|
||||||
|
|
||||||
|
- HTTPS support
|
||||||
|
|
||||||
|
Apache HttpComponents Client does not include any
|
||||||
|
implementation of JSSE.
|
||||||
|
|
||||||
|
Contact
|
||||||
|
-------
|
||||||
|
|
||||||
|
o For general information visit the main project site at
|
||||||
|
http://hc.apache.org/
|
||||||
|
|
||||||
|
o For current status information visit the status page at
|
||||||
|
http://hc.apache.org/status.html
|
||||||
2354
licenses/apache-commons/RELEASE_NOTES.txt
Normal file
504
licenses/jeq/lgpl.txt
Normal file
@@ -0,0 +1,504 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
||||||
|
|
||||||
@@ -1 +1 @@
|
|||||||
version=0.0.9
|
version=0.2.0
|
||||||
|
|||||||
BIN
resources/uk/co/majenko/audiobookrecorder/icons/attention.png
Normal file
|
After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 838 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 263 B |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/cut.png
Normal file
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/do-cut.png
Normal file
|
After Width: | Height: | Size: 576 B |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/dollar.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 592 B After Width: | Height: | Size: 1.2 KiB |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/normalize.png
Normal file
|
After Width: | Height: | Size: 473 B |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/play-to.png
Normal file
|
After Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 710 B |
BIN
resources/uk/co/majenko/audiobookrecorder/icons/split.png
Normal file
|
After Width: | Height: | Size: 409 B |
BIN
resources/uk/co/majenko/audiobookrecorder/overlays/attention.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
resources/uk/co/majenko/audiobookrecorder/overlays/filter.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
resources/uk/co/majenko/audiobookrecorder/overlays/important.png
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
resources/uk/co/majenko/audiobookrecorder/overlays/locked.png
Normal file
|
After Width: | Height: | Size: 256 B |
BIN
resources/uk/co/majenko/audiobookrecorder/overlays/star.png
Normal file
|
After Width: | Height: | Size: 301 B |
@@ -795,7 +795,7 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getControlTextFont() {
|
public FontUIResource getControlTextFont() {
|
||||||
if (controlFont == null) {
|
if (controlFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
controlFont = new FontUIResource(DIALOG, Font.BOLD, 14);
|
controlFont = new FontUIResource(DIALOG, Font.PLAIN, 14); // bold
|
||||||
} else {
|
} else {
|
||||||
controlFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
controlFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
||||||
}
|
}
|
||||||
@@ -806,7 +806,7 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getSystemTextFont() {
|
public FontUIResource getSystemTextFont() {
|
||||||
if (systemFont == null) {
|
if (systemFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
systemFont = new FontUIResource(DIALOG, Font.BOLD, 14);
|
systemFont = new FontUIResource(DIALOG, Font.PLAIN, 14); // bold
|
||||||
} else {
|
} else {
|
||||||
systemFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
systemFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getUserTextFont() {
|
public FontUIResource getUserTextFont() {
|
||||||
if (userFont == null) {
|
if (userFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
userFont = new FontUIResource(DIALOG, Font.BOLD, 14);
|
userFont = new FontUIResource(DIALOG, Font.PLAIN, 14); // bold
|
||||||
} else {
|
} else {
|
||||||
userFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
userFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
||||||
}
|
}
|
||||||
@@ -828,7 +828,7 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getMenuTextFont() {
|
public FontUIResource getMenuTextFont() {
|
||||||
if (menuFont == null) {
|
if (menuFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
menuFont = new FontUIResource(DIALOG, Font.BOLD, 14);
|
menuFont = new FontUIResource(DIALOG, Font.PLAIN, 14); // bold
|
||||||
} else {
|
} else {
|
||||||
menuFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
menuFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
|
||||||
}
|
}
|
||||||
@@ -839,9 +839,9 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getWindowTitleFont() {
|
public FontUIResource getWindowTitleFont() {
|
||||||
if (windowTitleFont == null) {
|
if (windowTitleFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
windowTitleFont = new FontUIResource(DIALOG, Font.BOLD, 14);
|
windowTitleFont = new FontUIResource(DIALOG, Font.PLAIN, 14); // bold
|
||||||
} else {
|
} else {
|
||||||
windowTitleFont = new FontUIResource(DIALOG, Font.BOLD, 12);
|
windowTitleFont = new FontUIResource(DIALOG, Font.PLAIN, 12); // bold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return windowTitleFont;
|
return windowTitleFont;
|
||||||
@@ -850,7 +850,7 @@ public abstract class AbstractTheme extends MetalTheme {
|
|||||||
public FontUIResource getSubTextFont() {
|
public FontUIResource getSubTextFont() {
|
||||||
if (smallFont == null) {
|
if (smallFont == null) {
|
||||||
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
if (JTattooUtilities.isLinux() && JTattooUtilities.isHiresScreen()) {
|
||||||
smallFont = new FontUIResource(DIALOG, Font.BOLD, 12);
|
smallFont = new FontUIResource(DIALOG, Font.PLAIN, 12); // bold
|
||||||
} else {
|
} else {
|
||||||
smallFont = new FontUIResource(DIALOG, Font.PLAIN, 10);
|
smallFont = new FontUIResource(DIALOG, Font.PLAIN, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,11 +125,11 @@ public class HiFiDefaultTheme extends AbstractTheme {
|
|||||||
tooltipForegroundColor = white;
|
tooltipForegroundColor = white;
|
||||||
tooltipBackgroundColor = new ColorUIResource(24, 24, 24);
|
tooltipBackgroundColor = new ColorUIResource(24, 24, 24);
|
||||||
|
|
||||||
controlFont = new FontUIResource("Dialog", Font.BOLD, 12);
|
controlFont = new FontUIResource("Dialog", Font.PLAIN, 12); // bold
|
||||||
systemFont = new FontUIResource("Dialog", Font.BOLD, 12);
|
systemFont = new FontUIResource("Dialog", Font.PLAIN, 12); // bold
|
||||||
userFont = new FontUIResource("Dialog", Font.BOLD, 12);
|
userFont = new FontUIResource("Dialog", Font.PLAIN, 12); // bold
|
||||||
menuFont = new FontUIResource("Dialog", Font.BOLD, 12);
|
menuFont = new FontUIResource("Dialog", Font.PLAIN, 12); // bold
|
||||||
windowTitleFont = new FontUIResource("Dialog", Font.BOLD, 12);
|
windowTitleFont = new FontUIResource("Dialog", Font.PLAIN, 12); // bold
|
||||||
smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
|
smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,18 +42,18 @@ public class HiFiLookAndFeel extends AbstractLookAndFeel {
|
|||||||
private static final Properties giantFontProps = new Properties();
|
private static final Properties giantFontProps = new Properties();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
smallFontProps.setProperty("controlTextFont", "Dialog bold 10");
|
smallFontProps.setProperty("controlTextFont", "Dialog 10"); // bold
|
||||||
smallFontProps.setProperty("systemTextFont", "Dialog bold 10");
|
smallFontProps.setProperty("systemTextFont", "Dialog 10"); // bold
|
||||||
smallFontProps.setProperty("userTextFont", "Dialog 10");
|
smallFontProps.setProperty("userTextFont", "Dialog 10");
|
||||||
smallFontProps.setProperty("menuTextFont", "Dialog bold 10");
|
smallFontProps.setProperty("menuTextFont", "Dialog 10"); // bold
|
||||||
smallFontProps.setProperty("windowTitleFont", "Dialog bold 10");
|
smallFontProps.setProperty("windowTitleFont", "Dialog 10"); // bold
|
||||||
smallFontProps.setProperty("subTextFont", "Dialog 8");
|
smallFontProps.setProperty("subTextFont", "Dialog 8");
|
||||||
|
|
||||||
largeFontProps.setProperty("controlTextFont", "Dialog bold 14");
|
largeFontProps.setProperty("controlTextFont", "Dialog 14"); // bold
|
||||||
largeFontProps.setProperty("systemTextFont", "Dialog bold 14");
|
largeFontProps.setProperty("systemTextFont", "Dialog 14"); // bold
|
||||||
largeFontProps.setProperty("userTextFont", "Dialog bold 14");
|
largeFontProps.setProperty("userTextFont", "Dialog 14"); // bold
|
||||||
largeFontProps.setProperty("menuTextFont", "Dialog bold 14");
|
largeFontProps.setProperty("menuTextFont", "Dialog 14"); // bold
|
||||||
largeFontProps.setProperty("windowTitleFont", "Dialog bold 14");
|
largeFontProps.setProperty("windowTitleFont", "Dialog 14"); // bold
|
||||||
largeFontProps.setProperty("subTextFont", "Dialog 12");
|
largeFontProps.setProperty("subTextFont", "Dialog 12");
|
||||||
|
|
||||||
giantFontProps.setProperty("controlTextFont", "Dialog 18");
|
giantFontProps.setProperty("controlTextFont", "Dialog 18");
|
||||||
|
|||||||
@@ -1,484 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The EqualizerInputStream class
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class EqualizerInputStream extends InputStream {
|
|
||||||
private InputStream stream;
|
|
||||||
private IIR iir;
|
|
||||||
|
|
||||||
private final static int BUFFER_SIZE = 65536;
|
|
||||||
private byte[] inbuf = new byte[BUFFER_SIZE];
|
|
||||||
private int[] workbuf = new int[BUFFER_SIZE];
|
|
||||||
private byte[] outbuf = new byte[BUFFER_SIZE];
|
|
||||||
private int inpos = 0;
|
|
||||||
private int inlen = 0;
|
|
||||||
private int outpos = 0;
|
|
||||||
private int outlen = 0;
|
|
||||||
|
|
||||||
private boolean signed;
|
|
||||||
private int samplesize;
|
|
||||||
private boolean bigendian;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs new EqualizerInputStream object
|
|
||||||
*
|
|
||||||
* @param stream is an input stream for pcm data
|
|
||||||
* @param samplerate is a sample rate of input data
|
|
||||||
* @param channels is the number of channels
|
|
||||||
* @param signed indicates that the data is signed
|
|
||||||
* @param samplesize is the sample bit size of data
|
|
||||||
* @param bigendian indicates that the dat is in "big endian" encoding
|
|
||||||
* @param bands is the number of bands
|
|
||||||
*/
|
|
||||||
public EqualizerInputStream(InputStream stream, float samplerate, int channels, boolean signed, int samplesize, boolean bigendian, int bands) {
|
|
||||||
this.stream = stream;
|
|
||||||
this.iir = new IIR(bands, samplerate, channels);
|
|
||||||
this.signed = signed;
|
|
||||||
this.samplesize = samplesize;
|
|
||||||
this.bigendian = bigendian;
|
|
||||||
|
|
||||||
if (!isParamsSupported(samplerate, channels, samplesize, bands))
|
|
||||||
throw new IllegalArgumentException("Unsupported sample bit size");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Controls of equalizer
|
|
||||||
*
|
|
||||||
* @return Controls of equalizer
|
|
||||||
*/
|
|
||||||
public IIRControls getControls() {
|
|
||||||
return iir.getControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is special method for checking of supported parameters of equalizer
|
|
||||||
*
|
|
||||||
* @param bands is the number of bands
|
|
||||||
* @param samplerate is the sample rate of data
|
|
||||||
* @param channels is the number of channels
|
|
||||||
* @param samplesize is the size of sample in bits
|
|
||||||
* @return true if parameters are supported
|
|
||||||
*/
|
|
||||||
public static boolean isParamsSupported(float samplerate, int channels, int samplesize, int bands) {
|
|
||||||
switch (samplesize) {
|
|
||||||
case 8:
|
|
||||||
case 16:
|
|
||||||
case 24:
|
|
||||||
case 32:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IIR.isParamsSupported(bands, samplerate, channels);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean fillInBuffer() throws IOException {
|
|
||||||
if (inpos != 0 && inlen > 0)
|
|
||||||
System.arraycopy(inbuf, inpos, inbuf, 0, inlen);
|
|
||||||
inpos = 0;
|
|
||||||
int num;
|
|
||||||
boolean eof = false;
|
|
||||||
while (inlen != inbuf.length) {
|
|
||||||
num = stream.read(inbuf, inlen, inbuf.length - inlen);
|
|
||||||
if (num < 0) {
|
|
||||||
eof = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
inlen += num;
|
|
||||||
}
|
|
||||||
return eof;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillOutBuffer() {
|
|
||||||
if (outpos != 0 && outlen > 0)
|
|
||||||
System.arraycopy(outbuf, outpos, outbuf, 0, outlen);
|
|
||||||
outpos = 0;
|
|
||||||
int len = outbuf.length - outlen;
|
|
||||||
len = inlen < len ? inlen : len;
|
|
||||||
len = convertToInt(len);
|
|
||||||
if (len > 0) {
|
|
||||||
iir.iir(workbuf, len);
|
|
||||||
len = convertToByte(outbuf, outlen, len);
|
|
||||||
outlen += len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int convertToInt(int length) {
|
|
||||||
int l = length;
|
|
||||||
int temp;
|
|
||||||
byte a1[];
|
|
||||||
switch (samplesize) {
|
|
||||||
case 8: {
|
|
||||||
if (length > 0) {
|
|
||||||
System.arraycopy(inbuf, 0, workbuf, 0, length);
|
|
||||||
inpos += length;
|
|
||||||
inlen -= length;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 16: {
|
|
||||||
l = length >> 1;
|
|
||||||
if (l > 0) {
|
|
||||||
if (bigendian)
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = (((a1 = inbuf)[inpos++] & 0xff) << 8) | (a1[inpos++] & 0xff);
|
|
||||||
workbuf[i] = signed && temp > 32767 ? temp - 65536 : temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = ((a1 = inbuf)[inpos++] & 0xff) | ((a1[inpos++] & 0xff) << 8);
|
|
||||||
workbuf[i] = signed && temp > 32767 ? temp - 65536 : temp;
|
|
||||||
}
|
|
||||||
inlen -= inpos;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 24: {
|
|
||||||
l = length / 3;
|
|
||||||
if (l > 0) {
|
|
||||||
if (bigendian)
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = ((a1 = inbuf)[inpos++] & 0xff) | ((a1[inpos++] & 0xff) << 8) | ((a1[inpos++] & 0xff) << 16);
|
|
||||||
workbuf[i] = signed && temp > 8388607 ? temp - 16777216 : temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = (((a1 = inbuf)[inpos++] & 0xff) << 16) | ((a1[inpos++] & 0xff) << 8) | (a1[inpos++] & 0xff);
|
|
||||||
workbuf[i] = signed && temp > 8388607 ? temp - 16777216 : temp;
|
|
||||||
}
|
|
||||||
inlen -= inpos;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 32: {
|
|
||||||
l = length / 4;
|
|
||||||
if (l > 0) {
|
|
||||||
if (bigendian)
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = ((a1 = inbuf)[inpos++] & 0xff) | ((a1[inpos++] & 0xff) << 8) | ((a1[inpos++] & 0xff) << 16) | ((a1[inpos++] & 0xff) << 24);
|
|
||||||
workbuf[i] = temp; //signed && temp > 8388607 ? temp - 16777216 : temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (int i = 0; i < l; i++) {
|
|
||||||
temp = (((a1 = inbuf)[inpos++] & 0xff) << 24) | ((a1[inpos++] & 0xff) << 16) | ((a1[inpos++] & 0xff) << 8) | (a1[inpos++] & 0xff);
|
|
||||||
workbuf[i] = temp; //signed && temp > 8388607 ? temp - 16777216 : temp;
|
|
||||||
}
|
|
||||||
inlen -= inpos;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int wrap8Bit(int data) {
|
|
||||||
if (data > 127)
|
|
||||||
data = 127;
|
|
||||||
else if (data < -128)
|
|
||||||
data = -128;
|
|
||||||
if (data < 0)
|
|
||||||
data += 256;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int wrap16Bit(int data) {
|
|
||||||
if (data > 32767)
|
|
||||||
data = 32767;
|
|
||||||
else if (data < -32768)
|
|
||||||
data = -32768;
|
|
||||||
if (data < 0)
|
|
||||||
data += 65536;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int wrap24Bit(int data) {
|
|
||||||
if (data > 8388607)
|
|
||||||
data = 8388607;
|
|
||||||
else if (data < -8388608)
|
|
||||||
data = -8388608;
|
|
||||||
if (data < 0)
|
|
||||||
data += 16777216;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int convertToByte(byte[] b, int off, int length) {
|
|
||||||
int p = off;
|
|
||||||
int d;
|
|
||||||
switch (samplesize) {
|
|
||||||
case 8: {
|
|
||||||
for (int i = 0; i < length; i++)
|
|
||||||
b[p++] = (byte) (wrap8Bit(workbuf[i]) & 0xff);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 16: {
|
|
||||||
if (bigendian) {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = wrap16Bit(workbuf[i]);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = wrap16Bit(workbuf[i]);
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 24: {
|
|
||||||
if (bigendian) {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = wrap24Bit(workbuf[i]);
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
b[p++] = (byte) ((d & 0xff0000) >> 16);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = wrap24Bit(workbuf[i]);
|
|
||||||
b[p++] = (byte) ((d & 0xff0000) >> 16);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 32: {
|
|
||||||
if (bigendian) {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = workbuf[i];
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
b[p++] = (byte) ((d & 0xff0000) >> 16);
|
|
||||||
b[p++] = (byte) ((d & 0xff000000) >> 24);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
d = wrap24Bit(workbuf[i]);
|
|
||||||
b[p++] = (byte) ((d & 0xff000000) >> 24);
|
|
||||||
b[p++] = (byte) ((d & 0xff0000) >> 16);
|
|
||||||
b[p++] = (byte) ((d & 0xff00) >> 8);
|
|
||||||
b[p++] = (byte) (d & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return p - off;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of bytes that can be read (or skipped over) from
|
|
||||||
* this input stream without blocking by the next caller of a method for
|
|
||||||
* this input stream. The next caller might be the same thread or
|
|
||||||
* another thread.
|
|
||||||
*
|
|
||||||
* @return the number of bytes that can be read from this input stream
|
|
||||||
* without blocking.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public int available() throws IOException {
|
|
||||||
return outlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes this input stream and releases any system resources associated
|
|
||||||
* with the stream.
|
|
||||||
*
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public void close() throws IOException {
|
|
||||||
stream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> The <code>mark</code> method of <code>EqualizerInputStream</code> does
|
|
||||||
* nothing.
|
|
||||||
*
|
|
||||||
* @param readlimit the maximum limit of bytes that can be read before
|
|
||||||
* the mark position becomes invalid.
|
|
||||||
*/
|
|
||||||
public synchronized void mark(int readlimit) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests if this input stream supports the <code>mark</code> and
|
|
||||||
* <code>reset</code> methods. Whether or not <code>mark</code> and
|
|
||||||
* <code>reset</code> are supported is an invariant property of a
|
|
||||||
* particular input stream instance. The <code>markSupported</code> method
|
|
||||||
* of <code>EqualizerInputStream</code> returns <code>false</code>.
|
|
||||||
*
|
|
||||||
* @return false
|
|
||||||
*/
|
|
||||||
public boolean markSupported() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the next byte of data from the input stream. The value byte is
|
|
||||||
* returned as an <code>int</code> in the range <code>0</code> to
|
|
||||||
* <code>255</code>. If no byte is available because the end of the stream
|
|
||||||
* has been reached, the value <code>-1</code> is returned. This method
|
|
||||||
* blocks until input data is available, the end of the stream is detected,
|
|
||||||
* or an exception is thrown.
|
|
||||||
*
|
|
||||||
* @return the next byte of data, or <code>-1</code> if the end of the
|
|
||||||
* stream is reached.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public int read() throws IOException {
|
|
||||||
if (outlen == 0) {
|
|
||||||
boolean eof = fillInBuffer();
|
|
||||||
fillOutBuffer();
|
|
||||||
if (outlen == 0 && eof)
|
|
||||||
return -1;
|
|
||||||
if (outlen == 0 && !eof)
|
|
||||||
throw new IOException("Impossible state");
|
|
||||||
}
|
|
||||||
int b = outbuf[outpos++];
|
|
||||||
outlen--;
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads up to <code>len</code> bytes of data from the input stream into
|
|
||||||
* an array of bytes. An attempt is made to read as many as
|
|
||||||
* <code>len</code> bytes, but a smaller number may be read.
|
|
||||||
* The number of bytes actually read is returned as an integer.
|
|
||||||
* <p/>
|
|
||||||
* <p> This method blocks until input data is available, end of file is
|
|
||||||
* detected, or an exception is thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>b</code> is <code>null</code>, a
|
|
||||||
* <code>NullPointerException</code> is thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>off</code> is negative, or <code>len</code> is negative, or
|
|
||||||
* <code>off+len</code> is greater than the length of the array
|
|
||||||
* <code>b</code>, then an <code>IndexOutOfBoundsException</code> is
|
|
||||||
* thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>len</code> is zero, then no bytes are read and
|
|
||||||
* <code>0</code> is returned; otherwise, there is an attempt to read at
|
|
||||||
* least one byte. If no byte is available because the stream is at end of
|
|
||||||
* file, the value <code>-1</code> is returned; otherwise, at least one
|
|
||||||
* byte is read and stored into <code>b</code>.
|
|
||||||
* <p/>
|
|
||||||
* <p> The first byte read is stored into element <code>b[off]</code>, the
|
|
||||||
* next one into <code>b[off+1]</code>, and so on. The number of bytes read
|
|
||||||
* is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
|
|
||||||
* bytes actually read; these bytes will be stored in elements
|
|
||||||
* <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
|
|
||||||
* leaving elements <code>b[off+</code><i>k</i><code>]</code> through
|
|
||||||
* <code>b[off+len-1]</code> unaffected.
|
|
||||||
* <p/>
|
|
||||||
* <p> In every case, elements <code>b[0]</code> through
|
|
||||||
* <code>b[off]</code> and elements <code>b[off+len]</code> through
|
|
||||||
* <code>b[b.length-1]</code> are unaffected.
|
|
||||||
* <p/>
|
|
||||||
* <p> If the first byte cannot be read for any reason other than end of
|
|
||||||
* file, then an <code>IOException</code> is thrown. In particular, an
|
|
||||||
* <code>IOException</code> is thrown if the input stream has been closed.
|
|
||||||
*
|
|
||||||
* @param b the buffer into which the data is read.
|
|
||||||
* @param off the start offset in array <code>b</code>
|
|
||||||
* at which the data is written.
|
|
||||||
* @param len the maximum number of bytes to read.
|
|
||||||
* @return the total number of bytes read into the buffer, or
|
|
||||||
* <code>-1</code> if there is no more data because the end of
|
|
||||||
* the stream has been reached.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
* @throws NullPointerException if <code>b</code> is <code>null</code>.
|
|
||||||
*/
|
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
|
||||||
if (outlen < len) {
|
|
||||||
boolean eof = fillInBuffer();
|
|
||||||
fillOutBuffer();
|
|
||||||
if (outlen == 0 && eof)
|
|
||||||
return -1;
|
|
||||||
if (outlen == 0 && !eof)
|
|
||||||
throw new IOException("Impossible state");
|
|
||||||
}
|
|
||||||
len = outlen < len ? outlen : len;
|
|
||||||
if (len > 0) {
|
|
||||||
System.arraycopy(outbuf, outpos, b, off, len);
|
|
||||||
outpos += len;
|
|
||||||
outlen -= len;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>The method <code>reset</code> for class <code>EqualizerInputStream</code>
|
|
||||||
* does nothing except throw an <code>IOException</code>.
|
|
||||||
*
|
|
||||||
* @throws IOException as an indication that the mark feature doesn't supported by EqualizerInputStream.
|
|
||||||
*/
|
|
||||||
public void reset() throws IOException {
|
|
||||||
throw new IOException("mark/reset not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skips over and discards <code>n</code> bytes of data from this input
|
|
||||||
* stream. The <code>skip</code> method may, for a variety of reasons, end
|
|
||||||
* up skipping over some smaller number of bytes, possibly <code>0</code>.
|
|
||||||
* This may result from any of a number of conditions; reaching end of file
|
|
||||||
* before <code>n</code> bytes have been skipped is only one possibility.
|
|
||||||
* The actual number of bytes skipped is returned. If <code>n</code> is
|
|
||||||
* negative, no bytes are skipped.
|
|
||||||
*
|
|
||||||
* @param n the number of bytes to be skipped.
|
|
||||||
* @return the actual number of bytes skipped.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public long skip(long n) throws IOException {
|
|
||||||
int l;
|
|
||||||
if (n <= outlen) {
|
|
||||||
outpos += n;
|
|
||||||
outlen -= n;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
n -= outlen;
|
|
||||||
l = outlen;
|
|
||||||
outlen = 0;
|
|
||||||
outpos = 0;
|
|
||||||
if (n <= inlen) {
|
|
||||||
inpos += n;
|
|
||||||
inlen -= n;
|
|
||||||
return l + n;
|
|
||||||
}
|
|
||||||
n -= inlen;
|
|
||||||
l += inlen;
|
|
||||||
inlen = 0;
|
|
||||||
inpos = 0;
|
|
||||||
return stream.skip(n) + l;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,292 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic wrapper around IIR algorithm.
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class IIR extends IIRBase {
|
|
||||||
/**
|
|
||||||
* Max number of channels supported
|
|
||||||
*/
|
|
||||||
public final static int EQ_MAX_CHANNELS = 2;
|
|
||||||
/**
|
|
||||||
* Max bands supported by the code
|
|
||||||
*/
|
|
||||||
public final static int EQ_MAX_BANDS = 31;
|
|
||||||
/**
|
|
||||||
* Supported sample rates
|
|
||||||
*/
|
|
||||||
public final static float EQ_11025_RATE = 11025;
|
|
||||||
public final static float EQ_22050_RATE = 22050;
|
|
||||||
public final static float EQ_44100_RATE = 44100;
|
|
||||||
public final static float EQ_48000_RATE = 48000;
|
|
||||||
public final static float EQ_96000_RATE = 96000;
|
|
||||||
/**
|
|
||||||
* Supported number of bands
|
|
||||||
*/
|
|
||||||
public final static int EQ_10_BANDS = 10;
|
|
||||||
public final static int EQ_15_BANDS = 15;
|
|
||||||
public final static int EQ_25_BANDS = 25;
|
|
||||||
public final static int EQ_31_BANDS = 31;
|
|
||||||
|
|
||||||
/* Indexes for the history arrays
|
|
||||||
* These have to be kept between calls to this function
|
|
||||||
* hence they are static */
|
|
||||||
private int i;
|
|
||||||
private int j;
|
|
||||||
private int k;
|
|
||||||
|
|
||||||
/* History for two filters */
|
|
||||||
private XYData[][] dataHistory = new XYData[EQ_MAX_BANDS][EQ_MAX_CHANNELS];
|
|
||||||
private XYData[][] dataHistory2 = new XYData[EQ_MAX_BANDS][EQ_MAX_CHANNELS];
|
|
||||||
|
|
||||||
/* Coefficients */
|
|
||||||
private IIRCoefficients[] iircf;
|
|
||||||
|
|
||||||
/* Equalizer config */
|
|
||||||
private IIRControls eqcfg;
|
|
||||||
/* rate */
|
|
||||||
private float rate;
|
|
||||||
/* channels */
|
|
||||||
private int channels;
|
|
||||||
/* bands */
|
|
||||||
private int bands;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs equalizer with given config
|
|
||||||
*
|
|
||||||
* @param bands is the number of bands to be used
|
|
||||||
* @param rate is the sample rate of equalizer
|
|
||||||
* @param channels is the number of channels
|
|
||||||
*/
|
|
||||||
public IIR(int bands, float rate, int channels) {
|
|
||||||
this.rate = rate;
|
|
||||||
this.channels = channels;
|
|
||||||
this.bands = bands;
|
|
||||||
this.eqcfg = new IIRControls(bands, channels);
|
|
||||||
|
|
||||||
if (!isParamsSupported(bands, rate, channels))
|
|
||||||
throw new IllegalArgumentException("Unsupported parameters");
|
|
||||||
|
|
||||||
initIIR();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Controls of equalizer
|
|
||||||
*
|
|
||||||
* @return Controls of equalizer
|
|
||||||
*/
|
|
||||||
public IIRControls getControls() {
|
|
||||||
return eqcfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is special method for checking of supported parameters of equalizer
|
|
||||||
*
|
|
||||||
* @param bands is the number of bands
|
|
||||||
* @param rate is the sample rate of data
|
|
||||||
* @param channels is the number of channels
|
|
||||||
* @return true if parameters are supported
|
|
||||||
*/
|
|
||||||
public static boolean isParamsSupported(int bands, float rate, int channels) {
|
|
||||||
if (rate != EQ_11025_RATE && rate != EQ_22050_RATE && rate != EQ_44100_RATE && rate != EQ_48000_RATE && rate != EQ_96000_RATE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (bands) {
|
|
||||||
case EQ_10_BANDS:
|
|
||||||
case EQ_15_BANDS:
|
|
||||||
case EQ_25_BANDS:
|
|
||||||
case EQ_31_BANDS:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (channels) {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (rate != EQ_11025_RATE && rate != EQ_22050_RATE) || bands == EQ_10_BANDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init the filters */
|
|
||||||
private void initIIR() {
|
|
||||||
setFilters();
|
|
||||||
for (int ii = 0; ii < EQ_MAX_BANDS; ii++)
|
|
||||||
for (int jj = 0; jj < EQ_MAX_CHANNELS; jj++) {
|
|
||||||
dataHistory[ii][jj] = new XYData();
|
|
||||||
dataHistory2[ii][jj] = new XYData();
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
j = 2;
|
|
||||||
k = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFilters() {
|
|
||||||
if (rate == EQ_11025_RATE)
|
|
||||||
iircf = iir_cf10_11k_11025;
|
|
||||||
else if (rate == EQ_22050_RATE)
|
|
||||||
iircf = iir_cf10_22k_22050;
|
|
||||||
else if (rate == EQ_44100_RATE) {
|
|
||||||
switch (bands) {
|
|
||||||
case 31:
|
|
||||||
iircf = iir_cf31_44100;
|
|
||||||
break;
|
|
||||||
case 25:
|
|
||||||
iircf = iir_cf25_44100;
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
iircf = iir_cf15_44100;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iircf = iir_cf10_44100;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (rate == EQ_48000_RATE) {
|
|
||||||
switch (bands) {
|
|
||||||
case 31:
|
|
||||||
iircf = iir_cf31_48000;
|
|
||||||
break;
|
|
||||||
case 25:
|
|
||||||
iircf = iir_cf25_48000;
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
iircf = iir_cf15_48000;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iircf = iir_cf10_48000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (rate == EQ_96000_RATE) {
|
|
||||||
switch (bands) {
|
|
||||||
case 31:
|
|
||||||
iircf = iir_cf31_96000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear filter history.
|
|
||||||
*/
|
|
||||||
public void cleanHistory() {
|
|
||||||
/* Zero the history arrays */
|
|
||||||
for (int ii = 0; ii < EQ_MAX_BANDS; ii++)
|
|
||||||
for (int jj = 0; jj < EQ_MAX_CHANNELS; jj++) {
|
|
||||||
dataHistory[ii][jj].zero();
|
|
||||||
dataHistory2[ii][jj].zero();
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
j = 2;
|
|
||||||
k = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main filtering method.
|
|
||||||
*
|
|
||||||
* @param data - data to be filtered
|
|
||||||
* @param length - length of data in buffer
|
|
||||||
*/
|
|
||||||
public void iir(int[] data, int length) {
|
|
||||||
int index, band, channel;
|
|
||||||
float eqpreamp[] = eqcfg.getPreamp();
|
|
||||||
float eqbands[][] = eqcfg.getBands();
|
|
||||||
double pcm, out;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IIR filter equation is
|
|
||||||
* y[n] = 2 * (alpha*(x[n]-x[n-2]) + gamma*y[n-1] - beta*y[n-2])
|
|
||||||
*
|
|
||||||
* NOTE: The 2 factor was introduced in the coefficients to save
|
|
||||||
* a multiplication
|
|
||||||
*
|
|
||||||
* This algorithm cascades two filters to get nice filtering
|
|
||||||
* at the expense of extra CPU cycles
|
|
||||||
*/
|
|
||||||
IIRCoefficients tempcf;
|
|
||||||
XYData tempd;
|
|
||||||
for (index = 0; index < length; index += channels) {
|
|
||||||
/* For each channel */
|
|
||||||
for (channel = 0; channel < channels; channel++) {
|
|
||||||
/* Preamp gain */
|
|
||||||
pcm = data[index + channel] * eqpreamp[channel];
|
|
||||||
|
|
||||||
out = 0f;
|
|
||||||
/* For each band */
|
|
||||||
for (band = 0; band < bands; band++) {
|
|
||||||
/* Store Xi(n) */
|
|
||||||
tempd = dataHistory[band][channel];
|
|
||||||
tempd.x[i] = pcm;
|
|
||||||
/* Calculate and store Yi(n) */
|
|
||||||
tempcf = iircf[band];
|
|
||||||
tempd.y[i] =
|
|
||||||
(
|
|
||||||
/* = alpha * [x(n)-x(n-2)] */
|
|
||||||
tempcf.alpha * (pcm - tempd.x[k])
|
|
||||||
/* + gamma * y(n-1) */
|
|
||||||
+ tempcf.gamma * tempd.y[j]
|
|
||||||
/* - beta * y(n-2) */
|
|
||||||
- tempcf.beta * tempd.y[k]
|
|
||||||
);
|
|
||||||
/*
|
|
||||||
* The multiplication by 2.0 was 'moved' into the coefficients to save
|
|
||||||
* CPU cycles here */
|
|
||||||
/* Apply the gain */
|
|
||||||
out += (tempd.y[i] * eqbands[band][channel]); // * 2.0;
|
|
||||||
} /* For each band */
|
|
||||||
|
|
||||||
/* Volume stuff
|
|
||||||
Scale down original PCM sample and add it to the filters
|
|
||||||
output. This substitutes the multiplication by 0.25
|
|
||||||
Go back to use the floating point multiplication before the
|
|
||||||
conversion to give more dynamic range
|
|
||||||
*/
|
|
||||||
out += (pcm * 0.25);
|
|
||||||
|
|
||||||
/* Normalize the output */
|
|
||||||
out *= 4;
|
|
||||||
|
|
||||||
/* Round and convert to integer */
|
|
||||||
data[index + channel] = (int) out;
|
|
||||||
} /* For each channel */
|
|
||||||
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
k++;
|
|
||||||
|
|
||||||
/* Wrap around the indexes */
|
|
||||||
if (i == 3)
|
|
||||||
i = 0;
|
|
||||||
else if (j == 3)
|
|
||||||
j = 0;
|
|
||||||
else
|
|
||||||
k = 0;
|
|
||||||
|
|
||||||
|
|
||||||
}/* For each pair of samples */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,478 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class IIRBase {
|
|
||||||
/* BETA, ALPHA, GAMMA */
|
|
||||||
public final static IIRCoefficients iir_cf10_11k_11025[] = {
|
|
||||||
/* 31 Hz*/
|
|
||||||
new IIRCoefficients(9.8758524689e-01, 6.2073765555e-03, 1.9872750693e+00),
|
|
||||||
/* 62 Hz*/
|
|
||||||
new IIRCoefficients(9.7532461998e-01, 1.2337690008e-02, 1.9740916593e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.5087485437e-01, 2.4562572817e-02, 1.9459267562e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.0416308662e-01, 4.7918456688e-02, 1.8848691023e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(8.1751373987e-01, 9.1243130064e-02, 1.7442229115e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(6.6840529852e-01, 1.6579735074e-01, 1.4047189863e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(4.4858358977e-01, 2.7570820511e-01, 6.0517475334e-01),
|
|
||||||
/* 3k Hz*/
|
|
||||||
new IIRCoefficients(3.1012671838e-01, 3.4493664081e-01, -1.8141012760e-01),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(2.4198119087e-01, 3.7900940457e-01, -8.0845085113e-01),
|
|
||||||
/* 5.5k Hz*/
|
|
||||||
new IIRCoefficients(3.3453245058e-01, 3.3273377471e-01, -1.3344985880e+00)
|
|
||||||
};
|
|
||||||
|
|
||||||
public final static IIRCoefficients iir_cf10_22k_22050[] = {
|
|
||||||
/* 31 Hz*/
|
|
||||||
new IIRCoefficients(9.9377323686e-01, 3.1133815717e-03, 1.9936954495e+00),
|
|
||||||
/* 62 Hz*/
|
|
||||||
new IIRCoefficients(9.8758524689e-01, 6.2073765555e-03, 1.9872750693e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.7512812040e-01, 1.2435939802e-02, 1.9738753198e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.5087485437e-01, 2.4562572817e-02, 1.9459267562e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.0416308662e-01, 4.7918456688e-02, 1.8848691023e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(8.1751373987e-01, 9.1243130064e-02, 1.7442229115e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(6.6840529852e-01, 1.6579735074e-01, 1.4047189863e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(4.4858358977e-01, 2.7570820511e-01, 6.0517475334e-01),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(2.4198119087e-01, 3.7900940457e-01, -8.0845085113e-01),
|
|
||||||
/* 11k Hz*/
|
|
||||||
new IIRCoefficients(3.3453245058e-01, 3.3273377471e-01, -1.3344985880e+00)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf10_44100[] = {
|
|
||||||
/* 31 Hz*/
|
|
||||||
new IIRCoefficients(9.9688176273e-01, 1.5591186337e-03, 1.9968622855e+00),
|
|
||||||
/* 62 Hz*/
|
|
||||||
new IIRCoefficients(9.9377323686e-01, 3.1133815717e-03, 1.9936954495e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.8748575691e-01, 6.2571215431e-03, 1.9871705722e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.7512812040e-01, 1.2435939802e-02, 1.9738753198e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.5087485437e-01, 2.4562572817e-02, 1.9459267562e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.0416308662e-01, 4.7918456688e-02, 1.8848691023e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(8.1751373987e-01, 9.1243130064e-02, 1.7442229115e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(6.6840529852e-01, 1.6579735074e-01, 1.4047189863e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(4.4858358977e-01, 2.7570820511e-01, 6.0517475334e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(2.4198119087e-01, 3.7900940457e-01, -8.0845085113e-01)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf10_48000[] = {
|
|
||||||
/* 31 Hz*/
|
|
||||||
new IIRCoefficients(9.9713475915e-01, 1.4326204244e-03, 1.9971183163e+00),
|
|
||||||
/* 62 Hz*/
|
|
||||||
new IIRCoefficients(9.9427771143e-01, 2.8611442874e-03, 1.9942120343e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.8849666727e-01, 5.7516663664e-03, 1.9882304829e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.7712566171e-01, 1.1437169144e-02, 1.9760670839e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.5477456091e-01, 2.2612719547e-02, 1.9505892385e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.1159452679e-01, 4.4202736607e-02, 1.8952405706e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(8.3100647694e-01, 8.4496761532e-02, 1.7686164442e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(6.9062328809e-01, 1.5468835596e-01, 1.4641227157e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(4.7820368352e-01, 2.6089815824e-01, 7.3910184176e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(2.5620076154e-01, 3.7189961923e-01, -6.2810038077e-01)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf15_44100[] = {
|
|
||||||
/* 25 Hz*/
|
|
||||||
new IIRCoefficients(9.9834072702e-01, 8.2963648917e-04, 1.9983280505e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9734652663e-01, 1.3267366865e-03, 1.9973140908e+00),
|
|
||||||
/* 63 Hz*/
|
|
||||||
new IIRCoefficients(9.9582396353e-01, 2.0880182333e-03, 1.9957435641e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9337951306e-01, 3.3102434709e-03, 1.9931771947e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.8942832039e-01, 5.2858398053e-03, 1.9889114258e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.8353109588e-01, 8.2344520610e-03, 1.9822729654e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.7378088082e-01, 1.3109559588e-02, 1.9705764276e+00),
|
|
||||||
/* 630 Hz*/
|
|
||||||
new IIRCoefficients(9.5901979676e-01, 2.0490101620e-02, 1.9511333590e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.3574903986e-01, 3.2125480071e-02, 1.9161350100e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(8.9923630641e-01, 5.0381846793e-02, 1.8501014162e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(8.4722457681e-01, 7.6387711593e-02, 1.7312785699e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(7.6755471307e-01, 1.1622264346e-01, 1.4881981417e+00),
|
|
||||||
/* 6.3k Hz*/
|
|
||||||
new IIRCoefficients(6.6125377473e-01, 1.6937311263e-01, 1.0357747868e+00),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(5.2683267950e-01, 2.3658366025e-01, 2.2218349322e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(4.0179628792e-01, 2.9910185604e-01, -9.1248032613e-01)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf15_48000[] = {
|
|
||||||
/* 25 Hz*/
|
|
||||||
new IIRCoefficients(9.9847546664e-01, 7.6226668143e-04, 1.9984647656e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9756184654e-01, 1.2190767289e-03, 1.9975344645e+00),
|
|
||||||
/* 63 Hz*/
|
|
||||||
new IIRCoefficients(9.9616261379e-01, 1.9186931041e-03, 1.9960947369e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9391578543e-01, 3.0421072865e-03, 1.9937449618e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.9028307215e-01, 4.8584639242e-03, 1.9898465702e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.8485897264e-01, 7.5705136795e-03, 1.9837962543e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.7588512657e-01, 1.2057436715e-02, 1.9731772447e+00),
|
|
||||||
/* 630 Hz*/
|
|
||||||
new IIRCoefficients(9.6228521814e-01, 1.8857390928e-02, 1.9556164694e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.4080933132e-01, 2.9595334338e-02, 1.9242054384e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(9.0702059196e-01, 4.6489704022e-02, 1.8653476166e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(8.5868004289e-01, 7.0659978553e-02, 1.7600401337e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(7.8409610788e-01, 1.0795194606e-01, 1.5450725522e+00),
|
|
||||||
/* 6.3k Hz*/
|
|
||||||
new IIRCoefficients(6.8332861002e-01, 1.5833569499e-01, 1.1426447155e+00),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(5.5267518228e-01, 2.2366240886e-01, 4.0186190803e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(4.1811888447e-01, 2.9094055777e-01, -7.0905944223e-01)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf25_44100[] = {
|
|
||||||
/* 20 Hz*/
|
|
||||||
new IIRCoefficients(9.9934037157e-01, 3.2981421662e-04, 1.9993322545e+00),
|
|
||||||
/* 31.5 Hz*/
|
|
||||||
new IIRCoefficients(9.9896129025e-01, 5.1935487310e-04, 1.9989411587e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9868118265e-01, 6.5940867495e-04, 1.9986487252e+00),
|
|
||||||
/* 50 Hz*/
|
|
||||||
new IIRCoefficients(9.9835175161e-01, 8.2412419683e-04, 1.9983010452e+00),
|
|
||||||
/* 80 Hz*/
|
|
||||||
new IIRCoefficients(9.9736411067e-01, 1.3179446674e-03, 1.9972343673e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9670622662e-01, 1.6468866919e-03, 1.9965035707e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.9588448566e-01, 2.0577571681e-03, 1.9955679690e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.9473519326e-01, 2.6324033689e-03, 1.9942169198e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.9178600786e-01, 4.1069960678e-03, 1.9905226414e+00),
|
|
||||||
/* 315 Hz*/
|
|
||||||
new IIRCoefficients(9.8966154150e-01, 5.1692292513e-03, 1.9876580847e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.8689036168e-01, 6.5548191616e-03, 1.9836646251e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.8364027156e-01, 8.1798642207e-03, 1.9786090689e+00),
|
|
||||||
/* 800 Hz*/
|
|
||||||
new IIRCoefficients(9.7395577681e-01, 1.3022111597e-02, 1.9611472340e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.6755437936e-01, 1.6222810321e-02, 1.9476180811e+00),
|
|
||||||
/* 1.25k Hz*/
|
|
||||||
new IIRCoefficients(9.5961458750e-01, 2.0192706249e-02, 1.9286193446e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(9.4861481164e-01, 2.5692594182e-02, 1.8982024567e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(9.2095325455e-01, 3.9523372724e-02, 1.8003794694e+00),
|
|
||||||
/* 3.15k Hz*/
|
|
||||||
new IIRCoefficients(9.0153642498e-01, 4.9231787512e-02, 1.7132251201e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(8.7685876255e-01, 6.1570618727e-02, 1.5802270232e+00),
|
|
||||||
/* 5k Hz*/
|
|
||||||
new IIRCoefficients(8.4886734822e-01, 7.5566325889e-02, 1.3992391376e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(7.7175298860e-01, 1.1412350570e-01, 7.4018523020e-01),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(7.2627049462e-01, 1.3686475269e-01, 2.5120552756e-01),
|
|
||||||
/* 12.5k Hz*/
|
|
||||||
new IIRCoefficients(6.7674787974e-01, 1.6162606013e-01, -3.4978377639e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(6.2482197550e-01, 1.8758901225e-01, -1.0576558797e+00),
|
|
||||||
/* 20k Hz*/
|
|
||||||
new IIRCoefficients(6.1776148240e-01, 1.9111925880e-01, -1.5492465594e+00)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf25_48000[] = {
|
|
||||||
/* 20 Hz*/
|
|
||||||
new IIRCoefficients(9.9939388451e-01, 3.0305774630e-04, 1.9993870327e+00),
|
|
||||||
/* 31.5 Hz*/
|
|
||||||
new IIRCoefficients(9.9904564663e-01, 4.7717668529e-04, 1.9990286528e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9878827195e-01, 6.0586402557e-04, 1.9987608731e+00),
|
|
||||||
/* 50 Hz*/
|
|
||||||
new IIRCoefficients(9.9848556942e-01, 7.5721528829e-04, 1.9984427652e+00),
|
|
||||||
/* 80 Hz*/
|
|
||||||
new IIRCoefficients(9.9757801538e-01, 1.2109923088e-03, 1.9974684869e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9697343933e-01, 1.5132803374e-03, 1.9968023538e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.9621823598e-01, 1.8908820086e-03, 1.9959510180e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.9516191728e-01, 2.4190413595e-03, 1.9947243453e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.9245085008e-01, 3.7745749576e-03, 1.9913840669e+00),
|
|
||||||
/* 315 Hz*/
|
|
||||||
new IIRCoefficients(9.9049749914e-01, 4.7512504310e-03, 1.9888056233e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.8794899744e-01, 6.0255012789e-03, 1.9852245824e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.8495930023e-01, 7.5203498850e-03, 1.9807093500e+00),
|
|
||||||
/* 800 Hz*/
|
|
||||||
new IIRCoefficients(9.7604570090e-01, 1.1977149551e-02, 1.9652207158e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.7014963927e-01, 1.4925180364e-02, 1.9532947360e+00),
|
|
||||||
/* 1.25k Hz*/
|
|
||||||
new IIRCoefficients(9.6283181641e-01, 1.8584091793e-02, 1.9366149237e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(9.5268463224e-01, 2.3657683878e-02, 1.9100137880e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(9.2711765003e-01, 3.6441174983e-02, 1.8248457659e+00),
|
|
||||||
/* 3.15k Hz*/
|
|
||||||
new IIRCoefficients(9.0912548757e-01, 4.5437256213e-02, 1.7491177803e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(8.8619860800e-01, 5.6900696000e-02, 1.6334959111e+00),
|
|
||||||
/* 5k Hz*/
|
|
||||||
new IIRCoefficients(8.6010264114e-01, 6.9948679430e-02, 1.4757186436e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(7.8757448309e-01, 1.0621275845e-01, 8.9378724155e-01),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(7.4415362476e-01, 1.2792318762e-01, 4.5142017567e-01),
|
|
||||||
/* 12.5k Hz*/
|
|
||||||
new IIRCoefficients(6.9581428034e-01, 1.5209285983e-01, -1.1091156053e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(6.4120506488e-01, 1.7939746756e-01, -8.2060253244e-01),
|
|
||||||
/* 20k Hz*/
|
|
||||||
new IIRCoefficients(6.0884213704e-01, 1.9557893148e-01, -1.3932981614e+00)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf31_44100[] = {
|
|
||||||
/* 20 Hz*/
|
|
||||||
new IIRCoefficients(9.9934037157e-01, 3.2981421662e-04, 1.9993322545e+00),
|
|
||||||
/* 25 Hz*/
|
|
||||||
new IIRCoefficients(9.9917555233e-01, 4.1222383516e-04, 1.9991628705e+00),
|
|
||||||
/* 31.5 Hz*/
|
|
||||||
new IIRCoefficients(9.9896129025e-01, 5.1935487310e-04, 1.9989411587e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9868118265e-01, 6.5940867495e-04, 1.9986487252e+00),
|
|
||||||
/* 50 Hz*/
|
|
||||||
new IIRCoefficients(9.9835175161e-01, 8.2412419683e-04, 1.9983010452e+00),
|
|
||||||
/* 63 Hz*/
|
|
||||||
new IIRCoefficients(9.9792365217e-01, 1.0381739160e-03, 1.9978431682e+00),
|
|
||||||
/* 80 Hz*/
|
|
||||||
new IIRCoefficients(9.9736411067e-01, 1.3179446674e-03, 1.9972343673e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9670622662e-01, 1.6468866919e-03, 1.9965035707e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.9588448566e-01, 2.0577571681e-03, 1.9955679690e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.9473519326e-01, 2.6324033689e-03, 1.9942169198e+00),
|
|
||||||
/* 200 Hz*/
|
|
||||||
new IIRCoefficients(9.9342335280e-01, 3.2883236020e-03, 1.9926141028e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.9178600786e-01, 4.1069960678e-03, 1.9905226414e+00),
|
|
||||||
/* 315 Hz*/
|
|
||||||
new IIRCoefficients(9.8966154150e-01, 5.1692292513e-03, 1.9876580847e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.8689036168e-01, 6.5548191616e-03, 1.9836646251e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.8364027156e-01, 8.1798642207e-03, 1.9786090689e+00),
|
|
||||||
/* 630 Hz*/
|
|
||||||
new IIRCoefficients(9.7943153305e-01, 1.0284233476e-02, 1.9714629236e+00),
|
|
||||||
/* 800 Hz*/
|
|
||||||
new IIRCoefficients(9.7395577681e-01, 1.3022111597e-02, 1.9611472340e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.6755437936e-01, 1.6222810321e-02, 1.9476180811e+00),
|
|
||||||
/* 1.25k Hz*/
|
|
||||||
new IIRCoefficients(9.5961458750e-01, 2.0192706249e-02, 1.9286193446e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(9.4861481164e-01, 2.5692594182e-02, 1.8982024567e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(9.3620971896e-01, 3.1895140519e-02, 1.8581325022e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(9.2095325455e-01, 3.9523372724e-02, 1.8003794694e+00),
|
|
||||||
/* 3.15k Hz*/
|
|
||||||
new IIRCoefficients(9.0153642498e-01, 4.9231787512e-02, 1.7132251201e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(8.7685876255e-01, 6.1570618727e-02, 1.5802270232e+00),
|
|
||||||
/* 5k Hz*/
|
|
||||||
new IIRCoefficients(8.4886734822e-01, 7.5566325889e-02, 1.3992391376e+00),
|
|
||||||
/* 6.3k Hz*/
|
|
||||||
new IIRCoefficients(8.1417575446e-01, 9.2912122771e-02, 1.1311200817e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(7.7175298860e-01, 1.1412350570e-01, 7.4018523020e-01),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(7.2627049462e-01, 1.3686475269e-01, 2.5120552756e-01),
|
|
||||||
/* 12.5k Hz*/
|
|
||||||
new IIRCoefficients(6.7674787974e-01, 1.6162606013e-01, -3.4978377639e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(6.2482197550e-01, 1.8758901225e-01, -1.0576558797e+00),
|
|
||||||
/* 20k Hz*/
|
|
||||||
new IIRCoefficients(6.1776148240e-01, 1.9111925880e-01, -1.5492465594e+00)
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf31_48000[] = {
|
|
||||||
/* 20 Hz*/
|
|
||||||
new IIRCoefficients(9.9939388451e-01, 3.0305774630e-04, 1.9993870327e+00),
|
|
||||||
/* 25 Hz*/
|
|
||||||
new IIRCoefficients(9.9924247917e-01, 3.7876041632e-04, 1.9992317740e+00),
|
|
||||||
/* 31.5 Hz*/
|
|
||||||
new IIRCoefficients(9.9904564663e-01, 4.7717668529e-04, 1.9990286528e+00),
|
|
||||||
/* 40 Hz*/
|
|
||||||
new IIRCoefficients(9.9878827195e-01, 6.0586402557e-04, 1.9987608731e+00),
|
|
||||||
/* 50 Hz*/
|
|
||||||
new IIRCoefficients(9.9848556942e-01, 7.5721528829e-04, 1.9984427652e+00),
|
|
||||||
/* 63 Hz*/
|
|
||||||
new IIRCoefficients(9.9809219264e-01, 9.5390367779e-04, 1.9980242502e+00),
|
|
||||||
/* 80 Hz*/
|
|
||||||
new IIRCoefficients(9.9757801538e-01, 1.2109923088e-03, 1.9974684869e+00),
|
|
||||||
/* 100 Hz*/
|
|
||||||
new IIRCoefficients(9.9697343933e-01, 1.5132803374e-03, 1.9968023538e+00),
|
|
||||||
/* 125 Hz*/
|
|
||||||
new IIRCoefficients(9.9621823598e-01, 1.8908820086e-03, 1.9959510180e+00),
|
|
||||||
/* 160 Hz*/
|
|
||||||
new IIRCoefficients(9.9516191728e-01, 2.4190413595e-03, 1.9947243453e+00),
|
|
||||||
/* 200 Hz*/
|
|
||||||
new IIRCoefficients(9.9395607757e-01, 3.0219612131e-03, 1.9932727986e+00),
|
|
||||||
/* 250 Hz*/
|
|
||||||
new IIRCoefficients(9.9245085008e-01, 3.7745749576e-03, 1.9913840669e+00),
|
|
||||||
/* 315 Hz*/
|
|
||||||
new IIRCoefficients(9.9049749914e-01, 4.7512504310e-03, 1.9888056233e+00),
|
|
||||||
/* 400 Hz*/
|
|
||||||
new IIRCoefficients(9.8794899744e-01, 6.0255012789e-03, 1.9852245824e+00),
|
|
||||||
/* 500 Hz*/
|
|
||||||
new IIRCoefficients(9.8495930023e-01, 7.5203498850e-03, 1.9807093500e+00),
|
|
||||||
/* 630 Hz*/
|
|
||||||
new IIRCoefficients(9.8108651246e-01, 9.4567437704e-03, 1.9743538683e+00),
|
|
||||||
/* 800 Hz*/
|
|
||||||
new IIRCoefficients(9.7604570090e-01, 1.1977149551e-02, 1.9652207158e+00),
|
|
||||||
/* 1k Hz*/
|
|
||||||
new IIRCoefficients(9.7014963927e-01, 1.4925180364e-02, 1.9532947360e+00),
|
|
||||||
/* 1.25k Hz*/
|
|
||||||
new IIRCoefficients(9.6283181641e-01, 1.8584091793e-02, 1.9366149237e+00),
|
|
||||||
/* 1.6k Hz*/
|
|
||||||
new IIRCoefficients(9.5268463224e-01, 2.3657683878e-02, 1.9100137880e+00),
|
|
||||||
/* 2k Hz*/
|
|
||||||
new IIRCoefficients(9.4122788957e-01, 2.9386055213e-02, 1.8750821533e+00),
|
|
||||||
/* 2.5k Hz*/
|
|
||||||
new IIRCoefficients(9.2711765003e-01, 3.6441174983e-02, 1.8248457659e+00),
|
|
||||||
/* 3.15k Hz*/
|
|
||||||
new IIRCoefficients(9.0912548757e-01, 4.5437256213e-02, 1.7491177803e+00),
|
|
||||||
/* 4k Hz*/
|
|
||||||
new IIRCoefficients(8.8619860800e-01, 5.6900696000e-02, 1.6334959111e+00),
|
|
||||||
/* 5k Hz*/
|
|
||||||
new IIRCoefficients(8.6010264114e-01, 6.9948679430e-02, 1.4757186436e+00),
|
|
||||||
/* 6.3k Hz*/
|
|
||||||
new IIRCoefficients(8.2760520925e-01, 8.6197395374e-02, 1.2405797786e+00),
|
|
||||||
/* 8k Hz*/
|
|
||||||
new IIRCoefficients(7.8757448309e-01, 1.0621275845e-01, 8.9378724155e-01),
|
|
||||||
/* 10k Hz*/
|
|
||||||
new IIRCoefficients(7.4415362476e-01, 1.2792318762e-01, 4.5142017567e-01),
|
|
||||||
/* 12.5k Hz*/
|
|
||||||
new IIRCoefficients(6.9581428034e-01, 1.5209285983e-01, -1.1091156053e-01),
|
|
||||||
/* 16k Hz*/
|
|
||||||
new IIRCoefficients(6.4120506488e-01, 1.7939746756e-01, -8.2060253244e-01),
|
|
||||||
/* 20k Hz*/
|
|
||||||
new IIRCoefficients(6.0884213704e-01, 1.9557893148e-01, -1.3932981614e+00),
|
|
||||||
};
|
|
||||||
public final static IIRCoefficients iir_cf31_96000[] = {
|
|
||||||
/* 20 Hz */
|
|
||||||
new IIRCoefficients(9.9918221139e-01, 4.0889430323e-04, 1.9991804986e+00),
|
|
||||||
/* 25 Hz */
|
|
||||||
new IIRCoefficients(9.9962373418e-01, 1.8813291151e-04, 1.9996210574e+00),
|
|
||||||
/* 31.5 Hz */
|
|
||||||
new IIRCoefficients(9.9950924659e-01, 2.4537670644e-04, 1.9995049971e+00),
|
|
||||||
/* 40 Hz */
|
|
||||||
new IIRCoefficients(9.9939477210e-01, 3.0261394841e-04, 1.9993879203e+00),
|
|
||||||
/* 50 Hz */
|
|
||||||
new IIRCoefficients(9.9924760988e-01, 3.7619506167e-04, 1.9992369047e+00),
|
|
||||||
/* 63 Hz */
|
|
||||||
new IIRCoefficients(9.9901873389e-01, 4.9063305250e-04, 1.9990017403e+00),
|
|
||||||
/* 80 Hz */
|
|
||||||
new IIRCoefficients(9.9878991029e-01, 6.0504485723e-04, 1.9987625114e+00),
|
|
||||||
/* 100 Hz */
|
|
||||||
new IIRCoefficients(9.9852846169e-01, 7.3576915625e-04, 1.9984856565e+00),
|
|
||||||
/* 125 Hz */
|
|
||||||
new IIRCoefficients(9.9803842973e-01, 9.8078513561e-04, 1.9979715632e+00),
|
|
||||||
/* 160 Hz */
|
|
||||||
new IIRCoefficients(9.9754863778e-01, 1.2256811083e-03, 1.9974391109e+00),
|
|
||||||
/* 200 Hz */
|
|
||||||
new IIRCoefficients(9.9705908562e-01, 1.4704571921e-03, 1.9968879927e+00),
|
|
||||||
/* 250 Hz */
|
|
||||||
new IIRCoefficients(9.9624369754e-01, 1.8781512307e-03, 1.9959764762e+00),
|
|
||||||
/* 315 Hz */
|
|
||||||
new IIRCoefficients(9.9510327003e-01, 2.4483649847e-03, 1.9946792773e+00),
|
|
||||||
/* 400 Hz */
|
|
||||||
new IIRCoefficients(9.9396414160e-01, 3.0179291997e-03, 1.9932808599e+00),
|
|
||||||
/* 500 Hz */
|
|
||||||
new IIRCoefficients(9.9250145198e-01, 3.7492740081e-03, 1.9914346418e+00),
|
|
||||||
/* 630 Hz */
|
|
||||||
new IIRCoefficients(9.9023040090e-01, 4.8847995509e-03, 1.9885387521e+00),
|
|
||||||
/* 800 Hz */
|
|
||||||
new IIRCoefficients(9.8796449555e-01, 6.0177522243e-03, 1.9852400593e+00),
|
|
||||||
/* 1000 Hz */
|
|
||||||
new IIRCoefficients(9.8538116034e-01, 7.3094198292e-03, 1.9811303069e+00),
|
|
||||||
/* 1250 Hz */
|
|
||||||
new IIRCoefficients(9.8055531891e-01, 9.7223405432e-03, 1.9739308353e+00),
|
|
||||||
/* 1600 Hz */
|
|
||||||
new IIRCoefficients(9.7575264994e-01, 1.2123675032e-02, 1.9649292702e+00),
|
|
||||||
/* 2000 Hz */
|
|
||||||
new IIRCoefficients(9.7097292946e-01, 1.4513535269e-02, 1.9541109828e+00),
|
|
||||||
/* 2500 Hz */
|
|
||||||
new IIRCoefficients(9.6305712557e-01, 1.8471437214e-02, 1.9368372235e+00),
|
|
||||||
/* 3150 Hz */
|
|
||||||
new IIRCoefficients(9.5207914671e-01, 2.3960426645e-02, 1.9107394812e+00),
|
|
||||||
/* 4000 Hz */
|
|
||||||
new IIRCoefficients(9.4122023318e-01, 2.9389883411e-02, 1.8750747578e+00),
|
|
||||||
/* 5000 Hz */
|
|
||||||
new IIRCoefficients(9.2742950588e-01, 3.6285247058e-02, 1.8251410716e+00),
|
|
||||||
/* 6300 Hz */
|
|
||||||
new IIRCoefficients(9.0634716904e-01, 4.6826415482e-02, 1.7465723184e+00),
|
|
||||||
/* 8000 Hz */
|
|
||||||
new IIRCoefficients(8.8569806727e-01, 5.7150966366e-02, 1.6330624302e+00),
|
|
||||||
/* 10000 Hz */
|
|
||||||
new IIRCoefficients(8.6260593228e-01, 6.8697033860e-02, 1.4777046382e+00),
|
|
||||||
/* 12500 Hz */
|
|
||||||
new IIRCoefficients(8.2067879086e-01, 8.9660604570e-02, 1.2446020061e+00),
|
|
||||||
/* 16000 Hz */
|
|
||||||
new IIRCoefficients(7.8040765969e-01, 1.0979617015e-01, 8.9020383015e-01),
|
|
||||||
/* 20000 Hz */
|
|
||||||
new IIRCoefficients(2.6794919254e-01, 3.6602540373e-01, 3.2816939955e-01),
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class IIRCoefficients {
|
|
||||||
public double beta;
|
|
||||||
public double alpha;
|
|
||||||
public double gamma;
|
|
||||||
|
|
||||||
public IIRCoefficients(double beta, double alpha, double gamma) {
|
|
||||||
this.beta = beta;
|
|
||||||
this.alpha = alpha;
|
|
||||||
this.gamma = gamma;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constols of equalizer
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class IIRControls {
|
|
||||||
/**
|
|
||||||
* Volume gain
|
|
||||||
* values should be between 0.0 and 1.0
|
|
||||||
*/
|
|
||||||
private float preamp[];
|
|
||||||
/**
|
|
||||||
* Gain for each band
|
|
||||||
* values should be between -0.2 and 1.0
|
|
||||||
*/
|
|
||||||
private float bands[][];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new IIRControls object for given number of bands
|
|
||||||
*
|
|
||||||
* @param bandsnum is the number of bands
|
|
||||||
* @param channels is the number of channels
|
|
||||||
*/
|
|
||||||
public IIRControls(int bandsnum, int channels) {
|
|
||||||
preamp = new float[channels];
|
|
||||||
bands = new float[bandsnum][channels];
|
|
||||||
for (int j = 0; j < channels; j++) {
|
|
||||||
preamp[j] = 1.0f;
|
|
||||||
for (int i = 0; i < bandsnum; i++)
|
|
||||||
bands[i][j] = 0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maximum value for band control
|
|
||||||
*
|
|
||||||
* @return the maximum value for band control
|
|
||||||
*/
|
|
||||||
public float getMaximumBandValue() {
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the minimum value for band control
|
|
||||||
*
|
|
||||||
* @return the minimum value for band control
|
|
||||||
*/
|
|
||||||
public float getMinimumBandValue() {
|
|
||||||
return -0.2f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maximum value for band control (in Db)
|
|
||||||
*
|
|
||||||
* @return the maximum value for band control
|
|
||||||
*/
|
|
||||||
public float getMaximumBandDbValue() {
|
|
||||||
return 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the minimum value for band control (in Db)
|
|
||||||
*
|
|
||||||
* @return the minimum value for band control
|
|
||||||
*/
|
|
||||||
public float getMinimumBandDbValue() {
|
|
||||||
return -12f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maximum value for preamp control
|
|
||||||
*
|
|
||||||
* @return the maximum value for preamp control
|
|
||||||
*/
|
|
||||||
public float getMaximumPreampValue() {
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the minimum value for preamp control
|
|
||||||
*
|
|
||||||
* @return the minimum value for preamp control
|
|
||||||
*/
|
|
||||||
public float getMinimumPreampValue() {
|
|
||||||
return 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maximum value for preamp control (in Db)
|
|
||||||
*
|
|
||||||
* @return the maximum value for preamp control
|
|
||||||
*/
|
|
||||||
public float getMaximumPreampDbValue() {
|
|
||||||
return 12f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the minimum value for preamp control (in Db)
|
|
||||||
*
|
|
||||||
* @return the minimum value for preamp control
|
|
||||||
*/
|
|
||||||
public float getMinimumPreampDbValue() {
|
|
||||||
return -12f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns bands array
|
|
||||||
*
|
|
||||||
* @return bands array
|
|
||||||
*/
|
|
||||||
float[][] getBands() {
|
|
||||||
return bands;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns preamp array
|
|
||||||
*
|
|
||||||
* @return preamp array
|
|
||||||
*/
|
|
||||||
float[] getPreamp() {
|
|
||||||
return preamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns value of control for given band and channel
|
|
||||||
*
|
|
||||||
* @param band is the index of band
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
public float getBandValue(int band, int channel) {
|
|
||||||
return bands[band][channel];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for value of control for given band and channel
|
|
||||||
*
|
|
||||||
* @param band is the index of band
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @param value is the new value
|
|
||||||
*/
|
|
||||||
public void setBandValue(int band, int channel, float value) {
|
|
||||||
bands[band][channel] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for value of control for given band and channel (in Db)
|
|
||||||
*
|
|
||||||
* @param band is the index of band
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @param value is the new value
|
|
||||||
*/
|
|
||||||
public void setBandDbValue(int band, int channel, float value) {
|
|
||||||
/* Map the gain and preamp values */
|
|
||||||
/* -12dB .. 12dB mapping */
|
|
||||||
bands[band][channel] = (float) (2.5220207857061455181125E-01 *
|
|
||||||
Math.exp(8.0178361802353992349168E-02 * value)
|
|
||||||
- 2.5220207852836562523180E-01);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns value of preamp control for given channel
|
|
||||||
*
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
public float getPreampValue(int channel) {
|
|
||||||
return preamp[channel];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for value of preamp control for given channel
|
|
||||||
*
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @param value is the new value
|
|
||||||
*/
|
|
||||||
public void setPreampValue(int channel, float value) {
|
|
||||||
preamp[channel] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for value of preamp control for given channel (in Db)
|
|
||||||
*
|
|
||||||
* @param channel is the index of channel
|
|
||||||
* @param value is the new value
|
|
||||||
*/
|
|
||||||
public void setPreampDbValue(int channel, float value) {
|
|
||||||
/* -12dB .. 12dB mapping */
|
|
||||||
preamp[channel] = (float) (9.9999946497217584440165E-01 *
|
|
||||||
Math.exp(6.9314738656671842642609E-02 * value)
|
|
||||||
+ 3.7119444716771825623636E-07);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure for storing XYData of equalizer.
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class XYData {
|
|
||||||
/**
|
|
||||||
* X data
|
|
||||||
*/
|
|
||||||
public double x[] = new double[3]; /* x[n], x[n-1], x[n-2] */
|
|
||||||
/**
|
|
||||||
* Y data
|
|
||||||
*/
|
|
||||||
public double y[] = new double[3]; /* y[n], y[n-1], y[n-2] */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs new XYData object
|
|
||||||
*/
|
|
||||||
public XYData() {
|
|
||||||
zero();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fills all content with zero
|
|
||||||
*/
|
|
||||||
public void zero() {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
x[i] = 0;
|
|
||||||
y[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,265 +0,0 @@
|
|||||||
/*
|
|
||||||
* 21.04.2004 Original verion. davagin@udm.ru.
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
package davaguine.jeq.spi;
|
|
||||||
|
|
||||||
import davaguine.jeq.core.IIRControls;
|
|
||||||
|
|
||||||
import javax.sound.sampled.AudioFormat;
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The EqualizerInputStream input stream
|
|
||||||
* Author: Dmitry Vaguine
|
|
||||||
* Date: 02.05.2004
|
|
||||||
* Time: 12:00:29
|
|
||||||
*/
|
|
||||||
public class EqualizerInputStream extends AudioInputStream {
|
|
||||||
private davaguine.jeq.core.EqualizerInputStream eq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs new audio stream
|
|
||||||
*
|
|
||||||
* @param stream input stream with audio data
|
|
||||||
* @param bands is the number of bands
|
|
||||||
*/
|
|
||||||
public EqualizerInputStream(AudioInputStream stream, int bands) {
|
|
||||||
super(stream, stream.getFormat(), stream.getFrameLength());
|
|
||||||
AudioFormat format = stream.getFormat();
|
|
||||||
if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED) && !!format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED))
|
|
||||||
throw new IllegalArgumentException("Unsupported encoding");
|
|
||||||
eq = new davaguine.jeq.core.EqualizerInputStream(stream,
|
|
||||||
format.getSampleRate(),
|
|
||||||
format.getChannels(),
|
|
||||||
format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED),
|
|
||||||
format.getSampleSizeInBits(),
|
|
||||||
format.isBigEndian(),
|
|
||||||
bands);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Controls of equalizer
|
|
||||||
*
|
|
||||||
* @return Controls of equalizer
|
|
||||||
*/
|
|
||||||
public IIRControls getControls() {
|
|
||||||
return eq.getControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is special method helps to determine supported audio format
|
|
||||||
*
|
|
||||||
* @param format is an audio format
|
|
||||||
* @param bands is the number of bands
|
|
||||||
* @return true if params supported
|
|
||||||
*/
|
|
||||||
public static boolean isParamsSupported(AudioFormat format, int bands) {
|
|
||||||
if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED) && !!format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED))
|
|
||||||
return false;
|
|
||||||
return davaguine.jeq.core.EqualizerInputStream.isParamsSupported(
|
|
||||||
format.getSampleRate(),
|
|
||||||
format.getChannels(),
|
|
||||||
format.getSampleSizeInBits(),
|
|
||||||
bands);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of bytes that can be read (or skipped over) from
|
|
||||||
* this input stream without blocking by the next caller of a method for
|
|
||||||
* this input stream. The next caller might be the same thread or
|
|
||||||
* another thread.
|
|
||||||
*
|
|
||||||
* @return the number of bytes that can be read from this input stream
|
|
||||||
* without blocking.
|
|
||||||
* @throws java.io.IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public int available() throws IOException {
|
|
||||||
return eq.available();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes this input stream and releases any system resources associated
|
|
||||||
* with the stream.
|
|
||||||
*
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public void close() throws IOException {
|
|
||||||
eq.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> The <code>mark</code> method of <code>EqualizerInputStream</code> does
|
|
||||||
* nothing.
|
|
||||||
*
|
|
||||||
* @param readlimit the maximum limit of bytes that can be read before
|
|
||||||
* the mark position becomes invalid.
|
|
||||||
*/
|
|
||||||
public synchronized void mark(int readlimit) {
|
|
||||||
eq.mark(readlimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests if this input stream supports the <code>mark</code> and
|
|
||||||
* <code>reset</code> methods. Whether or not <code>mark</code> and
|
|
||||||
* <code>reset</code> are supported is an invariant property of a
|
|
||||||
* particular input stream instance. The <code>markSupported</code> method
|
|
||||||
* of <code>EqualizerInputStream</code> returns <code>false</code>.
|
|
||||||
*
|
|
||||||
* @return false
|
|
||||||
*/
|
|
||||||
public boolean markSupported() {
|
|
||||||
return eq.markSupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the next byte of data from the input stream. The value byte is
|
|
||||||
* returned as an <code>int</code> in the range <code>0</code> to
|
|
||||||
* <code>255</code>. If no byte is available because the end of the stream
|
|
||||||
* has been reached, the value <code>-1</code> is returned. This method
|
|
||||||
* blocks until input data is available, the end of the stream is detected,
|
|
||||||
* or an exception is thrown.
|
|
||||||
*
|
|
||||||
* @return the next byte of data, or <code>-1</code> if the end of the
|
|
||||||
* stream is reached.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public int read() throws IOException {
|
|
||||||
return eq.read();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads some number of bytes from the input stream and stores them into
|
|
||||||
* the buffer array <code>b</code>. The number of bytes actually read is
|
|
||||||
* returned as an integer. This method blocks until input data is
|
|
||||||
* available, end of file is detected, or an exception is thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>b</code> is <code>null</code>, a
|
|
||||||
* <code>NullPointerException</code> is thrown. If the length of
|
|
||||||
* <code>b</code> is zero, then no bytes are read and <code>0</code> is
|
|
||||||
* returned; otherwise, there is an attempt to read at least one byte. If
|
|
||||||
* no byte is available because the stream is at end of file, the value
|
|
||||||
* <code>-1</code> is returned; otherwise, at least one byte is read and
|
|
||||||
* stored into <code>b</code>.
|
|
||||||
* <p/>
|
|
||||||
* <p> The first byte read is stored into element <code>b[0]</code>, the
|
|
||||||
* next one into <code>b[1]</code>, and so on. The number of bytes read is,
|
|
||||||
* at most, equal to the length of <code>b</code>. Let <i>k</i> be the
|
|
||||||
* number of bytes actually read; these bytes will be stored in elements
|
|
||||||
* <code>b[0]</code> through <code>b[</code><i>k</i><code>-1]</code>,
|
|
||||||
* leaving elements <code>b[</code><i>k</i><code>]</code> through
|
|
||||||
* <code>b[b.length-1]</code> unaffected.
|
|
||||||
* <p/>
|
|
||||||
* <p> If the first byte cannot be read for any reason other than end of
|
|
||||||
* file, then an <code>IOException</code> is thrown. In particular, an
|
|
||||||
* <code>IOException</code> is thrown if the input stream has been closed.
|
|
||||||
* <p/>
|
|
||||||
* <p> The <code>read(b)</code> method for class <code>EqualizerInputStream</code>
|
|
||||||
* has the same effect as: <pre><code> read(b, 0, b.length) </code></pre>
|
|
||||||
*
|
|
||||||
* @param b the buffer into which the data is read.
|
|
||||||
* @return the total number of bytes read into the buffer, or
|
|
||||||
* <code>-1</code> is there is no more data because the end of
|
|
||||||
* the stream has been reached.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
* @throws NullPointerException if <code>b</code> is <code>null</code>.
|
|
||||||
*/
|
|
||||||
public int read(byte b[]) throws IOException {
|
|
||||||
return read(b, 0, b.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads up to <code>len</code> bytes of data from the input stream into
|
|
||||||
* an array of bytes. An attempt is made to read as many as
|
|
||||||
* <code>len</code> bytes, but a smaller number may be read.
|
|
||||||
* The number of bytes actually read is returned as an integer.
|
|
||||||
* <p/>
|
|
||||||
* <p> This method blocks until input data is available, end of file is
|
|
||||||
* detected, or an exception is thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>b</code> is <code>null</code>, a
|
|
||||||
* <code>NullPointerException</code> is thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>off</code> is negative, or <code>len</code> is negative, or
|
|
||||||
* <code>off+len</code> is greater than the length of the array
|
|
||||||
* <code>b</code>, then an <code>IndexOutOfBoundsException</code> is
|
|
||||||
* thrown.
|
|
||||||
* <p/>
|
|
||||||
* <p> If <code>len</code> is zero, then no bytes are read and
|
|
||||||
* <code>0</code> is returned; otherwise, there is an attempt to read at
|
|
||||||
* least one byte. If no byte is available because the stream is at end of
|
|
||||||
* file, the value <code>-1</code> is returned; otherwise, at least one
|
|
||||||
* byte is read and stored into <code>b</code>.
|
|
||||||
* <p/>
|
|
||||||
* <p> The first byte read is stored into element <code>b[off]</code>, the
|
|
||||||
* next one into <code>b[off+1]</code>, and so on. The number of bytes read
|
|
||||||
* is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
|
|
||||||
* bytes actually read; these bytes will be stored in elements
|
|
||||||
* <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
|
|
||||||
* leaving elements <code>b[off+</code><i>k</i><code>]</code> through
|
|
||||||
* <code>b[off+len-1]</code> unaffected.
|
|
||||||
* <p/>
|
|
||||||
* <p> In every case, elements <code>b[0]</code> through
|
|
||||||
* <code>b[off]</code> and elements <code>b[off+len]</code> through
|
|
||||||
* <code>b[b.length-1]</code> are unaffected.
|
|
||||||
* <p/>
|
|
||||||
* <p> If the first byte cannot be read for any reason other than end of
|
|
||||||
* file, then an <code>IOException</code> is thrown. In particular, an
|
|
||||||
* <code>IOException</code> is thrown if the input stream has been closed.
|
|
||||||
*
|
|
||||||
* @param b the buffer into which the data is read.
|
|
||||||
* @param off the start offset in array <code>b</code>
|
|
||||||
* at which the data is written.
|
|
||||||
* @param len the maximum number of bytes to read.
|
|
||||||
* @return the total number of bytes read into the buffer, or
|
|
||||||
* <code>-1</code> if there is no more data because the end of
|
|
||||||
* the stream has been reached.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
* @throws NullPointerException if <code>b</code> is <code>null</code>.
|
|
||||||
*/
|
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
|
||||||
return eq.read(b, off, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>The method <code>reset</code> for class <code>EqualizerInputStream</code>
|
|
||||||
* does nothing except throw an <code>IOException</code>.
|
|
||||||
*
|
|
||||||
* @throws IOException as an indication that the mark feature doesn't supported by EqualizerInputStream.
|
|
||||||
*/
|
|
||||||
public void reset() throws IOException {
|
|
||||||
eq.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skips over and discards <code>n</code> bytes of data from this input
|
|
||||||
* stream. The <code>skip</code> method may, for a variety of reasons, end
|
|
||||||
* up skipping over some smaller number of bytes, possibly <code>0</code>.
|
|
||||||
* This may result from any of a number of conditions; reaching end of file
|
|
||||||
* before <code>n</code> bytes have been skipped is only one possibility.
|
|
||||||
* The actual number of bytes skipped is returned. If <code>n</code> is
|
|
||||||
* negative, no bytes are skipped.
|
|
||||||
*
|
|
||||||
* @param n the number of bytes to be skipped.
|
|
||||||
* @return the actual number of bytes skipped.
|
|
||||||
* @throws IOException if an I/O error occurs.
|
|
||||||
*/
|
|
||||||
public long skip(long n) throws IOException {
|
|
||||||
return eq.skip(n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
67
src/uk/co/majenko/audiobookrecorder/AGC.java
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class AGC implements Effect {
|
||||||
|
double limit;
|
||||||
|
double gain;
|
||||||
|
double ceiling;
|
||||||
|
double decay;
|
||||||
|
double attack;
|
||||||
|
|
||||||
|
public AGC(double c, double a, double d, double l) {
|
||||||
|
ceiling = c;
|
||||||
|
attack = a;
|
||||||
|
decay = d;
|
||||||
|
limit = l;
|
||||||
|
gain = 1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "AGC (Ceiling = " + ceiling + " attack = " + attack + " decay = " + decay + " limit = " + limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
gain = 1d;
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
double absSampleLeft = Math.abs(samples[i][Sentence.LEFT]) * gain;
|
||||||
|
double absSampleRight = Math.abs(samples[i][Sentence.RIGHT]) * gain;
|
||||||
|
|
||||||
|
double factor = 0.0d;
|
||||||
|
|
||||||
|
if (absSampleLeft > ceiling) {
|
||||||
|
factor = -attack;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (absSampleRight > ceiling) {
|
||||||
|
factor = -attack;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((absSampleLeft < ceiling) && (absSampleRight < ceiling)) {
|
||||||
|
factor = decay;
|
||||||
|
}
|
||||||
|
|
||||||
|
gain += factor;
|
||||||
|
if (gain > limit) gain = limit;
|
||||||
|
|
||||||
|
samples[i][Sentence.LEFT] *= gain;
|
||||||
|
samples[i][Sentence.RIGHT] *= gain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sr) {
|
||||||
|
gain = 1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/uk/co/majenko/audiobookrecorder/Amplifier.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Amplifier implements Effect {
|
||||||
|
double gain;
|
||||||
|
public Amplifier() {
|
||||||
|
gain = 1.0d;
|
||||||
|
}
|
||||||
|
public Amplifier(double g) {
|
||||||
|
gain = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Amplifier (" + gain + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
samples[i][Sentence.LEFT] *= gain;
|
||||||
|
samples[i][Sentence.RIGHT] *= gain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGain() {
|
||||||
|
return gain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGain(double g) {
|
||||||
|
gain = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
}
|
||||||
|
}
|
||||||
255
src/uk/co/majenko/audiobookrecorder/Biquad.java
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
// Biquad.java
|
||||||
|
//
|
||||||
|
// Created by Nigel Redmon on 11/24/12
|
||||||
|
// EarLevel Engineering: earlevel.com
|
||||||
|
// Copyright 2012 Nigel Redmon
|
||||||
|
// Translated to Java 2019 Majenko Technologies
|
||||||
|
//
|
||||||
|
// For a complete explanation of the Biquad code:
|
||||||
|
// http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/
|
||||||
|
//
|
||||||
|
// License:
|
||||||
|
//
|
||||||
|
// This source code is provided as is, without warranty.
|
||||||
|
// You may copy and distribute verbatim copies of this document.
|
||||||
|
// You may modify and use this source code to create binary code
|
||||||
|
// for your own purposes, free or commercial.
|
||||||
|
//
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Biquad implements Effect {
|
||||||
|
public static final int Lowpass = 0;
|
||||||
|
public static final int Highpass = 1;
|
||||||
|
public static final int Bandpass = 2;
|
||||||
|
public static final int Notch = 3;
|
||||||
|
public static final int Peak = 4;
|
||||||
|
public static final int Lowshelf = 5;
|
||||||
|
public static final int Highshelf = 6;
|
||||||
|
|
||||||
|
int type;
|
||||||
|
double a0, a1, a2, b1, b2;
|
||||||
|
double Fc, Q, peakGain;
|
||||||
|
double lz1, lz2;
|
||||||
|
double rz1, rz2;
|
||||||
|
double sampleFrequency;
|
||||||
|
|
||||||
|
public Biquad() {
|
||||||
|
type = Lowpass;
|
||||||
|
a0 = 1.0d;
|
||||||
|
a1 = 0.0d;
|
||||||
|
a2 = 0.0d;
|
||||||
|
b1 = 0.0d;
|
||||||
|
b2 = 0.0d;
|
||||||
|
Fc = 440d;
|
||||||
|
Q = 0.707d;
|
||||||
|
peakGain = 0.0d;
|
||||||
|
lz1 = 0.0d;
|
||||||
|
lz2 = 0.0d;
|
||||||
|
rz1 = 0.0d;
|
||||||
|
rz2 = 0.0d;
|
||||||
|
sampleFrequency = 44100d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Biquad(int type, double Fc, double Q, double peakGainDB) {
|
||||||
|
setBiquad(type, Fc, Q, peakGainDB);
|
||||||
|
lz1 = 0.0;
|
||||||
|
lz2 = 0.0;
|
||||||
|
rz1 = 0.0;
|
||||||
|
rz2 = 0.0;
|
||||||
|
sampleFrequency = 44100d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int typei) {
|
||||||
|
type = typei;
|
||||||
|
calcBiquad();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ(double Qi) {
|
||||||
|
Q = Qi;
|
||||||
|
calcBiquad();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFc(double Fci) {
|
||||||
|
Fc = Fci;
|
||||||
|
calcBiquad();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeakGain(double peakGainDB) {
|
||||||
|
peakGain = peakGainDB;
|
||||||
|
calcBiquad();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBiquad(int typei, double Fci, double Qi, double peakGainDB) {
|
||||||
|
type = typei;
|
||||||
|
Q = Qi;
|
||||||
|
Fc = Fci;
|
||||||
|
setPeakGain(peakGainDB);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
lz1 = 0d;
|
||||||
|
lz2 = 0d;
|
||||||
|
rz1 = 0d;
|
||||||
|
rz2 = 0d;
|
||||||
|
for (double[] in : samples) {
|
||||||
|
double lout = in[Sentence.LEFT] * a0 + lz1;
|
||||||
|
|
||||||
|
lz1 = in[Sentence.LEFT] * a1 + lz2 - b1 * lout;
|
||||||
|
lz2 = in[Sentence.LEFT] * a2 - b2 * lout;
|
||||||
|
|
||||||
|
double rout = in[Sentence.RIGHT] * a0 + rz1;
|
||||||
|
|
||||||
|
rz1 = in[Sentence.RIGHT] * a1 + rz2 - b1 * rout;
|
||||||
|
rz2 = in[Sentence.RIGHT] * a2 - b2 * rout;
|
||||||
|
|
||||||
|
in[Sentence.LEFT] = lout;
|
||||||
|
in[Sentence.RIGHT] = rout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
sampleFrequency = sf;
|
||||||
|
lz1 = 0d;
|
||||||
|
lz2 = 0d;
|
||||||
|
rz1 = 0d;
|
||||||
|
rz2 = 0d;
|
||||||
|
calcBiquad();
|
||||||
|
}
|
||||||
|
|
||||||
|
void calcBiquad() {
|
||||||
|
|
||||||
|
double norm;
|
||||||
|
double V = Math.pow(10, Math.abs(peakGain) / 20.0);
|
||||||
|
double K = Math.tan(Math.PI * (Fc/sampleFrequency));
|
||||||
|
switch (type) {
|
||||||
|
case Lowpass:
|
||||||
|
norm = 1d / (1d + K / Q + K * K);
|
||||||
|
a0 = K * K * norm;
|
||||||
|
a1 = 2d * a0;
|
||||||
|
a2 = a0;
|
||||||
|
b1 = 2d * (K * K - 1d) * norm;
|
||||||
|
b2 = (1d - K / Q + K * K) * norm;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Highpass:
|
||||||
|
norm = 1d / (1d + K / Q + K * K);
|
||||||
|
a0 = 1d * norm;
|
||||||
|
a1 = -2d * a0;
|
||||||
|
a2 = a0;
|
||||||
|
b1 = 2d * (K * K - 1d) * norm;
|
||||||
|
b2 = (1d - K / Q + K * K) * norm;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Bandpass:
|
||||||
|
norm = 1d / (1d + K / Q + K * K);
|
||||||
|
a0 = K / Q * norm;
|
||||||
|
a1 = 0d;
|
||||||
|
a2 = -a0;
|
||||||
|
b1 = 2d * (K * K - 1d) * norm;
|
||||||
|
b2 = (1d - K / Q + K * K) * norm;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Notch:
|
||||||
|
norm = 1d / (1d + K / Q + K * K);
|
||||||
|
a0 = (1d + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - 1d) * norm;
|
||||||
|
a2 = a0;
|
||||||
|
b1 = a1;
|
||||||
|
b2 = (1d - K / Q + K * K) * norm;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Peak:
|
||||||
|
if (peakGain >= 0d) { // boost
|
||||||
|
norm = 1d / (1d + 1d/Q * K + K * K);
|
||||||
|
a0 = (1d + V/Q * K + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - 1d) * norm;
|
||||||
|
a2 = (1d - V/Q * K + K * K) * norm;
|
||||||
|
b1 = a1;
|
||||||
|
b2 = (1d - 1d/Q * K + K * K) * norm;
|
||||||
|
}
|
||||||
|
else { // cut
|
||||||
|
norm = 1d / (1d + V/Q * K + K * K);
|
||||||
|
a0 = (1d + 1d/Q * K + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - 1d) * norm;
|
||||||
|
a2 = (1d - 1d/Q * K + K * K) * norm;
|
||||||
|
b1 = a1;
|
||||||
|
b2 = (1d - V/Q * K + K * K) * norm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Lowshelf:
|
||||||
|
if (peakGain >= 0) { // boost
|
||||||
|
norm = 1d / (1 + Math.sqrt(2d) * K + K * K);
|
||||||
|
a0 = (1d + Math.sqrt(2d*V) * K + V * K * K) * norm;
|
||||||
|
a1 = 2d * (V * K * K - 1d) * norm;
|
||||||
|
a2 = (1d - Math.sqrt(2d*V) * K + V * K * K) * norm;
|
||||||
|
b1 = 2d * (K * K - 1d) * norm;
|
||||||
|
b2 = (1d - Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
}
|
||||||
|
else { // cut
|
||||||
|
norm = 1d / (1 + Math.sqrt(2d*V) * K + V * K * K);
|
||||||
|
a0 = (1d + Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - 1d) * norm;
|
||||||
|
a2 = (1d - Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
b1 = 2d * (V * K * K - 1d) * norm;
|
||||||
|
b2 = (1d - Math.sqrt(2d*V) * K + V * K * K) * norm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Highshelf:
|
||||||
|
if (peakGain >= 0d) { // boost
|
||||||
|
norm = 1d / (1d + Math.sqrt(2d) * K + K * K);
|
||||||
|
a0 = (V + Math.sqrt(2d*V) * K + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - V) * norm;
|
||||||
|
a2 = (V - Math.sqrt(2d*V) * K + K * K) * norm;
|
||||||
|
b1 = 2d * (K * K - 1d) * norm;
|
||||||
|
b2 = (1d - Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
}
|
||||||
|
else { // cut
|
||||||
|
norm = 1d / (V + Math.sqrt(2d*V) * K + K * K);
|
||||||
|
a0 = (1d + Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
a1 = 2d * (K * K - 1d) * norm;
|
||||||
|
a2 = (1d - Math.sqrt(2d) * K + K * K) * norm;
|
||||||
|
b1 = 2d * (K * K - V) * norm;
|
||||||
|
b2 = (V - Math.sqrt(2d*V) * K + K * K) * norm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
String n = "Biquad Filter (";
|
||||||
|
switch (type) {
|
||||||
|
case Lowpass: n += "Lowpass"; break;
|
||||||
|
case Highpass: n += "Highpass"; break;
|
||||||
|
case Bandpass: n += "Bandpass"; break;
|
||||||
|
case Notch: n += "Notch"; break;
|
||||||
|
case Peak: n += "Peak"; break;
|
||||||
|
case Lowshelf: n += "Lowshelf"; break;
|
||||||
|
case Highshelf: n += "Highshelf"; break;
|
||||||
|
}
|
||||||
|
n += ", Fc=";
|
||||||
|
n += Fc;
|
||||||
|
n += ", Q=";
|
||||||
|
n += Q;
|
||||||
|
n += ", Gain=";
|
||||||
|
n += peakGain;
|
||||||
|
n += "dB)";
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ import java.util.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import javax.swing.tree.*;
|
import javax.swing.tree.*;
|
||||||
import davaguine.jeq.core.IIRControls;
|
|
||||||
import javax.sound.sampled.*;
|
import javax.sound.sampled.*;
|
||||||
|
|
||||||
public class Book extends DefaultMutableTreeNode {
|
public class Book extends DefaultMutableTreeNode {
|
||||||
@@ -17,6 +16,7 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
String author;
|
String author;
|
||||||
String genre;
|
String genre;
|
||||||
String comment;
|
String comment;
|
||||||
|
String ACX;
|
||||||
|
|
||||||
int sampleRate;
|
int sampleRate;
|
||||||
int channels;
|
int channels;
|
||||||
@@ -24,39 +24,25 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
|
|
||||||
ImageIcon icon;
|
ImageIcon icon;
|
||||||
|
|
||||||
public Equaliser equaliser;
|
Properties prefs;
|
||||||
|
|
||||||
float[] eqChannels = new float[31];
|
public Book(Properties p, String bookname) {
|
||||||
|
|
||||||
public Book(String bookname) {
|
|
||||||
super(bookname);
|
super(bookname);
|
||||||
|
|
||||||
|
prefs = p;
|
||||||
name = bookname;
|
name = bookname;
|
||||||
equaliser = new Equaliser();
|
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthor(String a) {
|
public void setAuthor(String a) { author = a; }
|
||||||
author = a;
|
public void setGenre(String g) { genre = g; }
|
||||||
}
|
public void setComment(String c) { comment = c; }
|
||||||
|
public void setACX(String c) { ACX = c; }
|
||||||
|
|
||||||
public void setGenre(String g) {
|
public String getAuthor() { return author; }
|
||||||
genre = g;
|
public String getGenre() { return genre; }
|
||||||
}
|
public String getComment() { return comment; }
|
||||||
|
public String getACX() { if (ACX == null) return ""; return ACX; }
|
||||||
public void setComment(String c) {
|
|
||||||
comment = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
|
||||||
return author;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGenre() {
|
|
||||||
return genre;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Chapter getClosingCredits() {
|
public Chapter getClosingCredits() {
|
||||||
return getChapterById("close");
|
return getChapterById("close");
|
||||||
@@ -124,23 +110,28 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
public void setUserObject(Object o) {
|
public void setUserObject(Object o) {
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
String newName = (String)o;
|
String newName = (String)o;
|
||||||
|
if (newName.equals(name)) return;
|
||||||
|
renameBook(newName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File oldDir = new File(Options.get("path.storage"), name);
|
public void renameBook(String newName) {
|
||||||
File newDir = new File(Options.get("path.storage"), newName);
|
File oldDir = new File(Options.get("path.storage"), name);
|
||||||
|
File newDir = new File(Options.get("path.storage"), newName);
|
||||||
|
|
||||||
if (newDir.exists()) {
|
if (newDir.exists()) {
|
||||||
JOptionPane.showMessageDialog(AudiobookRecorder.window, "Book already exists", "Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(AudiobookRecorder.window, "Book already exists", "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldDir.exists() && oldDir.isDirectory()) {
|
if (oldDir.exists() && oldDir.isDirectory()) {
|
||||||
oldDir.renameTo(newDir);
|
oldDir.renameTo(newDir);
|
||||||
name = newName;
|
name = newName;
|
||||||
AudiobookRecorder.window.saveBookStructure();
|
AudiobookRecorder.window.saveBookStructure();
|
||||||
AudiobookRecorder.window.bookTreeModel.reload(this);
|
AudiobookRecorder.window.bookTreeModel.reload(this);
|
||||||
Options.set("path.last-book", name);
|
Options.set("path.last-book", name);
|
||||||
Options.savePreferences();
|
Options.savePreferences();
|
||||||
}
|
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,4 +162,48 @@ public class Book extends DefaultMutableTreeNode {
|
|||||||
public AudioFormat getAudioFormat() {
|
public AudioFormat getAudioFormat() {
|
||||||
return new AudioFormat(getSampleRate(), getResolution(), getChannels(), true, false);
|
return new AudioFormat(getSampleRate(), getResolution(), getChannels(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String get(String key) {
|
||||||
|
if (prefs.getProperty(key) == null) { return Options.get(key); }
|
||||||
|
return prefs.getProperty(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getInteger(String key) {
|
||||||
|
if (prefs.getProperty(key) == null) { return Options.getInteger(key); }
|
||||||
|
return Utils.s2i(prefs.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String key, String value) {
|
||||||
|
prefs.setProperty(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String key, Integer value) {
|
||||||
|
prefs.setProperty(key, "" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getBookFolder() {
|
||||||
|
File dir = new File(Options.get("path.storage"), name);
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getUsedEffects() {
|
||||||
|
|
||||||
|
ArrayList<String> out = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
|
Object ob = (Object)o.nextElement();
|
||||||
|
if (ob instanceof Chapter) {
|
||||||
|
Chapter c = (Chapter)ob;
|
||||||
|
ArrayList<String> effs = c.getUsedEffects();
|
||||||
|
for (String ef : effs) {
|
||||||
|
if (out.indexOf(ef) == -1) {
|
||||||
|
out.add(ef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import javax.swing.*;
|
|||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
import java.util.regex.*;
|
||||||
|
|
||||||
public class BookInfoPanel extends JPanel {
|
public class BookInfoPanel extends JPanel {
|
||||||
|
|
||||||
@@ -11,8 +12,9 @@ public class BookInfoPanel extends JPanel {
|
|||||||
JTextField author;
|
JTextField author;
|
||||||
JTextField genre;
|
JTextField genre;
|
||||||
JTextField comment;
|
JTextField comment;
|
||||||
|
JTextField acx;
|
||||||
|
|
||||||
public BookInfoPanel(String t, String a, String g, String c) {
|
public BookInfoPanel(String t, String a, String g, String c, String x) {
|
||||||
super();
|
super();
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
GridBagConstraints con = new GridBagConstraints();
|
GridBagConstraints con = new GridBagConstraints();
|
||||||
@@ -56,37 +58,36 @@ public class BookInfoPanel extends JPanel {
|
|||||||
con.gridx = 0;
|
con.gridx = 0;
|
||||||
con.gridy++;
|
con.gridy++;
|
||||||
|
|
||||||
|
add(new JLabel("AXC Code:"), con);
|
||||||
|
con.gridx = 1;
|
||||||
|
acx = new JTextField(x);
|
||||||
|
acx.setPreferredSize(new Dimension(200, 20));
|
||||||
|
add(acx, con);
|
||||||
|
|
||||||
|
con.gridx = 0;
|
||||||
|
con.gridy++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() { return title.getText(); }
|
||||||
return title.getText();
|
public String getAuthor() { return author.getText(); }
|
||||||
|
public String getGenre() { return genre.getText(); }
|
||||||
|
public String getComment() { return comment.getText(); }
|
||||||
|
|
||||||
|
public String getACX() {
|
||||||
|
Pattern p = Pattern.compile("\\/titleview\\/([A-Z0-9]{14})");
|
||||||
|
Matcher m = p.matcher(acx.getText());
|
||||||
|
if (m.find()) {
|
||||||
|
System.err.println(m);
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
return acx.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthor() {
|
public void setTitle(String t) { title.setText(t); }
|
||||||
return author.getText();
|
public void setAuthor(String a) { author.setText(a); }
|
||||||
}
|
public void setGenre(String g) { genre.setText(g); }
|
||||||
|
public void setComment(String c) { comment.setText(c); }
|
||||||
|
public void setACX(String a) { acx.setText(a); }
|
||||||
|
|
||||||
public String getGenre() {
|
|
||||||
return genre.getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment.getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String t) {
|
|
||||||
title.setText(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthor(String a) {
|
|
||||||
author.setText(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenre(String g) {
|
|
||||||
genre.setText(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String c) {
|
|
||||||
comment.setText(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,24 +28,48 @@ public class BookPanel extends JPanel {
|
|||||||
|
|
||||||
boolean highlight = false;
|
boolean highlight = false;
|
||||||
|
|
||||||
|
public BookPanel(Properties p, ImageIcon i) {
|
||||||
|
loadBookData(p, i);
|
||||||
|
}
|
||||||
|
|
||||||
public BookPanel(File r) {
|
public BookPanel(File r) {
|
||||||
try {
|
try {
|
||||||
root = r;
|
root = r;
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.loadFromXML(new FileInputStream(new File(root, "audiobook.abk")));
|
props.loadFromXML(new FileInputStream(new File(root, "audiobook.abk")));
|
||||||
|
loadBookData(props, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadBookData(Properties props, ImageIcon i) {
|
||||||
|
try {
|
||||||
name = props.getProperty("book.name");
|
name = props.getProperty("book.name");
|
||||||
author = props.getProperty("book.author");
|
author = props.getProperty("book.author");
|
||||||
genre = props.getProperty("book.genre");
|
genre = props.getProperty("book.genre");
|
||||||
comment = props.getProperty("book.comment");
|
comment = props.getProperty("book.comment");
|
||||||
File icon = new File(root, "coverart.png");
|
if (i == null) {
|
||||||
if (icon.exists()) {
|
File icon = new File(root, "coverart.png");
|
||||||
cover = new ImageIcon(icon.getAbsolutePath());
|
if (!icon.exists()) {
|
||||||
|
icon = new File(root, "coverart.jpg");
|
||||||
|
}
|
||||||
|
if (!icon.exists()) {
|
||||||
|
icon = new File(root, "coverart.gif");
|
||||||
|
}
|
||||||
|
if (icon.exists()) {
|
||||||
|
cover = new ImageIcon(icon.getAbsolutePath());
|
||||||
|
resizedCover = Utils.getScaledImage(cover.getImage(), 75, 75);
|
||||||
|
iconLabel = new JLabel(new ImageIcon(resizedCover));
|
||||||
|
} else {
|
||||||
|
cover = null;
|
||||||
|
resizedCover = null;
|
||||||
|
iconLabel = new JLabel("");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cover = i;
|
||||||
resizedCover = Utils.getScaledImage(cover.getImage(), 75, 75);
|
resizedCover = Utils.getScaledImage(cover.getImage(), 75, 75);
|
||||||
iconLabel = new JLabel(new ImageIcon(resizedCover));
|
iconLabel = new JLabel(new ImageIcon(resizedCover));
|
||||||
} else {
|
|
||||||
cover = null;
|
|
||||||
resizedCover = null;
|
|
||||||
iconLabel = new JLabel("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iconLabel.setSize(new Dimension(75, 75));
|
iconLabel.setSize(new Dimension(75, 75));
|
||||||
|
|||||||
@@ -3,26 +3,67 @@ package uk.co.majenko.audiobookrecorder;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.tree.*;
|
import javax.swing.tree.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import javax.swing.border.*;
|
||||||
|
|
||||||
public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
public class BookTreeRenderer extends DefaultTreeCellRenderer {
|
||||||
|
|
||||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
||||||
JLabel ret = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
JLabel ret = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||||
|
ret.setIconTextGap(0);
|
||||||
|
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||||
if (value instanceof Sentence) {
|
if (value instanceof Sentence) {
|
||||||
Sentence s = (Sentence)value;
|
Sentence s = (Sentence)value;
|
||||||
|
|
||||||
if (s.isLocked()) {
|
OverlayIcon icn = new OverlayIcon(Icons.sentence);
|
||||||
ret.setForeground(new Color(0x20, 0x00, 0x00));
|
|
||||||
ret.setIcon(Icons.locked);
|
if (s.getOverrideText() != null) {
|
||||||
} else if (s.getStartOffset() == 0) {
|
ret.setText(s.getOverrideText());
|
||||||
ret.setIcon(Icons.important);
|
|
||||||
} else {
|
|
||||||
ret.setIcon(Icons.sentence);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.isInSample()) {
|
if (s.getAttentionFlag()) {
|
||||||
ret.setIcon(Icons.star);
|
ret.setForeground(new Color(0xFF, 0xFF, 0x00));
|
||||||
|
icn.add(Overlays.attention, OverlayIcon.TOP_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.isLocked()) {
|
||||||
|
ret.setForeground(new Color(0x00, 0x80, 0xFF));
|
||||||
|
icn.add(Overlays.locked, OverlayIcon.BOTTOM_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.getStartOffset() == 0) {
|
||||||
|
icn.add(Overlays.important, OverlayIcon.TOP_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.getEffectChain() != null) {
|
||||||
|
if (!s.getEffectChain().equals("none")) {
|
||||||
|
icn.add(Overlays.filter, OverlayIcon.BOTTOM_RIGHT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.setIcon(icn);
|
||||||
|
|
||||||
|
String gaptype = s.getPostGapType();
|
||||||
|
DefaultMutableTreeNode prev = s.getPreviousSibling();
|
||||||
|
String prevtype = "sentence";
|
||||||
|
if (prev instanceof Sentence) {
|
||||||
|
Sentence s2 = (Sentence)prev;
|
||||||
|
prevtype = s2.getPostGapType();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevtype.equals("continuation")) {
|
||||||
|
ret.setIconTextGap(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gaptype.equals("sentence")) {
|
||||||
|
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||||
|
} else if (gaptype.equals("continuation")) {
|
||||||
|
ret.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||||
|
} else if (gaptype.equals("paragraph")) {
|
||||||
|
ret.setBorder(new EmptyBorder(0, 0, 7, 0));
|
||||||
|
} else if (gaptype.equals("section")) {
|
||||||
|
ret.setBorder(new EmptyBorder(0, 0, 15, 0));
|
||||||
|
}
|
||||||
|
|
||||||
} else if (value instanceof Chapter) {
|
} else if (value instanceof Chapter) {
|
||||||
ret.setIcon(Icons.chapter);
|
ret.setIcon(Icons.chapter);
|
||||||
} else if (value instanceof Book) {
|
} else if (value instanceof Book) {
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ public class CacheManager {
|
|||||||
if (ob.lockedInCache()) {
|
if (ob.lockedInCache()) {
|
||||||
cache.add(ob);
|
cache.add(ob);
|
||||||
} else {
|
} else {
|
||||||
|
if (ob instanceof Sentence) {
|
||||||
|
Sentence s = (Sentence)ob;
|
||||||
|
}
|
||||||
ob.clearCache();
|
ob.clearCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,4 +26,12 @@ public class CacheManager {
|
|||||||
public static void setCacheSize(int c) {
|
public static void setCacheSize(int c) {
|
||||||
cacheSize = c;
|
cacheSize = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeFromCache(Cacheable c) {
|
||||||
|
if (c instanceof Sentence) {
|
||||||
|
Sentence s = (Sentence)c;
|
||||||
|
}
|
||||||
|
cache.remove(c);
|
||||||
|
c.clearCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
58
src/uk/co/majenko/audiobookrecorder/Chain.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Chain implements Effect {
|
||||||
|
String target;
|
||||||
|
|
||||||
|
public Chain(String t) {
|
||||||
|
target = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chain() {
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
if (target != null) {
|
||||||
|
Effect t = AudiobookRecorder.window.effects.get(target);
|
||||||
|
if (t != null) {
|
||||||
|
t.process(samples);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(String t) {
|
||||||
|
target = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "Chain to " + target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
if (target != null) {
|
||||||
|
Effect t = AudiobookRecorder.window.effects.get(target);
|
||||||
|
if (t != null) {
|
||||||
|
t.init(sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -81,7 +81,7 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void exportChapter(ExportDialog exportDialog) throws
|
public void exportChapter(ProgressDialog exportDialog) throws
|
||||||
FileNotFoundException, IOException, InputFormatException, NotSupportedException,
|
FileNotFoundException, IOException, InputFormatException, NotSupportedException,
|
||||||
EncoderException, UnsupportedTagException, InvalidDataException {
|
EncoderException, UnsupportedTagException, InvalidDataException {
|
||||||
|
|
||||||
@@ -121,7 +121,8 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
attributes.setAudioAttributes(audioAttributes);
|
attributes.setAudioAttributes(audioAttributes);
|
||||||
|
|
||||||
|
|
||||||
AudioFormat format = AudiobookRecorder.window.roomNoise.getAudioFormat();
|
AudioFormat sampleformat = AudiobookRecorder.window.roomNoise.getAudioFormat();
|
||||||
|
AudioFormat format = new AudioFormat(sampleformat.getSampleRate(), 16, 2, true, false);
|
||||||
byte[] data;
|
byte[] data;
|
||||||
|
|
||||||
int fullLength = 0;
|
int fullLength = 0;
|
||||||
@@ -135,7 +136,7 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
File exportFile = new File(export, name + ".wax");
|
File exportFile = new File(export, name + ".wax");
|
||||||
File wavFile = new File(export, name + ".wav");
|
File wavFile = new File(export, name + ".wav");
|
||||||
File mp3File = new File(export, name + "-untagged.mp3");
|
File mp3File = new File(export, name + "-untagged.mp3");
|
||||||
File taggedFile = new File(export, name + ".mp3");
|
File taggedFile = new File(export, book.getName() + " - " + name + ".mp3");
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream(exportFile);
|
FileOutputStream fos = new FileOutputStream(exportFile);
|
||||||
data = AudiobookRecorder.window.getRoomNoise(Utils.s2i(Options.get("catenation.pre-chapter")));
|
data = AudiobookRecorder.window.getRoomNoise(Utils.s2i(Options.get("catenation.pre-chapter")));
|
||||||
@@ -149,7 +150,7 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
kidno++;
|
kidno++;
|
||||||
if (exportDialog != null) exportDialog.setProgress(kidno * 1000 / kids);
|
if (exportDialog != null) exportDialog.setProgress(kidno * 1000 / kids);
|
||||||
Sentence snt = (Sentence)s.nextElement();
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
data = snt.getRawAudioData();
|
data = snt.getPCMData();
|
||||||
|
|
||||||
fullLength += data.length;
|
fullLength += data.length;
|
||||||
fos.write(data);
|
fos.write(data);
|
||||||
@@ -200,4 +201,42 @@ public class Chapter extends DefaultMutableTreeNode {
|
|||||||
wavFile.delete();
|
wavFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getChapterLength() {
|
||||||
|
double totalTime = Options.getInteger("audio.recording.pre-chapter") / 1000d;
|
||||||
|
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||||
|
Sentence sentence = (Sentence)s.nextElement();
|
||||||
|
totalTime += sentence.getLength();
|
||||||
|
if (s.hasMoreElements()) {
|
||||||
|
totalTime += (sentence.getPostGap() / 1000d);
|
||||||
|
} else {
|
||||||
|
totalTime += Options.getInteger("audio.recording.post-chapter") / 1000d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return totalTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getUsedEffects() {
|
||||||
|
|
||||||
|
ArrayList<String> out = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (Enumeration o = children(); o.hasMoreElements();) {
|
||||||
|
Object ob = (Object)o.nextElement();
|
||||||
|
if (ob instanceof Sentence) {
|
||||||
|
Sentence s = (Sentence)ob;
|
||||||
|
String ec = s.getEffectChain();
|
||||||
|
if (out.indexOf(ec) == -1) {
|
||||||
|
out.add(ec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetPostGaps() {
|
||||||
|
for (Enumeration s = children(); s.hasMoreElements();) {
|
||||||
|
Sentence snt = (Sentence)s.nextElement();
|
||||||
|
snt.resetPostGap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/uk/co/majenko/audiobookrecorder/Clipping.java
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Clipping implements Effect {
|
||||||
|
double clip;
|
||||||
|
public Clipping() {
|
||||||
|
clip = 1.0d;
|
||||||
|
}
|
||||||
|
public Clipping(double g) {
|
||||||
|
clip = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Clipping (" + clip + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
for (double[] sample : samples) {
|
||||||
|
if (sample[Sentence.LEFT] > clip) sample[Sentence.LEFT] = clip;
|
||||||
|
if (sample[Sentence.LEFT] < -clip) sample[Sentence.LEFT] = -clip;
|
||||||
|
if (sample[Sentence.RIGHT] > clip) sample[Sentence.RIGHT] = clip;
|
||||||
|
if (sample[Sentence.RIGHT] < -clip) sample[Sentence.RIGHT] = -clip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getClip() {
|
||||||
|
return clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClip(double g) {
|
||||||
|
clip = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/uk/co/majenko/audiobookrecorder/Debug.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
public class Debug {
|
||||||
|
static long timestamp;
|
||||||
|
|
||||||
|
static void debug(String msg) {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
long diff = now - timestamp;
|
||||||
|
timestamp = now;
|
||||||
|
System.err.println(String.format("%8d - %s", diff, msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
115
src/uk/co/majenko/audiobookrecorder/DelayLine.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class DelayLine implements Effect {
|
||||||
|
|
||||||
|
ArrayList<DelayLineStore> delayLines;
|
||||||
|
|
||||||
|
boolean wetOnly = false;
|
||||||
|
|
||||||
|
public DelayLine() {
|
||||||
|
delayLines = new ArrayList<DelayLineStore>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Delay Line (" + delayLines.size() + " lines)";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
double[][] savedSamples = new double[samples.length][2];
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
savedSamples[i][Sentence.LEFT] = samples[i][Sentence.LEFT];
|
||||||
|
savedSamples[i][Sentence.RIGHT] = samples[i][Sentence.RIGHT];
|
||||||
|
}
|
||||||
|
if (wetOnly) {
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
samples[i][Sentence.LEFT] = 0d;
|
||||||
|
samples[i][Sentence.RIGHT] = 0d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double[][] subSamples = new double[samples.length][2];
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
subSamples[i][Sentence.LEFT] = savedSamples[i][Sentence.LEFT];
|
||||||
|
subSamples[i][Sentence.RIGHT] = savedSamples[i][Sentence.RIGHT];
|
||||||
|
}
|
||||||
|
for (DelayLineStore d : delayLines) {
|
||||||
|
for (int i = 0; i < samples.length; i++) {
|
||||||
|
subSamples[i][Sentence.LEFT] = savedSamples[i][Sentence.LEFT];
|
||||||
|
subSamples[i][Sentence.RIGHT] = savedSamples[i][Sentence.RIGHT];
|
||||||
|
}
|
||||||
|
|
||||||
|
d.process(subSamples);
|
||||||
|
|
||||||
|
for (int i = 0; i < subSamples.length; i++) {
|
||||||
|
int off = i + d.getSamples();
|
||||||
|
if ((off < samples.length) && (off > 0)) {
|
||||||
|
|
||||||
|
double[] ns = mix(samples[off], subSamples[i]);
|
||||||
|
samples[off][Sentence.LEFT] = ns[Sentence.LEFT];
|
||||||
|
samples[off][Sentence.RIGHT] = ns[Sentence.RIGHT];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] mix(double[] a, double[] b) {
|
||||||
|
double[] out = new double[2];
|
||||||
|
|
||||||
|
if ((a[Sentence.LEFT] < 0) && (b[Sentence.LEFT] < 0)) {
|
||||||
|
out[Sentence.LEFT] = (a[Sentence.LEFT] + b[Sentence.LEFT]) - (a[Sentence.LEFT] * b[Sentence.LEFT]);
|
||||||
|
} else if ((a[Sentence.LEFT] > 0) && (b[Sentence.LEFT] > 0)) {
|
||||||
|
out[Sentence.LEFT] = (a[Sentence.LEFT] + b[Sentence.LEFT]) - (a[Sentence.LEFT] * b[Sentence.LEFT]);
|
||||||
|
} else {
|
||||||
|
out[Sentence.LEFT] = a[Sentence.LEFT] + b[Sentence.LEFT];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((a[Sentence.RIGHT] < 0) && (b[Sentence.RIGHT] < 0)) {
|
||||||
|
out[Sentence.RIGHT] = (a[Sentence.RIGHT] + b[Sentence.RIGHT]) - (a[Sentence.RIGHT] * b[Sentence.RIGHT]);
|
||||||
|
} else if ((a[Sentence.RIGHT] > 0) && (b[Sentence.RIGHT] > 0)) {
|
||||||
|
out[Sentence.RIGHT] = (a[Sentence.RIGHT] + b[Sentence.RIGHT]) - (a[Sentence.RIGHT] * b[Sentence.RIGHT]);
|
||||||
|
} else {
|
||||||
|
out[Sentence.RIGHT] = a[Sentence.RIGHT] + b[Sentence.RIGHT];
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelayLineStore addDelayLine(int samples, double gain, double pan) {
|
||||||
|
DelayLineStore s = new DelayLineStore(samples, gain, pan);
|
||||||
|
delayLines.add(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelayLineStore addDelayLine(int samples, double gain) {
|
||||||
|
DelayLineStore s = new DelayLineStore(samples, gain);
|
||||||
|
delayLines.add(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
for (DelayLineStore s : delayLines) {
|
||||||
|
s.dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
for (DelayLineStore s : delayLines) {
|
||||||
|
s.init(sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWetOnly(boolean b) {
|
||||||
|
wetOnly = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
78
src/uk/co/majenko/audiobookrecorder/DelayLineStore.java
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class DelayLineStore {
|
||||||
|
double gain;
|
||||||
|
int numSamples;
|
||||||
|
double pan;
|
||||||
|
|
||||||
|
ArrayList<Effect> effects;
|
||||||
|
|
||||||
|
public DelayLineStore(int s, double g, double p) {
|
||||||
|
numSamples = s;
|
||||||
|
gain = g;
|
||||||
|
pan = p;
|
||||||
|
effects = new ArrayList<Effect>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelayLineStore(int s, double g) {
|
||||||
|
numSamples = s;
|
||||||
|
gain = g;
|
||||||
|
pan = 0d;
|
||||||
|
effects = new ArrayList<Effect>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.process(samples);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (double[] sample : samples) {
|
||||||
|
sample[Sentence.LEFT] *= gain;
|
||||||
|
sample[Sentence.RIGHT] *= gain;
|
||||||
|
|
||||||
|
if (pan < 0) {
|
||||||
|
double p = 1 + pan;
|
||||||
|
sample[Sentence.RIGHT] *= p;
|
||||||
|
} else {
|
||||||
|
double p = 1 - pan;
|
||||||
|
sample[Sentence.LEFT] *= p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSamples(int s) {
|
||||||
|
numSamples = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGain(double g) {
|
||||||
|
gain = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSamples() {
|
||||||
|
return numSamples;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGain() {
|
||||||
|
return gain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEffect(Effect e) {
|
||||||
|
effects.add(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.init(sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(" Samples: " + numSamples + ", gain: " + gain);
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
src/uk/co/majenko/audiobookrecorder/DonationPanel.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import javax.swing.border.*;
|
||||||
|
import java.net.*;
|
||||||
|
|
||||||
|
public class DonationPanel extends JPanel {
|
||||||
|
public DonationPanel() {
|
||||||
|
super();
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
JLabel icon = new JLabel(Icons.dollar);
|
||||||
|
icon.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
add(icon, BorderLayout.WEST);
|
||||||
|
|
||||||
|
JTextArea label = new JTextArea(
|
||||||
|
"Thank you for using AudiobookRecorder by\n" +
|
||||||
|
"Majenko Technologies. This software is\n" +
|
||||||
|
"Free Open Source Software (FOSS). It is\n" +
|
||||||
|
"created and maintained voluntarily with\n" +
|
||||||
|
"no possibility of any profits from it.\n" +
|
||||||
|
"If you enjoy using this software and end\n" +
|
||||||
|
"up making millions of dollars from using\n" +
|
||||||
|
"it we hope that you would maybe kindly\n" +
|
||||||
|
"donate a couple of those dollars to the\n" +
|
||||||
|
"developer to help with the costs of maintaining\n" +
|
||||||
|
"the software.\n" +
|
||||||
|
"\n" +
|
||||||
|
"You can donate by going to:\n" +
|
||||||
|
"\n" +
|
||||||
|
"https://paypal.me/majenko"
|
||||||
|
);
|
||||||
|
|
||||||
|
label.setEditable(false);
|
||||||
|
label.setFocusable(false);
|
||||||
|
label.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
add(label, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
JButton donate = new JButton("Donate!");
|
||||||
|
donate.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
Utils.browse("https://paypal.me/majenko");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
add(donate, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/uk/co/majenko/audiobookrecorder/Effect.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public interface Effect {
|
||||||
|
public void process(double[][] samples);
|
||||||
|
public String getName();
|
||||||
|
public ArrayList<Effect> getChildEffects();
|
||||||
|
public void dump();
|
||||||
|
public void init(double sr);
|
||||||
|
public String toString();
|
||||||
|
}
|
||||||
69
src/uk/co/majenko/audiobookrecorder/EffectGroup.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class EffectGroup implements Effect {
|
||||||
|
String name;
|
||||||
|
ArrayList<Effect> effects;
|
||||||
|
|
||||||
|
public EffectGroup(String n) {
|
||||||
|
name = n;
|
||||||
|
effects = new ArrayList<Effect>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public EffectGroup() {
|
||||||
|
name = "Unnamed Group";
|
||||||
|
effects = new ArrayList<Effect>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(double[][] samples) {
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.process(samples);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String n) {
|
||||||
|
name = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEffect(Effect e) {
|
||||||
|
effects.add(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearEffects() {
|
||||||
|
effects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeEffect(Effect e) {
|
||||||
|
effects.remove(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeEffect(int n) {
|
||||||
|
effects.remove(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return effects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString() + " >> ");
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
for (Effect e : effects) {
|
||||||
|
e.init(sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
package uk.co.majenko.audiobookrecorder;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.event.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.file.*;
|
|
||||||
import javax.swing.tree.*;
|
|
||||||
import javax.sound.sampled.*;
|
|
||||||
import davaguine.jeq.core.IIRControls;
|
|
||||||
|
|
||||||
public class Equaliser extends JPanel {
|
|
||||||
|
|
||||||
EqualiserChannel channels[];
|
|
||||||
|
|
||||||
static final double[] frequencies = {
|
|
||||||
20d, 25d, 31.5d, 40d, 50d, 63d, 80d, 100d, 125d, 160d, 200d,
|
|
||||||
250d, 315d, 400d, 500d, 630d, 800d, 1000d, 1250d, 1600d, 2000d,
|
|
||||||
2500d, 3150d, 4000d, 5000d, 6300d, 8000d, 10000d, 12500d, 16000d,
|
|
||||||
20000d
|
|
||||||
};
|
|
||||||
|
|
||||||
public Equaliser() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
channels = new EqualiserChannel[31];
|
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
|
||||||
|
|
||||||
JPanel inner = new JPanel();
|
|
||||||
|
|
||||||
inner.setLayout(new FlowLayout());
|
|
||||||
|
|
||||||
for (int i = 0; i < 31; i++) {
|
|
||||||
channels[i] = new EqualiserChannel(frequencies[i]);
|
|
||||||
inner.add(channels[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
add(inner, BorderLayout.CENTER);
|
|
||||||
|
|
||||||
|
|
||||||
JButton smooth = new JButton("Smooth curve");
|
|
||||||
smooth.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Float ave[] = new Float[31];
|
|
||||||
for (int i = 1; i < 30; i++) {
|
|
||||||
ave[i] = (channels[i-1].getValue() + channels[i].getValue() + channels[i+1].getValue()) / 3.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < 30; i++) {
|
|
||||||
channels[i].setValue(ave[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
JButton def = new JButton("Set as default");
|
|
||||||
def.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
for (int i = 0; i < 31; i++) {
|
|
||||||
Options.set("audio.eq." + i, channels[i].getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
JButton load = new JButton("Load from default");
|
|
||||||
load.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
for (int i = 0; i < 31; i++) {
|
|
||||||
channels[i].setValue(Options.getFloat("audio.eq." + i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JPanel buttons = new JPanel();
|
|
||||||
buttons.setLayout(new FlowLayout());
|
|
||||||
buttons.add(smooth);
|
|
||||||
buttons.add(def);
|
|
||||||
buttons.add(load);
|
|
||||||
|
|
||||||
add(buttons, BorderLayout.SOUTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getChannel(int c) {
|
|
||||||
return channels[c].getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChannel(int c, float v) {
|
|
||||||
channels[c].setValue(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void apply(IIRControls c, int chans) {
|
|
||||||
for (int i = 0; i < 31; i++) {
|
|
||||||
c.setBandDbValue(i, 0, channels[i].getValue());
|
|
||||||
if (chans == 2) {
|
|
||||||
c.setBandDbValue(i, 1, channels[i].getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
package uk.co.majenko.audiobookrecorder;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.event.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.file.*;
|
|
||||||
import javax.swing.tree.*;
|
|
||||||
import javax.sound.sampled.*;
|
|
||||||
|
|
||||||
public class EqualiserChannel extends JPanel {
|
|
||||||
|
|
||||||
float value;
|
|
||||||
JSlider slider;
|
|
||||||
JTextField textbox;
|
|
||||||
JLabel frequency;
|
|
||||||
|
|
||||||
public EqualiserChannel(double freq) {
|
|
||||||
super();
|
|
||||||
|
|
||||||
|
|
||||||
value = 0;
|
|
||||||
|
|
||||||
slider = new JSlider(-120, 120, 0);
|
|
||||||
textbox = new JTextField();
|
|
||||||
|
|
||||||
String suffix = "Hz";
|
|
||||||
if (freq > 1000) {
|
|
||||||
freq /= 1000;
|
|
||||||
suffix = "kHz";
|
|
||||||
}
|
|
||||||
|
|
||||||
String ftxt = String.format("%.4f", freq);
|
|
||||||
while (ftxt.endsWith("0")) {
|
|
||||||
ftxt = ftxt.substring(0, ftxt.length() - 1);
|
|
||||||
}
|
|
||||||
if (ftxt.endsWith(".")) {
|
|
||||||
ftxt = ftxt.substring(0, ftxt.length() - 1);
|
|
||||||
}
|
|
||||||
frequency = new JLabel(ftxt + suffix);
|
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
|
||||||
|
|
||||||
add(frequency, BorderLayout.NORTH);
|
|
||||||
slider.setOrientation(SwingConstants.VERTICAL);
|
|
||||||
add(slider, BorderLayout.CENTER);
|
|
||||||
textbox = new JTextField("0.0");
|
|
||||||
add(textbox, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
textbox.setPreferredSize(new Dimension(40, 20));
|
|
||||||
slider.addChangeListener(new ChangeListener() {
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
|
||||||
value = (float)slider.getValue() / 10.0f;
|
|
||||||
textbox.setText(String.format("%.1f", value));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
textbox.addFocusListener(new FocusListener() {
|
|
||||||
public void focusGained(FocusEvent e) {
|
|
||||||
textbox.selectAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void focusLost(FocusEvent e) {
|
|
||||||
value = Utils.s2f(textbox.getText());
|
|
||||||
if (value < -12f) value = -12f;
|
|
||||||
if (value > 12f) value = 12f;
|
|
||||||
|
|
||||||
slider.setValue((int)(value * 10));
|
|
||||||
textbox.setText(String.format("%.1f", value));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
textbox.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
value = Utils.s2f(textbox.getText());
|
|
||||||
if (value < -12f) value = -12f;
|
|
||||||
if (value > 12f) value = 12f;
|
|
||||||
|
|
||||||
slider.setValue((int)(value * 10));
|
|
||||||
textbox.setText(String.format("%.1f", value));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(float v) {
|
|
||||||
value = v;
|
|
||||||
slider.setValue((int)(value * 10));
|
|
||||||
textbox.setText(String.format("%.1f", value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,6 +27,8 @@ public class FlashPanel extends JPanel {
|
|||||||
public void setFlash(boolean f) {
|
public void setFlash(boolean f) {
|
||||||
flash = f;
|
flash = f;
|
||||||
|
|
||||||
|
col = true;
|
||||||
|
|
||||||
for (Component o : getComponents()) {
|
for (Component o : getComponents()) {
|
||||||
((JComponent)o).setVisible(!f);
|
((JComponent)o).setVisible(!f);
|
||||||
}
|
}
|
||||||
@@ -42,7 +44,7 @@ public class FlashPanel extends JPanel {
|
|||||||
if (col) {
|
if (col) {
|
||||||
g.setColor(Color.RED);
|
g.setColor(Color.RED);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.GREEN);
|
||||||
}
|
}
|
||||||
Dimension d = getSize();
|
Dimension d = getSize();
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
|
|||||||