diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html
index 6601cae44f8de2e10752d7cc408059c4803bc2a1..c4a811e0429b24f09fe1be7b54bf0048c9cc3125 100644
--- a/pd/nw/dialog_prefs.html
+++ b/pd/nw/dialog_prefs.html
@@ -23,6 +23,8 @@
 
       <fieldset id="audio">
         <legend data-i18n="prefs.heading.audio"></legend>
+        <select id="audio_api">
+        </select>
         Audio stuff
       </fieldset>
 
@@ -311,9 +313,21 @@ pdgui.gui_post("guistub is " + gfxstub);
         }
     }
 
+    function populate_audio_apis(apis) {
+        var i, opt, api_select = document.getElementById('audio_api');
+        pdgui.gui_post('apis are ' + apis);
+        for (i = 0; i < apis.length; i += 2) {
+            opt = document.createElement('option');
+            opt.textContent = apis[i];
+            opt.setAttribute('value', apis[i+1]);
+            api_select.appendChild(opt);
+        }
+    }
+
     function audio_prefs_callback(attrs) {
-        pdgui.gui_post("audio attrs are " + attrs);
+        pdgui.gui_post("audio attrs FUCK " + attrs);
         pdgui.gui_post("attrs length " + attrs.length);
+        populate_audio_apis(attrs[attrs.indexOf('audio_apis') + 1]);
     }
 
     function midi_prefs_callback(attrs) {
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 75680fd1928e49688af985f2e9d0e46f001b532d..9b0c460ecf66ccf47857afc6ae3443b3ab2e6838 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -3273,8 +3273,11 @@ function gui_pd_dsp(state) {
 }
 
 function open_prefs() {
-    dialogwin['prefs'] = nw_create_window('prefs', 'prefs', 265, 540, 20, 20, 0,
-        0, 1, 'white', 'Properties', '', 0, null, null);
+    if (!dialogwin['prefs']) {
+        dialogwin['prefs'] = nw_create_window('prefs', 'prefs',
+            265, 540, 20, 20, 0,
+            0, 1, 'white', 'Properties', '', 0, null, null);
+    }
 }
 
 exports.open_prefs = open_prefs;