Automatically find and then move a audio file to another field

I recently downloaded a shared deck which has a field called ‘Pronunciation’ with IPA phonetics and a recording in the same field - I want to move the audio file to another field without having to manually do it for all 5000 words is there a way to ‘Find’ and then ‘move’ the audio file??

Maybe try using this code in the debug console.
Replace NoteTypeName with the actual name of the note type (e.g. Basic) and TargetFieldName with the name of the field you want to move the audio to.

It is a good idea to do a backup before running the code

theModel = mw.col.models.by_name('NoteTypeName')
theNotes = mw.col.models.nids(theModel)
s = r'\[sound:.*\]'
for nid in theNotes:
  note = mw.col.get_note(nid)
  m =, note['Pronunciation'])
  if (m): 
    note['TargetFieldName'] =
    note['Pronunciation'] = re.sub(s, '', note['Pronunciation'])
1 Like

Thank you this worked