-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recording starts but doesn't paste to Anki after ending. #15
Comments
I ran into this issue today, and using some insight from #14 I was able to get a working config by replacing the recording function with Here is the config:record_function() {
local -r audio_file="$1"
pw-record -P '{ stream.capture.sink=true }' "$audio_file" 1> /dev/null &
}
record_start() {
# begin recording audio.
local -r audio_file="$(mktemp \
"/tmp/pipewire-recording.XXXXXX.$AUDIO_FORMAT")"
echo "$audio_file" > "$recording_toggle"
record_function "$audio_file"
echo "$!" >> "$recording_toggle"
current_time >> "$recording_toggle"
notify_record_start
}
record_end() {
# end recording.
local -r audio_file="$(sed -n "1p" "$recording_toggle")"
local -r pid="$(sed -n "2p" "$recording_toggle")"
local -r start_time="$(sed -n "3p" "$recording_toggle")"
local -r duration="$(($(current_time) - start_time))"
if [ "$duration" -le "$MINIMUM_DURATION" ]; then
sleep "$((MINIMUM_DURATION - duration))e-3"
fi
rm "$recording_toggle"
kill -15 "$pid"
while [ "$(du "$audio_file" | awk '{ print $1 }')" -eq 0 ]; do
true
done
store_file "${audio_file}"
update_sound "$(basename -- "$audio_file")"
notify_record_stop
} |
This actually fixed it for me. Thank you! |
Oh we have very different setups and you also had the same problem as me, maybe it is an ffmpeg or kernel issue? Anyway, my setup here if anyone is interested to dive further on the issue.
|
My version with the record_function() {
local -r audio_file="$1"
# We need the & at the end otherwise it hangs in the pw-record
pw-record -P '{ stream.capture.sink=true }' "$audio_file" &
}
record_start() {
# begin recording audio.
local -r audio_file="$(mktemp \
"/tmp/ffmpeg-recording.XXXXXX.$AUDIO_FORMAT")"
echo "$audio_file" >"$recording_toggle"
record_function "$audio_file"
echo "$!" >> "$recording_toggle"
current_time >> "$recording_toggle"
notify_record_start
}
record_end() {
local -r audio_file="$(sed -n "1p" "$recording_toggle")"
local -r pid="$(sed -n "2p" "$recording_toggle")"
local -r start_time="$(sed -n "3p" "$recording_toggle")"
local -r duration="$(($(current_time) - start_time))"
echo "The pid is: ${pid}"
if [ "$duration" -le "$MINIMUM_DURATION" ]; then
sleep "$((MINIMUM_DURATION - duration))e-3"
fi
rm "$recording_toggle"
kill -15 "$pid"
wait "$pid" || true
while [ "$(du "$audio_file" | awk '{ print $1 }')" -eq 0 ]; do
true
done
store_file "${audio_file}"
update_sound "$(basename -- "$audio_file")"
notify_record_stop
}
record() {
# this section is a heavily modified version of the linux audio
# script written by salamander on qm's animecards.
recording_toggle="/tmp/ffmpeg-recording-audio"
if [[ ! -f /tmp/ffmpeg-recording-audio ]]; then
record_start
else
record_end
fi
} |
I downloaded this script a couple of days ago and it worked perfectly. I don't really know what happened, but now it just gives me the "Recording..." notification and when I hit my bind again nothing happens. Sometimes it does end up adding the card minutes after I've ended the recording. Nothing gets printed when I enter the command into the terminal. I don't know what to do. Please help. I love this tool. Thank you.
It seems to be stuck in this loop:
OS: Fedora Linux 41 (KDE Plasma)KERNEL: 6.11.5-300.fc41.x86_64CPU: Intel Core i7-7700K @ 4.20GHzGPU: NVIDIA GeForce GTX 1070GPU DRIVER: NVIDIA 560.35.03RAM: 32 GB
The text was updated successfully, but these errors were encountered: