# HG changeset patch # User Robert McIntyre # Date 1319573015 25200 # Node ID c41d773a85fbfde41add87efe00f0b049c78bf98 # Parent f9476ff7637e712bc783424e6a37ce0adfb2c84d moved org files, ignored html files diff -r f9476ff7637e -r c41d773a85fb .hgignore --- a/.hgignore Tue Oct 25 13:02:31 2011 -0700 +++ b/.hgignore Tue Oct 25 13:03:35 2011 -0700 @@ -1,3 +1,3 @@ syntax: glob build* - +html* diff -r f9476ff7637e -r c41d773a85fb bugs-in-openal.org --- a/bugs-in-openal.org Tue Oct 25 13:02:31 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -* bugs in OpenAl-soft - -Wave files produced by wave writer do not have the correct header. - -something is wrong with - -#+begin_src conf -drivers = null, -#+end_src - -It only produces the single null option when queried with -ALC_ALL_DEVICES_SPECIFIER, where it should produce much more output. - -specifically, - ------------------------------- -#+begin_src conf -drivers = oss, -#+end_src - -#+begin_src text -0: OSS Software -1: PulseAudio Software -2: ALSA Software on default -3: ALSA Software on HDA Intel [ALC272 Analog] (hw:0,0) -4: ALSA Software on HDA Intel [ALC272 Digital] (hw:0,1) -5: ALSA Software on HDA Intel [INTEL HDMI] (hw:0,3) -6: PortAudio Software -7: Wave File Writer -#+end_src ------------------------------- -#+begin_src conf -drivers = pulse, -#+end_src - -#+begin_src text -Devices -0: Internal Audio Analog Stereo -#+end_src ------------------------------- -#+begin_src conf -drivers = wave, -#+end_src - -#+begin_src text -Devices -0: Wave File Writer -#+end_src ------------------------------- - diff -r f9476ff7637e -r c41d773a85fb device_details.org --- a/device_details.org Tue Oct 25 13:02:31 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -* a device has a two names, - - *name*, which is the filename and which appears before all of the functions. - - *trueName*, which is a string that is used to summon the device. - - -Every device has the *_data* struct, which is where all the -device specific state is located. - -In the function *_open_playback*, the device is initialized, -here the trueName is set, and the devices data is initialized. - -The ALCdevice's ExtraData field must always be cast to to the actual -data struct that the device uses. - - - -the =open_playback= function is where everything is initialized, - - -but the =reset_playback= is where the actual thread which is the heart -of the device is started. - - -every device has a Proc function which takes a pointer to an -ALCdevice and is run in a separate thread. It is this procedure that -actually does stuff with sound data. - - -It is the ALContext which controls the particulars of a listener. - -The context contains the device. - -* so do we need a new context for each listener, alone with their own -devices? - -However, the device also maintains a *list* of contexts... - diff -r f9476ff7637e -r c41d773a85fb ear.html --- a/ear.html Tue Oct 25 13:02:31 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ - - - - -The EARS! - - - - - - - - - - - - - -
- - - -
-
- -
- -

aurellem

- -
- -

The EARS!

-
Written by Robert McIntyre
- - - - - - - - - - -
-

Table of Contents

-
- -
-
- -
-

1 Ears!

-
- - -

-I want to be able to place ears in a similiar manner to how I place -the eyes. I want to be able to place ears in a unique spatial -position, and recieve as output at every tick the FFT of whatever -signals are happening at that point. -

- - - -
(ns body.ear)
-(use 'cortex.world)
-(use 'cortex.import)
-(use 'clojure.contrib.def)
-(cortex.import/mega-import-jme3)
-(rlm.rlm-commands/help)
-(import java.nio.ByteBuffer)
-(import java.awt.image.BufferedImage)
-(import java.awt.Color)
-(import java.awt.Dimension)
-(import java.awt.Graphics)
-(import java.awt.Graphics2D)
-(import java.awt.event.WindowAdapter)
-(import java.awt.event.WindowEvent)
-(import java.awt.image.BufferedImage)
-(import java.nio.ByteBuffer)
-(import javax.swing.JFrame)
-(import javax.swing.JPanel)
-(import javax.swing.SwingUtilities)
-(import javax.swing.ImageIcon)
-(import javax.swing.JOptionPane)
-(import java.awt.image.ImageObserver)
-
- - - - -

-JMonkeyEngine3's audio system works as follows: -first, an appropiate audio renderer is created during initialization -and depending on the context. On my computer, this is the -LwjglAudioRenderer. -

-

-The LwjglAudioRenderer sets a few internal state variables depending -on what capabilities the audio system has. -

-

-may very well need to make my own AudioRenderer -

- - - -
(in-ns 'body.ear)
-(import 'com.jme3.capture.SoundProcessor)
-
-
-(defn sound-processor
-  "deals with converting ByteBuffers into Arrays of bytes so that the
-  continuation functions can be defined in terms of immutable stuff."
-  [continuation]
-  (proxy [SoundProcessor] []
-    (cleanup [])
-    (process
-      [#^ByteBuffer audioSamples numSamples]
-      (no-exceptions
-       (let [byte-array (byte-array numSamples)]
-         (.get audioSamples byte-array 0 numSamples)
-         (continuation
-          (vec byte-array)))))))
-         
-
-(defn add-ear 
-  "add an ear to the world.  The continuation function will be called
-  on the FFT or the sounds which the ear hears in the given
-  timeframe. Sound is 3D."
-  [world listener continuation]
-  (let [renderer (.getAudioRenderer world)]
-    (.addListener renderer listener)
-    (.registerSoundProcessor renderer listener
-                             (sound-processor continuation))
-    listener))
-
-
- - - - - - - -
(ns test.hearing)
-(use 'cortex.world)
-(use 'cortex.import)
-(use 'clojure.contrib.def)
-(use 'body.ear)
-(cortex.import/mega-import-jme3)
-(rlm.rlm-commands/help)
-
-(defn setup-fn [world]
-  (let [listener (Listener.)]
-    (add-ear world listener #(println (nth % 0)))))
-  
-(defn play-sound [node world value]
-  (if (not value)
-    (do
-      (.playSource (.getAudioRenderer world) node))))
-
-(defn test-world []
-  (let [node1 (AudioNode. (asset-manager) "Sounds/pure.wav" false false)]
-    (world
-     (Node.)
-     {"key-space" (partial play-sound node1)}
-     setup-fn
-     no-op
-     )))
-    
-
-
- - - - - - - - -
-
-
-

Date: 2011-09-21 16:38:27 MDT

-

Author: Robert McIntyre

-

Org version 7.6 with Emacs version 23

-Validate XHTML 1.0 -
-
- - diff -r f9476ff7637e -r c41d773a85fb ear.org --- a/ear.org Tue Oct 25 13:02:31 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -#+title: The EARS! -#+author: Robert McIntyre -#+email: rlm@mit.edu -#+MATHJAX: align:"left" mathml:t path:"../aurellem/src/MathJax/MathJax.js" -#+STYLE: -#+BABEL: :exports both :noweb yes :cache no :mkdirp yes -#+INCLUDE: ../aurellem/src/templates/level-0.org -#+description: Simulating multiple listeners and the sense of hearing in uMonkeyEngine3 - - - - -* Ears! - -I want to be able to place ears in a similiar manner to how I place -the eyes. I want to be able to place ears in a unique spatial -position, and recieve as output at every tick the FFT of whatever -signals are happening at that point. - -#+srcname: ear-header -#+begin_src clojure -(ns body.ear) -(use 'cortex.world) -(use 'cortex.import) -(use 'clojure.contrib.def) -(cortex.import/mega-import-jme3) -(rlm.rlm-commands/help) -(import java.nio.ByteBuffer) -(import java.awt.image.BufferedImage) -(import java.awt.Color) -(import java.awt.Dimension) -(import java.awt.Graphics) -(import java.awt.Graphics2D) -(import java.awt.event.WindowAdapter) -(import java.awt.event.WindowEvent) -(import java.awt.image.BufferedImage) -(import java.nio.ByteBuffer) -(import javax.swing.JFrame) -(import javax.swing.JPanel) -(import javax.swing.SwingUtilities) -(import javax.swing.ImageIcon) -(import javax.swing.JOptionPane) -(import java.awt.image.ImageObserver) -#+end_src - -JMonkeyEngine3's audio system works as follows: -first, an appropiate audio renderer is created during initialization -and depending on the context. On my computer, this is the -LwjglAudioRenderer. - -The LwjglAudioRenderer sets a few internal state variables depending -on what capabilities the audio system has. - -may very well need to make my own AudioRenderer - -#+srcname: ear-body-1 -#+begin_src clojure :results silent -(in-ns 'body.ear) -(import 'com.jme3.capture.SoundProcessor) - - -(defn sound-processor - "deals with converting ByteBuffers into Arrays of bytes so that the - continuation functions can be defined in terms of immutable stuff." - [continuation] - (proxy [SoundProcessor] [] - (cleanup []) - (process - [#^ByteBuffer audioSamples numSamples] - (no-exceptions - (let [byte-array (byte-array numSamples)] - (.get audioSamples byte-array 0 numSamples) - (continuation - (vec byte-array))))))) - - -(defn add-ear - "add an ear to the world. The continuation function will be called - on the FFT or the sounds which the ear hears in the given - timeframe. Sound is 3D." - [world listener continuation] - (let [renderer (.getAudioRenderer world)] - (.addListener renderer listener) - (.registerSoundProcessor renderer listener - (sound-processor continuation)) - listener)) - -#+end_src - - - -#+srcname: test-hearing -#+begin_src clojure :results silent -(ns test.hearing) -(use 'cortex.world) -(use 'cortex.import) -(use 'clojure.contrib.def) -(use 'body.ear) -(cortex.import/mega-import-jme3) -(rlm.rlm-commands/help) - -(defn setup-fn [world] - (let [listener (Listener.)] - (add-ear world listener #(println (nth % 0))))) - -(defn play-sound [node world value] - (if (not value) - (do - (.playSource (.getAudioRenderer world) node)))) - -(defn test-world [] - (let [node1 (AudioNode. (asset-manager) "Sounds/pure.wav" false false)] - (world - (Node.) - {"key-space" (partial play-sound node1)} - setup-fn - no-op - ))) - - -#+end_src - - - -* COMMENT Code Generation - -#+begin_src clojure :tangle /home/r/cortex/src/body/ear.clj -<> -<> -#+end_src - - -#+begin_src clojure :tangle /home/r/cortex/src/test/hearing.clj -<> -#+end_src - - diff -r f9476ff7637e -r c41d773a85fb org/bugs-in-openal.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/bugs-in-openal.org Tue Oct 25 13:03:35 2011 -0700 @@ -0,0 +1,50 @@ +* bugs in OpenAl-soft + +Wave files produced by wave writer do not have the correct header. + +something is wrong with + +#+begin_src conf +drivers = null, +#+end_src + +It only produces the single null option when queried with +ALC_ALL_DEVICES_SPECIFIER, where it should produce much more output. + +specifically, + +------------------------------ +#+begin_src conf +drivers = oss, +#+end_src + +#+begin_src text +0: OSS Software +1: PulseAudio Software +2: ALSA Software on default +3: ALSA Software on HDA Intel [ALC272 Analog] (hw:0,0) +4: ALSA Software on HDA Intel [ALC272 Digital] (hw:0,1) +5: ALSA Software on HDA Intel [INTEL HDMI] (hw:0,3) +6: PortAudio Software +7: Wave File Writer +#+end_src +------------------------------ +#+begin_src conf +drivers = pulse, +#+end_src + +#+begin_src text +Devices +0: Internal Audio Analog Stereo +#+end_src +------------------------------ +#+begin_src conf +drivers = wave, +#+end_src + +#+begin_src text +Devices +0: Wave File Writer +#+end_src +------------------------------ + diff -r f9476ff7637e -r c41d773a85fb org/device_details.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/device_details.org Tue Oct 25 13:03:35 2011 -0700 @@ -0,0 +1,37 @@ +* a device has a two names, + - *name*, which is the filename and which appears before all of the functions. + - *trueName*, which is a string that is used to summon the device. + + +Every device has the *_data* struct, which is where all the +device specific state is located. + +In the function *_open_playback*, the device is initialized, +here the trueName is set, and the devices data is initialized. + +The ALCdevice's ExtraData field must always be cast to to the actual +data struct that the device uses. + + + +the =open_playback= function is where everything is initialized, + + +but the =reset_playback= is where the actual thread which is the heart +of the device is started. + + +every device has a Proc function which takes a pointer to an +ALCdevice and is run in a separate thread. It is this procedure that +actually does stuff with sound data. + + +It is the ALContext which controls the particulars of a listener. + +The context contains the device. + +* so do we need a new context for each listener, alone with their own +devices? + +However, the device also maintains a *list* of contexts... + diff -r f9476ff7637e -r c41d773a85fb org/ear.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/ear.org Tue Oct 25 13:03:35 2011 -0700 @@ -0,0 +1,137 @@ +#+title: The EARS! +#+author: Robert McIntyre +#+email: rlm@mit.edu +#+MATHJAX: align:"left" mathml:t path:"../aurellem/src/MathJax/MathJax.js" +#+STYLE: +#+BABEL: :exports both :noweb yes :cache no :mkdirp yes +#+INCLUDE: ../aurellem/src/templates/level-0.org +#+description: Simulating multiple listeners and the sense of hearing in uMonkeyEngine3 + + + + +* Ears! + +I want to be able to place ears in a similiar manner to how I place +the eyes. I want to be able to place ears in a unique spatial +position, and recieve as output at every tick the FFT of whatever +signals are happening at that point. + +#+srcname: ear-header +#+begin_src clojure +(ns body.ear) +(use 'cortex.world) +(use 'cortex.import) +(use 'clojure.contrib.def) +(cortex.import/mega-import-jme3) +(rlm.rlm-commands/help) +(import java.nio.ByteBuffer) +(import java.awt.image.BufferedImage) +(import java.awt.Color) +(import java.awt.Dimension) +(import java.awt.Graphics) +(import java.awt.Graphics2D) +(import java.awt.event.WindowAdapter) +(import java.awt.event.WindowEvent) +(import java.awt.image.BufferedImage) +(import java.nio.ByteBuffer) +(import javax.swing.JFrame) +(import javax.swing.JPanel) +(import javax.swing.SwingUtilities) +(import javax.swing.ImageIcon) +(import javax.swing.JOptionPane) +(import java.awt.image.ImageObserver) +#+end_src + +JMonkeyEngine3's audio system works as follows: +first, an appropiate audio renderer is created during initialization +and depending on the context. On my computer, this is the +LwjglAudioRenderer. + +The LwjglAudioRenderer sets a few internal state variables depending +on what capabilities the audio system has. + +may very well need to make my own AudioRenderer + +#+srcname: ear-body-1 +#+begin_src clojure :results silent +(in-ns 'body.ear) +(import 'com.jme3.capture.SoundProcessor) + + +(defn sound-processor + "deals with converting ByteBuffers into Arrays of bytes so that the + continuation functions can be defined in terms of immutable stuff." + [continuation] + (proxy [SoundProcessor] [] + (cleanup []) + (process + [#^ByteBuffer audioSamples numSamples] + (no-exceptions + (let [byte-array (byte-array numSamples)] + (.get audioSamples byte-array 0 numSamples) + (continuation + (vec byte-array))))))) + + +(defn add-ear + "add an ear to the world. The continuation function will be called + on the FFT or the sounds which the ear hears in the given + timeframe. Sound is 3D." + [world listener continuation] + (let [renderer (.getAudioRenderer world)] + (.addListener renderer listener) + (.registerSoundProcessor renderer listener + (sound-processor continuation)) + listener)) + +#+end_src + + + +#+srcname: test-hearing +#+begin_src clojure :results silent +(ns test.hearing) +(use 'cortex.world) +(use 'cortex.import) +(use 'clojure.contrib.def) +(use 'body.ear) +(cortex.import/mega-import-jme3) +(rlm.rlm-commands/help) + +(defn setup-fn [world] + (let [listener (Listener.)] + (add-ear world listener #(println (nth % 0))))) + +(defn play-sound [node world value] + (if (not value) + (do + (.playSource (.getAudioRenderer world) node)))) + +(defn test-world [] + (let [node1 (AudioNode. (asset-manager) "Sounds/pure.wav" false false)] + (world + (Node.) + {"key-space" (partial play-sound node1)} + setup-fn + no-op + ))) + + +#+end_src + + + +* COMMENT Code Generation + +#+begin_src clojure :tangle /home/r/cortex/src/body/ear.clj +<> +<> +#+end_src + + +#+begin_src clojure :tangle /home/r/cortex/src/test/hearing.clj +<> +#+end_src + + diff -r f9476ff7637e -r c41d773a85fb org/todo.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/todo.org Tue Oct 25 13:03:35 2011 -0700 @@ -0,0 +1,53 @@ +* Tasks to do relating to the Aurellem recorder device. + + + +** Cleanup +- [ ] come up with a good name for the recording device. +- [X] shift stepping functions to =nstep= +- [ ] make a new project that Uses openal-soft but is not inside it +- [ ] transfer all of my stuff to this project (everntually, we'll hava a "record" artifact) +- [ ] put everything into an org file +- [ ] make a post on aurellem +- [ ] make a post on jMonkeyEngine forums + +** New Features +- [ ] enable multiple listeners / multiple data +- [ ] add support for streaming sources. + + +** Java Integration +- [ ] watch out for playSourceInstance and make sure it's handled correctly! +- [ ] figure out how to compile for all platforms +- [ ] get jMonkeyEngine to auto-load the new artifacts. +- [X] properly extend the AudioRenderer instead of copying everything over. +- [ ] combine with video recorder to make an easy-to-use thing for the main case. + +** Clojure Integration +- [ ] abstract to closure =(ear)= function. + +** Testing +- [X] make sure it works for effects (NOT GOING TO DO!), jMonkeyEngine doesn't do it well. +- [ ] make an automated test using two listeners that are in the exact same area. + + +** Conversion to multiple listeners. +- [ ] make every function call manage context switching automatically +- [ ] gather up all data necessary for context switching in a struct. +- [ ] nmake a map/list of these structures in the ExtraData device field. +- [ ] + + + + + + + + + + + + + + + diff -r f9476ff7637e -r c41d773a85fb todo.org --- a/todo.org Tue Oct 25 13:02:31 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -* Tasks to do relating to the Aurellem recorder device. - - - -** Cleanup -- [ ] come up with a good name for the recording device. -- [X] shift stepping functions to =nstep= -- [ ] make a new project that Uses openal-soft but is not inside it -- [ ] transfer all of my stuff to this project (everntually, we'll hava a "record" artifact) -- [ ] put everything into an org file -- [ ] make a post on aurellem -- [ ] make a post on jMonkeyEngine forums - -** New Features -- [ ] enable multiple listeners / multiple data -- [ ] add support for streaming sources. - - -** Java Integration -- [ ] watch out for playSourceInstance and make sure it's handled correctly! -- [ ] figure out how to compile for all platforms -- [ ] get jMonkeyEngine to auto-load the new artifacts. -- [X] properly extend the AudioRenderer instead of copying everything over. -- [ ] combine with video recorder to make an easy-to-use thing for the main case. - -** Clojure Integration -- [ ] abstract to closure =(ear)= function. - -** Testing -- [X] make sure it works for effects (NOT GOING TO DO!), jMonkeyEngine doesn't do it well. -- [ ] make an automated test using two listeners that are in the exact same area. - - -** Conversion to multiple listeners. -- [ ] make every function call manage context switching automatically -- [ ] gather up all data necessary for context switching in a struct. -- [ ] nmake a map/list of these structures in the ExtraData device field. -- [ ] - - - - - - - - - - - - - - -