Jump to content
Chinese-Forums
  • Sign Up

Record - play - repeat software, no hands required


Recommended Posts

Posted

This is slightly cheeky as I'm actually planning to use it for music practice, but it would also be helpful for any students of Chinese who don't have the use of their arms, and it's the kind of software you folk might have come across. 

 

I'm looking for preferably Windows software that will a) record a chunk of sound (say 10 seconds, customisable), b) play it back, and then c) repeat the process. The idea is to sit in front of a microphone, play a particular passage, get immediate feedback on how it sounds, adjust, etc, without constantly having to lean over to use the mouse, knock the microphone off its stand, and clang my tuning pegs against the desk. Etc. 

 

Searching only brings up apps that slow down or loop existing bits of music. I can't find anything that does a record, play, wipe, repeat process. 

 

Edit I'm wondering if Audacity macros (but seem to be for processing existing files) or scripting might be the answer.

  • Good question! 1
Posted

Ok, so I can see in Audacity macros how to start recording, stop, skip back, play, stop, record.... what I haven't yet figured out is how to start recording and WAIT before stopping. This indicates there's no such timer function. I might have a look at doing this with AutoHotKey tomorrow - or I could learn Python, but that seems excessive for a Sunday. 

Posted

I've been wanting to do something like this for a while for pronunciation practice. My idea is holding down a key to record, then having it play when I release that key, although that might be less useful for music practice. 

 

fmedia seems to work well recording and playing from the command line (https://stsaz.github.io/fmedia/#download

 

Here's my rough but small script with Autohotkey (using fmedia).

 

Press alt to record, press alt again to stop and play back what you just recorded. 

 

=================

currentFile := ""

return

alt::
   currentFile := "audio-files\" A_Now ".flac" ;save current file with timestamp
    Run, fmedia\fmedia --record --out=%currentFile% ;start recording with fmedia
 keywait, alt, d
   send, s ;stop recording
   sleep, 100
   Run, fmedia\fmedia %currentFile% ;play
return

=========================

 

I've attached the script with the directory structure, but fmedia needs to be downloaded into the fmedia folder if you want to use it. 

 

 

Sound Record.rar

Posted

Thanks Mark. 

 

The looping apps for music production are getting in the right direction, but I can't see (haven't looked very closely, mind) any that have that automatic record - play - discard loop. 

 

Thinking about it, the best word for what I want here is simply 'an echo'. I play something. It bounces back at me and is lost forever. I wonder if an echo / delay effect would work, as long as it was a long delay and a clean return. Speech therapy / voice training might all need similar functions, but they'd be unlikely to make it so automatic - in most cases, you're going to want to be able to listen to your attempt multiple times, to analyse. Our use case, where our imaginary user has their hands full for whatever reason, is less common. 

 

An hour later: Got halfway to a hacky solution - by fiddling the latency figures in Audacity preferences (to +1000, say) you can have the audio you record appear 1 second AHEAD on the waveform. However, Audacity then doesn't play it when you get to it. 

Posted

I'm going down rabbit holes here for something that I'm sure is actually very simple. https://echobackto.me/ has the right idea, but it's sound activated so cuts off the very start and will stop recording if you pause. Best yet though.

 

There are requests for similar things on reddit, with classic reddit replies along the lines of "why would you do that?" and "your question is wrong". Latency is to be eliminated, not encouraged. 

 

Five minutes later

 

@markhavemann - thanks for that! I think I've got it doing what I want - replaced the second Alt press with a 5 second wait, then put in a loop. I'm not sure it terminates the loop very gracefully, but seems to do what I want! Script currently looks like this, but can no doubt be tidied up (I just blindly copied and pasted in internet code). 

Spoiler

 

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Menu, Tray, Add, Open Containing Folder, openContainingFolder

;~ fmedia 
;~ https://stsaz.github.io/fmedia/#download

currentFile := ""

return

alt::

Loop,
{
   currentFile := "audio-files\" A_Now ".flac" ;save current file with timestamp
    Run, fmedia\fmedia --record --out=%currentFile% ;start recording with fmedia
sleep, 5000
   send, s
   sleep, 100
   Run, fmedia\fmedia %currentFile%


}

;~ ^r::Reload

openContainingFolder:
    Run, %A_ScriptDir%

 


 

Posted

Incidentally, and I promise this will be my last post in this topic for.... oooh, an hour... 

 

I think there's a market demand for this. Not necessarily huge, but...

 

1) In a desktop scenario the handsfree aspect isn't as important and Audacity would work fine. But I can't see anyone's really marketing software like this to potential customers - while Googling I saw people who wanted to change their voice in some way - accent adjustment, trans people - looking for this kind of thing. Package open source software up as an app and there are buyers out there. And if not handsfree, it can still be a simpler interface - tap the space key to start recording, to stop and play, to start again. 

2) Handsfree would still be nice. There's no reason you couldn't do this while out for a walk, on the bus (quietly), in the car, with your feet up and your hands behind your head.

3) Thinking for guitar, having this happening automatically could be really useful. I can sit in my normal spot, with bluetooth headphones on and a mic in front of the guitar, and practice scales or particular passages and get rapid feedback on how it's sounding. Obviously I can listen 'live' or set up a monitoring loop, but I think there are advantages to being able to listen while *not* playing, and hearing what the guitar sounds like from the front (better, hopefully). As it's delayed anyway, I don't need to worry about extra latency, so wireless headphones or a mic aren't an issue. 

 

Posted
22 minutes ago, roddy said:

Thinking for guitar

What immediately comes to mind is a USB foot pedal (something like this https://www.amazon.com/slp/usb-foot-pedal/d3yw6u8bova853g). Not quite as cool as completely automated, but you can map them to a key or key combination and then use your foot to trigger recording/playing.

 

You could add a way to break the loop (I set it to control), as well as something to delete the file after you've finished listening to it since you don't want to keep it. I put a 5 second delay because I guess that is how long it will play for, but it might need to be longer if the file is locked while playing. Disclaimer: I just typed this in the browser and haven't had a chance to test it. 

 

alt::

exitloop := 0

Loop,
{
   currentFile := "audio-files\" A_Now ".flac" ;save current file with timestamp
    Run, fmedia\fmedia --record --out=%currentFile% ;start recording with fmedia
sleep, 5000
   send, s
   sleep, 100
   Run, fmedia\fmedia FileDelete

    sleep, 5000

    FileDelete, currentFile 

if(exitloop)

break
}

ctrl::exitloop := 1

 

 

 

31 minutes ago, roddy said:

Handsfree would still be nice.

The only thing I could think of is triggering with a loud noise, like clicking your tongue near the microphone. I couldn't find an obvious way to monitor the microphone input level with AHK but it's a cool idea so I'll also look more when I have time.

 

I also found an application that will run commands when it hears a certain frequency. I haven't tried it but maybe that could be useful with music. Play a note on your guitar to start recording. I don't know how well this works but I use the NCH audio editor and prefer it over Audacity. 

https://www.nch.com.au/action/misc.html#TONEDET

 

  • Like 1
Posted

A foot pedal is an option, although I'd really rather not buy any hardware. But once the loop is running, I don't know if there's any need for input. Just let it run over and over again, while you try and make incremental improvements on small chunks of output. I suppose it might be handy to be have a 're-record or listen again' decision to make, but not essential.

 

I'll try and play with this later and see how it works. Has also occurred to me I can go downstairs and use the proper speakers for playback. 

Posted

Hi Roddy,

 

I realise other posts have already touched on this but, could you specify the exact conditions for triggering each event? (e.g. time, manual input, sound level, anything else?) ... or draw a State Transition Diagram with conditions for the transitions? Then it should be possible to write a script which tests for those conditions.

 

15 hours ago, roddy said:

a) record a chunk of sound (say 10 seconds, customisable), b) play it back, and then c) repeat the process.

 

Here you have six possible events, I think:

  1. start program/script - by manual input/command?
  2. start record - ?
  3. stop record - ?
  4. start playback - by time delay after 'stop record'?
  5. restart record - by time delay after end of playback?
  6. end program/script - by manual input?
Posted
On 8/30/2020 at 2:05 PM, roddy said:

Got halfway to a hacky solution - by fiddling the latency figures in Audacity preferences (to +1000, say) you can have the audio you record appear 1 second AHEAD on the waveform. However, Audacity then doesn't play it when you get to it. 

I noticed that if you don't stop the recording (by sending S to the FMEDIA window) and start playing the file while it's still recording, it will play with a delay like this. So something like this would let you listen to yourself with a 10 second delay (with a bonus of having a recording of your entire practice session in one file): 

Spoiler

 

currentFile := "audio-files\" A_Now ".flac"
Run, fmedia\fmedia --record --out=%currentFile%

sleep, 10000
Run, fmedia\fmedia %currentFile%

 

 

 

Also, if you want to hide the annoying console windows you can change the run commands (just make sure you add the "winshow" before sending S or it won't stop the recording and you will have to kill FMEDIA in the task manager) 

 

Spoiler

 

RECORDING: 

Run, fmedia\fmedia --record --out=%currentFile%,,hide

 

PLAYBACK:

WinShow, ahk_exe fmedia.exe 
send, s
sleep, 100
Run, fmedia\fmedia %currentFile%,, Hide

 

 

Posted
On 8/30/2020 at 10:38 AM, roddy said:

A foot pedal is an option, although I'd really rather not buy any hardware.

 

A Kinect would also be a good option... But I am sure that a regular webcam would do the trick if you set it up to recognise head bops and pair those with software commands.

 

Minimal interaction but still some degree of control.

Posted

I can just put a wireless keyboard on the floor and big-toe the space bar, if I'm going that route. 

 

Which I might actually want to - the fully automated set up isn't as good as I'd dreamed it would be - sometimes you want to practice a very brief part of a longer passage, sometimes you miss the start of recording, sometimes you want to.. blah blah blah. Very pleased with what I've been able to get running with the above help though, and am fairly confident I could now produce what I need using AutoHotKey myself. 

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...