Get default input if not in main.json
Platform: Mac
If main.json is not defined, then file writing and audio in general seems to work -- it writes the MP3 files of correct length -- but it is silent. It seems to be using a different input device than the default one.
However, on this Mac's System Preferences panel for Sound: Inputs, it shows the device set as the default ("Scarlett 18i8 USB") and there are audio levels getting captured.
This audio device also has many input channels (18), so perhaps it's connecting to the correct device, but the wrong channel by default. See the debug output for detected channels below.
In general, this workflow would be improved by:
-
A
/system
JSON API that lists all available devices, with a separateinitialized
key that lists current ones that are initialized. -
VU meters, or at least an audio level number in the JSON for both audio sources and outputs.
Ideas
-
Make sure to get the default audio device?
-
Put current audio level value for each channel into the audio input device's JSON, so that we can check the audio levels in the UI?
- Then, we can potentially reconfigure, select a different channel, and restart the AudioServer.
-
Add the current audio levels to the JSON of each
source
andoutput
.- See https://labs.creek.fm/open/audio-server/issues/47 for more.
-
Add the available input / output devices to the
/system
API, so that we can iterate over them in JSON and rebuild the main.json file after they select specific audio devices.
Debug Info
Devices
Input device is showing audio levels, on the default audio input selected.
All inputs available for "Scarlett" audio device
I updated the channels to 32
so that it will find all available inputs.
Attempting to open audio device(s):
Input = Scarlett 18i8 USB, channels = 32
Output = Scarlett 18i8 USB, channels = 2
Opened output device Scarlett 18i8 USB, available channels:
Input 0 : Mic 1
Input 1 : Mic 2
Input 2 : Mic 3
Input 3 : Mic 4
Input 4 : Line 5
Input 5 : Line 6
Input 6 : Line 7
Input 7 : Line 8
Input 8 : S/PDIF L
Input 9 : S/PDIF R
Input 10 : ADAT 1
Input 11 : ADAT 2
Input 12 : ADAT 3
Input 13 : ADAT 4
Input 14 : ADAT 5
Input 15 : ADAT 6
Input 16 : ADAT 7
Input 17 : ADAT 8
Output 0 : Mon 1
Output 1 : Mon 2
Warning: Number of available inputs (18) is less than requested total (32)
Input not defined in main.json
{
"paths": {
"lameExecutable": "/Users/librarian/Desktop/Archives/Recorder/lame",
"html": "./html"
},
"debug": 1,
"webhook": "http://localhost:1234/",
"events": [
{
"name": "split-recording-1",
"resource": "/instances/station-1/outputs/recorder-1",
"method": "PATCH",
"time": "2018-01-01T00:00:00",
"request": {
"split": true
},
"repeat": 1800
}
]
}
Console output
Running in a Node process with the PM2 process manager.
PM2 | Starting execution sequence in -fork mode- for app name:audio-server id:0
PM2 | App name:audio-server id:0 online
0|audio-se | darwin
0|audio-se | /Users/librarian
0|audio-se | AudioServer: JUCE v5.2.1
0|audio-se | AudioServer: Found LAME MP3 Encoder: /Users/librarian/Desktop/Archives/Recorder/lame
0|audio-se | warning: Config error: no output device config found. Using default audio device settings.
0|audio-se | Attempting to open default audio device(s):
0|audio-se | AudioServer: Opened output device Scarlett 18i8 USB, available channels:
0|audio-se | Output 0 : Mon 1
0|audio-se | Output 1 : Mon 2
0|audio-se | AudioServer:
0|audio-se | AudioServer: Created instance [station-1], title = station-1
0|audio-se | AudioServer: Added output [recorder-1] to instance [station-1]
0|audio-se | AudioServer: Added output [recorder-1]
0|audio-se | Added input source [audio-input-1] to instance [station-1]
0|audio-se | AudioServer: Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-10_12-18-52.mp3
0|audio-se | AudioServer: format = MP3 file192 Kb/s CBR
0|audio-se | Added instance [station-1]
0|audio-se | Instance [station-1], input [audio-input-1], channel [1] maps to unavilable input channel [1]
0|audio-se | Instance configurations loaded.
0|audio-se | AudioServer: EventsManager started
0|audio-se | adding event split-recording-1
0|audio-se | AudioServer: split-recording-1 - start time is in the past, moving schedule forward to 10 Jun 1970 12:30:00pm
0|audio-se | loaded 1 events from configuration
0|audio-se | AudioServer: error: could not start server
0|audio-se | AudioServer: debug: webhook message queued: "started"
0|audio-se | AudioServer: <p>You have successfully connected to the audio server api</p>
0|audio-se | AudioServer exited with code: null
0|audio-se | AudioServerManager: Kill signal received.
PM2 | App [audio-server] with id [0] and pid [52397], exited with code [0] via signal [SIGINT]
PM2 | Starting execution sequence in -fork mode- for app name:audio-server id:0
PM2 | App name:audio-server id:0 online
0|audio-se | darwin
0|audio-se | /Users/librarian
0|audio-se | AudioServer: JUCE v5.2.1
0|audio-se | AudioServer: Found LAME MP3 Encoder: /Users/librarian/Desktop/Archives/Recorder/lame
0|audio-se | AudioServer: warning: Config error: no output device config found. Using default audio device settings.
0|audio-se | Attempting to open default audio device(s):
0|audio-se | AudioServer: Opened output device Scarlett 18i8 USB, available channels:
0|audio-se | Output 0 : Mon 1
0|audio-se | AudioServer:
0|audio-se | Output 1 : Mon 2
0|audio-se | AudioServer: Created instance [station-1], title = station-1
0|audio-se | AudioServer: Added output [recorder-1] to instance [station-1]
0|audio-se | Added output [recorder-1]
0|audio-se | AudioServer: Added input source [audio-input-1] to instance [station-1]
0|audio-se | AudioServer: Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-10_12-19-04.mp3
0|audio-se | format = MP3 file192 Kb/s CBR
0|audio-se | Added instance [station-1]
0|audio-se | Instance [station-1], input [audio-input-1], channel [1] maps to unavilable input channel [1]
0|audio-se | Instance configurations loaded.
0|audio-se | EventsManager started
0|audio-se | adding event split-recording-1
0|audio-se | split-recording-1 - start time is in the past, moving schedule forward to 10 Jun 1970 12:30:00pm
0|audio-se | loaded 1 events from configuration
0|audio-se | AudioServer: debug: webhook message queued: "started"
0|audio-se | AudioServer: <p>You have successfully connected to the audio server api</p>
0|audio-se | AudioServer: /Users/librarian/Desktop/Archives/Recorder/lame --quiet --cbr -b 192 /Users/librarian/Library/Caches/AudioServer/temp_da2b0aca.wav /Users/librarian/Library/Caches/AudioServer/temp_d4bb27f7.mp3
0|audio-se | AudioServer:
0|audio-se | AudioServer: Recorder + [recorder-1] closed file.
PM2 | Stopping app:audio-server id:0
PM2 | { Error: spawn pgrep ENOENT
PM2 | at _errnoException (util.js:992:11)
PM2 | at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
PM2 | at onErrorNT (internal/child_process.js:372:16)
PM2 | at _combinedTickCallback (internal/process/next_tick.js:138:11)
PM2 | at process._tickDomainCallback (internal/process/next_tick.js:218:9)
PM2 | code: 'ENOENT',
PM2 | errno: 'ENOENT',
PM2 | syscall: 'spawn pgrep',
PM2 | path: 'pgrep',
PM2 | spawnargs: [ '-P', 52418 ] }
0|audio-se | AudioServerManager: Process stopped.
0|audio-se | AudioServerManager: Stopping recording.
0|audio-se | AudioServerManager: Recording stopped.
0|audio-se | OK
0|audio-se | AudioServerManager: Kill signal received.
PM2 | App [audio-server] with id [0] and pid [52418], exited with code [0] via signal [SIGINT]
PM2 | pid=52418 msg=process killed
Input defined in main.json
{
"paths": {
"lameExecutable": "/Users/librarian/Desktop/Archives/Recorder/lame",
"html": "./html"
},
"input": {
"deviceName": "Scarlett 18i8 USB",
"numChannels": 2
},
"output": {
"deviceName": "Scarlett 18i8 USB",
"numChannels": 2
},
"debug": 1,
"webhook": "http://localhost:1234/",
"events": [
{
"name": "split-recording-1",
"resource": "/instances/station-1/outputs/recorder-1",
"method": "PATCH",
"time": "2018-01-01T00:00:00",
"request": {
"split": true
},
"repeat": 1800
}
]
}
PM2 | Starting execution sequence in -fork mode- for app name:audio-server id:0
PM2 | App name:audio-server id:0 online
0|audio-se | darwin
0|audio-se | /Users/librarian
0|audio-se | AudioServer: JUCE v5.2.1
0|audio-se | AudioServer: Found LAME MP3 Encoder: /Users/librarian/Desktop/Archives/Recorder/lame
0|audio-se | Device configuration loaded, attempting to initialise audio device.
0|audio-se | Attempting to open audio device(s):
0|audio-se | AudioServer: Input = Scarlett 18i8 USB, channels = 2
0|audio-se | Output = Scarlett 18i8 USB, channels = 2
0|audio-se | AudioServer: Opened output device Scarlett 18i8 USB, available channels:
0|audio-se | Input 0 : Mic 1
0|audio-se | AudioServer:
0|audio-se | Input 1 : Mic 2
0|audio-se | Output 0 : Mon 1
0|audio-se | Output 1 : Mon 2
0|audio-se | AudioServer: Created instance [station-1], title = station-1
0|audio-se | AudioServer: Added output [recorder-1] to instance [station-1]
0|audio-se | AudioServer: Added output [recorder-1]
0|audio-se | Added input source [audio-input-1] to instance [station-1]
0|audio-se | AudioServer:
0|audio-se | AudioServer: Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-10_12-22-41.mp3
0|audio-se | AudioServer: format = MP3 file192 Kb/s CBR
0|audio-se | Added instance [station-1]
0|audio-se | Instance configurations loaded.
0|audio-se | EventsManager started
0|audio-se | AudioServer: adding event split-recording-1
0|audio-se | AudioServer: split-recording-1 - start time is in the past, moving schedule forward to 10 Jun 1970 12:30:00pm
0|audio-se | loaded 1 events from configuration
0|audio-se | AudioServer: debug: webhook message queued: "started"
0|audio-se | AudioServer: <p>You have successfully connected to the audio server api</p>
0|audio-se | AudioServer: Recorder [recorder-1] opened file for recording: /Users/librarian/Desktop/Archives/Recorder/recordings/2018-06-10_12-23-06.mp3
0|audio-se | AudioServer: format = MP3 file192 Kb/s CBR
0|audio-se | AudioServer: /Users/librarian/Desktop/Archives/Recorder/lame --quiet --cbr -b 192 /Users/librarian/Library/Caches/AudioServer/temp_c50d4777.wav /Users/librarian/Library/Caches/AudioServer/temp_1e0eb29a.mp3
0|audio-se | AudioServer: