ShareShortcuts

Equalizer

Equalizer will apply EQ presets to video and audio files

veredictum
Создать форк «Equalizer»

Создали что-то новое на основе этой команды? Поделитесь ей как форком: она станет вашей собственной командой, которой вы управляете, а обе страницы будут ссылаться друг на друга, чтобы veredictum получил(а) признание.

  1. 1Получите команду и измените её в приложении «Быстрые команды». Дайте ей собственное название.
  2. 2Поделись ею из приложения «Быстрые команды» и скопируй ссылку iCloud.
  3. 3Вернись сюда, вставь ссылку и опиши, что изменилось, например: «Добавлен шаг, который использует Apple Intelligence для персонализации текста».
Загрузки
31K
Сохранено
1
Действия
161
Категория
Music
Версия
1.0
Язык
EN

Equalizer will apply EQ presets to video and audio files. You can also apply optional filters to isolate speech or enhance stereo and more. The free a-Shell mini app is required.

Что нового

Версия 1.0

First release

История версий
1.0 21 июл 2023 г.

First release

Что делает

Действий: 161
  1. Comment
    Equalizer 2.2.0 This shortcut will apply EQ presets and various audio filters.
  2. Comment
    This shortcut requires a-Shell mini https://apps.apple.com/us/app/a-shell-mini/id1543537943
  3. Comment
    By u/veredictum
  4. If
  5. Set Variable
    Input
  6. Dictionary
  7. Set Variable
    Config
  8. If
  9. Choose from Menu
    Source media?
  10. Choose from Menu
    Photos
  11. Select Photos
  12. Set Variable
    Input
  13. Choose from Menu
    Files
  14. Select File
  15. Set Variable
    Input
  16. Choose from Menu
    Install a-Shell mini
  17. Open URLs
  18. Stop This Shortcut
  19. Replace Text
  20. Set Variable
    InputName
  21. Set Name
  22. Set Variable
    Input
  23. Set Variable
    Extension
  24. Dictionary
  25. Save File
  26. Get File
  27. If
  28. Set Variable
    InputName
  29. Set Variable
    Extension
  30. Put File
    AsheKube.app.a-Shell-mini
  31. If
  32. Comment
    EQ presets inspired by https://descriptive.audio/best-equalizer-settings/
  33. Text
  34. Get Dictionary from Input
  35. Set Variable
    Presets
  36. Get Dictionary Value
  37. Filter Files
  38. Choose from List
  39. Set Variable
    Preset
  40. Comment
    Build filter for EQ preset
  41. Get Dictionary Value
  42. Get Dictionary Value
  43. Filter Files
  44. Repeat with Each
  45. Get Dictionary Value
  46. Text
  47. Combine Text
  48. Text
  49. Set Variable
    Equalizer
  50. Comment
    Add optional filters
  51. Text
  52. Split Text
  53. Choose from List
  54. If
  55. Text
  56. Split Text
  57. Choose from List
  58. Comment
    Get audio sample rate needed for changing pitch and loudness norms.
  59. Execute Command
    AsheKube.app.a-Shell-mini
  60. Repeat with Each
  61. Get Dictionary Value
  62. If
  63. Get Dictionary Value
  64. Set Variable
    Sample Rate
  65. Comment
    Build optional fiters
  66. Dictionary
  67. Repeat with Each
  68. Get Dictionary Value
  69. Add to Variable
  70. Comment
    Standard normalization if needed
  71. If
  72. Text
  73. Execute Command
    AsheKube.app.a-Shell-mini
  74. Wait
  75. Text
  76. Execute Command
    AsheKube.app.a-Shell-mini
  77. Set Variable
    loop
  78. Repeat
  79. If
  80. If
  81. Repeat
  82. If
  83. If
  84. Wait
  85. Execute Command
    AsheKube.app.a-Shell-mini
  86. Set Variable
    loop
  87. Match Text
  88. If
  89. If
  90. Get File
    AsheKube.app.a-Shell-mini
  91. Match Text
  92. If
  93. If
  94. Set Variable
    Max Volume
  95. If
  96. Text
  97. If
  98. Text
  99. List
  100. Set Variable
    Filters
  101. If
  102. If
  103. Add to Variable
  104. Combine Text
  105. Count
  106. If
  107. If
  108. Show Alert
  109. Stop This Shortcut
  110. If
  111. Text
  112. If
  113. Text
  114. Text
  115. Execute Command
    AsheKube.app.a-Shell-mini
  116. Set Variable
    loop
  117. Repeat
  118. If
  119. If
  120. Repeat
  121. If
  122. If
  123. Wait
  124. Execute Command
    AsheKube.app.a-Shell-mini
  125. Set Variable
    loop
  126. Execute Command
    AsheKube.app.a-Shell-mini
  127. Match Text
  128. If
  129. Show Alert
  130. Run Shortcut
  131. Stop This Shortcut
  132. If
  133. Get File
    AsheKube.app.a-Shell-mini
  134. Set Name
  135. Match Text
  136. If
  137. Text
  138. If
  139. Text
  140. Split Text
  141. Choose from List
  142. If
  143. Save to Photo Album
  144. Open App
  145. If
  146. Folder
  147. If
  148. Folder
  149. Save File
  150. Open File
  151. If
  152. Set Name
  153. Set Name
  154. List
  155. Quick Look
  156. Share
  157. Choose from Menu
  158. Choose from Menu
    Adjust EQ settings
  159. Run Shortcut
  160. Choose from Menu
    Quit
  161. Execute Command
    AsheKube.app.a-Shell-mini

Посмотреть как код
Бета

Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.

#include 'actions/web'
#include 'actions/photos'
#define color red
#define glyph sliders

/*
Equalizer 2.2.0
This shortcut will apply EQ presets and various audio filters. 
*/
/*
This shortcut requires a-Shell mini

https://apps.apple.com/us/app/a-shell-mini/id1543537943
*/
// By u/veredictum


if ShortcutInput {
	@Input = ShortcutInput
}
@Config = {
	"Name": "Equalizer",
	"RoutineHub ID": "",
	"Version": "2.2.0"
}

if !@Input {
	menu "Source media?" {
	item "Photos":
		selectPhotos()
		@Input
	item "Files":
		selectFile()
		@Input
	item "Install a-Shell mini":
		openURL("https://apps.apple.com/us/app/a-shell-mini/id1543537943")
		stop()
	}
}
replaceText("\'|\/|\\|\:", "_", @Input, false, true)
@InputName
setName(@Input)
@Input
@Extension = @Input
const Dictionary = {
	"Extension": "{@Input['File Extension']}",
	"Name": "{@InputName}"
}
saveFile("Shortcuts/temp/InputName.json", Dictionary, true)
const File = getFile("Shortcuts/temp/InputName.json", true)

if File {
	@InputName = File['Name']
	@Extension = File['Extension']
}
rawAction("AsheKube.app.a-Shell-mini.PutFileIntent", {
	"ShowWhenRun": false,
	"file": "@Input"
})

if @Input {
	/*
	EQ presets inspired by
	https://descriptive.audio/best-equalizer-settings/
	*/
	const Text = "\n{\n  \\"Treble Booster\\": {\n    \\"0\\": -4,\n    \\"250\\": -2,\n    \\"1000\\": 0,\n    \\"4000\\": 3,\n    \\"16000\\": 6\n  },\n  \\"Bass Booster\\": {\n    \\"0\\": 6,\n    \\"250\\": 3,\n    \\"1000\\": 0,\n    \\"4000\\": -2,\n    \\"16000\\": -4\n  },\n  \\"Mid Booster\\": {\n    \\"0\\": -2,\n    \\"250\\": 2,\n    \\"1000\\": 6,\n    \\"4000\\": 2,\n    \\"16000\\": -2\n  },\n  \\"Deep\\": {\n    \\"0\\": 4,\n    \\"250\\": 8,\n    \\"1000\\": 4,\n    \\"4000\\": 2,\n    \\"16000\\": 1\n  },\n  \\"Acoustic\\": {\n    \\"0\\": 5,\n    \\"64\\": 5,\n    \\"125\\": 4,\n    \\"250\\": 1,\n    \\"500\\": 2,\n    \\"1000\\": 2,\n    \\"2000\\": 3,\n    \\"4000\\": 4,\n    \\"8000\\": 2,\n    \\"16000\\": 1\n  },\n  \\"Electronic\\": {\n    \\"0\\": 5,\n    \\"64\\": 5,\n    \\"125\\": 1,\n    \\"250\\": 0,\n    \\"500\\": -1,\n    \\"1000\\": 3,\n    \\"2000\\": 1,\n    \\"4000\\": 1,\n    \\"8000\\": 3,\n    \\"16000\\": 4\n  },\n  \\"Latin\\": {\n    \\"0\\": 6,\n    \\"64\\": 5,\n    \\"125\\": 2,\n    \\"250\\": 1,\n    \\"500\\": 0,\n    \\"1000\\": 3,\n    \\"2000\\": 0,\n    \\"4000\\": 1,\n    \\"8000\\": 5,\n    \\"16000\\": 6\n  },\n  \\"Classical\\": {\n    \\"0\\": 3,\n    \\"64\\": 2,\n    \\"125\\": 1,\n    \\"250\\": 3,\n    \\"500\\": 4,\n    \\"1000\\": 2,\n    \\"2000\\": 4,\n    \\"4000\\": 5,\n    \\"8000\\": 4,\n    \\"16000\\": 5\n  },\n  \\"Pop\\": {\n    \\"0\\": -2,\n    \\"64\\": -1,\n    \\"125\\": 0,\n    \\"250\\": 3,\n    \\"500\\": 5,\n    \\"1000\\": 5,\n    \\"2000\\": 3,\n    \\"4000\\": 0,\n    \\"8000\\": -1,\n    \\"16000\\": -2\n  },\n  \\"Rock\\": {\n    \\"0\\": 5,\n    \\"64\\": 4,\n    \\"125\\": 3,\n    \\"250\\": 2,\n    \\"500\\": 0,\n    \\"1000\\": 3,\n    \\"2000\\": 1,\n    \\"4000\\": 3,\n    \\"8000\\": 4,\n    \\"16000\\": 5\n  },\n  \\"Hip Hop\\": {\n    \\"0\\": 0,\n    \\"64\\": 4,\n    \\"125\\": 6,\n    \\"250\\": 2,\n    \\"500\\": 3,\n    \\"1000\\": 5,\n    \\"2000\\": 7,\n    \\"4000\\": 4,\n    \\"8000\\": 2,\n    \\"16000\\": 0\n  },\n  \\"Flat\\": {\n    \\"0\\": 0,\n    \\"64\\": 0,\n    \\"125\\": 0,\n    \\"250\\": 0,\n    \\"500\\": 0,\n    \\"1000\\": 0,\n    \\"2000\\": 0,\n    \\"4000\\": 0,\n    \\"8000\\": 0,\n    \\"16000\\": 0\n  },\n  \\"Vocals\\": {\n    \\"0\\": -4,\n    \\"64\\": 0,\n    \\"125\\": 0,\n    \\"250\\": 2,\n    \\"500\\": 4,\n    \\"1000\\": 5,\n    \\"2000\\": 6,\n    \\"4000\\": 3,\n    \\"8000\\": 4,\n    \\"16000\\": 4\n  },\n  \\"Cinematic\\": {\n    \\"0\\": -2,\n    \\"64\\": -1,\n    \\"125\\": -1,\n    \\"250\\": -1,\n    \\"500\\": 3,\n    \\"1000\\": 6,\n    \\"2000\\": 6,\n    \\"4000\\": 5,\n    \\"8000\\": 6,\n    \\"16000\\": 8\n  }\n}\n"
	getDictionary(Text)
	@Presets
	const DictionaryValue = getValues(@Presets)
	const Files = filterFiles(DictionaryValue, "Name", "A to Z")
	chooseFromList(Files, "Which EQ preset?")
	@Preset
	// Build filter for EQ preset

	const DictionaryValue1 = getValue(@Presets, @Preset)
	const DictionaryValue2 = getValue(DictionaryValue1, "")
	const Files1 = filterFiles(DictionaryValue2, "Name", "A to Z")
	for _ in Files1 {
	}
	joinText(RepeatResults, ";")
	@Equalizer = "firequalizer=gain_entry='{}'"
}
// Add optional filters

const Text1 = "Add filters\nSkip"
const SplitText = splitText(Text1)
const ChosenItem = chooseFromList(SplitText, "Optional filters?")

if ChosenItem == "Add filters" {
	const Text2 = "Dynamic Normalize\nLoud Normalize\nExtra Stereo\nStereo Widen\nSpeech Isolation\nSpeech Normalize\nNoise Reduction\nLower Pitch\nRaise Pitch\nChorus\nReverb"
	const SplitText1 = splitText(Text2)
	const ChosenItem1 = chooseFromList(SplitText1, "Which filters?", true)
}
// Get audio sample rate needed for changing pitch and loudness norms.

rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
	"ShowWhenRun": false,
	"command": "ffprobe -i \\\"{@InputName}.{@Extension}\\\" -print_format json -show_streams -show_format -loglevel error",
	"openWindow": "close"
})

for _ in output['streams'] {
	const DictionaryValue3 = getValue(@RepeatItem, "codec_type")
	if DictionaryValue3 == "audio" {
		@SampleRate = @RepeatItem['sample_rate']
	}
}
// Build optional fiters

const Dictionary1 = {
	"Chorus": "chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3",
	"Dynamic Normalize": "dynaudnorm=p=0.9:s=5",
	"Extra Stereo": "extrastereo=m=2.5",
	"Loud Normalize": "loudnorm=I=-16:TP=-1.5:LRA=14",
	"Lower Pitch": "asetrate={@SampleRate}*0.8,aresample={@SampleRate},atempo=1/0.8",
	"Noise Reduction": "afftdn=nr=10:nf=-25:tn=1",
	"Raise Pitch": "asetrate={@SampleRate}*1.2,aresample={@SampleRate},atempo=1/1.2",
	"Reverb": "aecho=1.0:0.7:20:0.5",
	"Speech Isolation": "lowpass=4000,highpass=200,compand=attacks=0.1:decays=0.8:points=-80/-900|-45/-15|-27/-9|0/-7|20/-7:gain=5",
	"Speech Normalize": "speechnorm=e=12.5:r=0.0001:l=1",
	"Stereo Widen": "stereowiden=delay=50:drymix=1.0:crossfeed=0.5:feedback=0.8"
}

for _ in ChosenItem1 {
	@Filters += Dictionary1[@RepeatItem]
}
// Standard normalization if needed


if @Input {
	const Text3 = "echo\nhideKeyboard\nclear\necho\necho\necho\necho\necho Please wait...\necho\necho\necho"
	rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
		"ShowWhenRun": false,
		"command": "Text3",
		"keepGoing": true,
		"openWindow": "open"
	})
	wait(0)
	const Text4 = "echo\nhideKeyboard\nclear\necho\necho\necho\necho\necho Please wait...\necho\necho\necho\nrm -f level.txt\nffmpeg -hide_banner -i '{@InputName}.{@Extension}' -af volumedetect -vn -f null - 2> level.txt\necho\nhideKeyboard\nclear\necho\necho\necho\necho\necho Please wait...\necho\necho\necho"
	rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
		"ShowWhenRun": false,
		"command": "Text4",
		"keepGoing": true,
		"openWindow": "open"
	})
	@loop = nil
	repeat _ for 20 {
		if @loop beginsWith "level" {
		} else {
			repeat _ for 20 {
				if @loop beginsWith "level" {
				} else {
					wait(0)
					rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
						"ShowWhenRun": false,
						"command": "ls level.txt"
					})
					@loop
				}
			}
		}
	}
	const Matches = containsText(@loop, "(?m)^level.txt")
	if !Matches {
	} else {
		rawAction("AsheKube.app.a-Shell-mini.GetFileIntent", {
			"ShowWhenRun": false,
			"fileName": "level.txt"
		})
		const Matches1 = containsText(, "(?m)(?<=max_volume:\s-)[^ dB]+")
		if !Matches1 {
		} else {
			@MaxVolume = Matches1
		}
	}
	if @MaxVolume {
	} else {
	}
	list(, @Filters)
	@Filters
} else {
}

if @Equalizer {
	@Filters = @Equalizer
}
const CombinedText = joinText(@Filters, ",")
const Count = count(CombinedText, "Characters")

if Count > 0 {
} else {
	confirm("No filters were selected.")
	stop()
}

if @SampleRate {
} else {
}
const Text5 = "echo\nhideKeyboard\nclear\necho\necho\necho\necho\necho -------------------------------\necho Leave this app on the screen \necho while encoding is in progress.\necho -------------------------------\necho\necho\necho\nrm -f done\nrm -f filtered.{@Extension}\nffmpeg -loglevel panic -stats -i '{@InputName}.{@Extension}' -af \\"{CombinedText}\\"{} -vcodec copy -y filtered.{@Extension}\ntouch done\necho\nhideKeyboard\nclear\necho\necho\necho\necho\n"
rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
	"ShowWhenRun": false,
	"command": "Text5",
	"keepGoing": true
})
@loop = nil

repeat _ for 20 {
	if @loop beginsWith "done" {
	} else {
		repeat _ for 20 {
			if @loop beginsWith "done" {
			} else {
				wait(0)
				rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
					"ShowWhenRun": false,
					"command": "ls done",
					"keepGoing": true
				})
				@loop
			}
		}
	}
}
rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
	"ShowWhenRun": false,
	"command": "ls filtered.{@Extension}",
	"keepGoing": true
})
const Matches2 = containsText(, "(?m)^filtered")

if !Matches2 {
	confirm("Processing failed.\n\nDo you want to try again?")
	run(@Config, nil)
	stop()
} else {
}
rawAction("AsheKube.app.a-Shell-mini.GetFileIntent", {
	"ShowWhenRun": false,
	"fileName": "filtered.{@Extension}"
})
const RenamedItem = setName(File1, "{@Input}-eq")
const Matches3 = containsText(RenamedItem['File Extension'], "mov|mp4|m4a", false)

if Matches3 {
} else {
}
const SplitText2 = splitText(IfResult)
const ChosenItem2 = chooseFromList(SplitText2)

if ChosenItem2 contains "Photos" {
	savePhoto(RenamedItem)
	openApp("com.apple.mobileslideshow")
}

if ChosenItem2 contains "Files" {
	rawAction("is.workflow.actions.folder", {
		"WFFolder": "Ask: \"Choose folder\""
	})
	if !Folder {
		rawAction("is.workflow.actions.folder", {
			"WFFolder": ""
		})
	}
	saveFile("", RenamedItem, true)
	openFile(IfResult1)
}

if ChosenItem2 contains "Preview" {
	setName(RenamedItem, "After: {@Preset}")
	setName(@Input, "Before")
	const List = list(, )
	quicklook(List)
	share(RenamedItem)
	menu nil {
	item "Adjust EQ settings":
		run(@Config, @Input)
	item "Quit":
	}
}
rawAction("AsheKube.app.a-Shell-mini.ExecuteCommandIntent", {
	"ShowWhenRun": false,
	"command": "rm -f done\\nrm -f filtered.{@Extension}\\nrm -f '{@InputName}.{@Extension}'",
	"keepGoing": true
})
Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.

Оценки и отзывы

Написать отзыв
–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Пока нет отзывов. Поделись мнением первым!

Реклама

Вам также может понравиться

См. все
Реклама