मुझे अपने ऑडियो लाइन-इन में लिनक्स में मॉनीटर करने की आवश्यकता है, और जब ऑडियो चलाया जाता है, तो ध्वनि रिकॉर्ड और फ़ाइल में सहेजी जानी चाहिए। motion वीडियो फ़ीड पर नज़र रखता है।एक ऑडियो लाइन की निगरानी
क्या यह बैश के साथ ऐसा करना संभव है?
#!/bin/bash
# audio device
device=/dev/audio-line-in
# below this threshold audio will not be recorded.
noise_threshold=10
# folder where recordings are stored
storage_folder=~/recordings
# run indefenitly, until Ctrl-C is pressed
while true; do
# noise_level() represents a function to determine
# the noise level from device
if noise_level($device) > $noise_threshold; then
# stream from device to file, can be encoded to mp3 later.
cat $device > $storage_folder/$(date +%FT%T).raw
fi;
done;
संपादित करें: की तर्ज पर कुछ प्रवाह मैं इस कार्यक्रम से प्राप्त करना चाहते हैं
a. when noise > threshold, start recording
b. stop recording when noise < threshold for 10 seconds
c. save recorded piece to separate file
पहले कभी गति के बारे में नहीं सुना, अच्छा –
'दिनांक' के डिफ़ॉल्ट आउटपुट में रिक्त स्थान हैं। '$ (दिनांक +% एफटी% टी) 'जैसे कुछ का उपयोग करना बेहतर होगा:" 2010-04-10T08: 55: 56 "इसलिए यह क्रमबद्ध है और इसमें कोई स्थान नहीं है। [आईएसओ 8601] (http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm) (और [यहां] (http://en.wikipedia.org/wiki/ISO_8601)) –
@ डेनिस, थेंक्स, ने इसे बदल दिया। भयानक समाधान के लिए – Stefan