diff options
Diffstat (limited to 'tests/com/jsyn/examples')
-rw-r--r-- | tests/com/jsyn/examples/ListAudioDevices.java | 2 | ||||
-rw-r--r-- | tests/com/jsyn/examples/PlayChords.java | 12 |
2 files changed, 3 insertions, 11 deletions
diff --git a/tests/com/jsyn/examples/ListAudioDevices.java b/tests/com/jsyn/examples/ListAudioDevices.java index 6c5372d..dceaa0d 100644 --- a/tests/com/jsyn/examples/ListAudioDevices.java +++ b/tests/com/jsyn/examples/ListAudioDevices.java @@ -33,7 +33,7 @@ public class ListAudioDevices { int maxInputs = audioManager.getMaxInputChannels(i); int maxOutputs = audioManager.getMaxInputChannels(i); boolean isDefaultInput = (i == audioManager.getDefaultInputDeviceID()); - boolean isDefaultOutput = (i == audioManager.getDefaultInputDeviceID()); + boolean isDefaultOutput = (i == audioManager.getDefaultOutputDeviceID()); System.out.println("#" + i + " : " + deviceName); System.out.println(" max inputs : " + maxInputs + (isDefaultInput ? " (default)" : "")); diff --git a/tests/com/jsyn/examples/PlayChords.java b/tests/com/jsyn/examples/PlayChords.java index 0b1ae2e..28cab5f 100644 --- a/tests/com/jsyn/examples/PlayChords.java +++ b/tests/com/jsyn/examples/PlayChords.java @@ -22,6 +22,7 @@ import com.jsyn.instruments.SubtractiveSynthVoice; import com.jsyn.unitgen.LineOut; import com.jsyn.unitgen.UnitVoice; import com.jsyn.util.VoiceAllocator; +import com.softsynth.math.AudioMath; import com.softsynth.shared.time.TimeStamp; /** @@ -167,21 +168,12 @@ public class PlayChords { } private void noteOn(double time, int noteNumber) { - double frequency = convertPitchToFrequency(noteNumber); + double frequency = AudioMath.pitchToFrequency(noteNumber); double amplitude = 0.2; TimeStamp timeStamp = new TimeStamp(time); allocator.noteOn(noteNumber, frequency, amplitude, timeStamp); } - /** - * Calculate frequency in Hertz based on MIDI pitch. Middle C is 60.0. You can use fractional - * pitches so 60.5 would give you a pitch half way between C and C#. - */ - double convertPitchToFrequency(double pitch) { - final double concertA = 440.0; - return concertA * Math.pow(2.0, ((pitch - 69) * (1.0 / 12.0))); - } - public static void main(String[] args) { new PlayChords().test(); } |