制作冥想音乐的程序

单独的文字音频 + 背景音乐音频合成程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from pydub import AudioSegment
 
for_file = r"D:\个人\疗愈内在小孩.mp3"
for_file = r"D:\个人\发大愿-for.mp3"
for_file = r"D:\个人\拥抱内在回归真我.mp3"
for_file = r"D:\个人\整合阴影认识真我的无限人格.mp3"
# for_file = r"D:\个人\觉察负面情绪收回期待.mp3"
for_file = r"D:\个人\转化成瘾欲望.mp3"
for_file = r"D:\个人\消除日常匮乏感.mp3"
for_file = r"D:\个人\感恩.mp3"
for_file = r"D:\个人\家族链接.mp3"
for_file = r"D:\个人\疗愈伤痛.mp3"
for_file = r"D:\个人\疗愈童年伤痛看见内在小孩.mp3"
background_file = r"D:\个人\催眠-伤感抒情.MP3"
background_file = r"D:\个人\古风舒缓.MP3"
background_file = r"D:\个人\时光不老.MP3"
background_file = r"D:\个人\柔软触感.MP3"
# background_file = r"D:\个人\秋的思念.MP3"
background_file = r"D:\个人\风中的信.MP3"
background_file = r"D:\个人\夜幕星河.MP3"
background_file = r"D:\个人\感恩遇见.MP3"
background_file = r"D:\个人\美丽的秋天.MP3"
background_file = r"D:\个人\疗愈减压.MP3"
background_file = r"D:\个人\亲爱的小孩.MP3"
output_file = r"疗愈童年伤痛看见内在小孩.mp3"
output_file = r"发大愿-冥想练习.mp3"
output_file = r"拥抱内在回归真我-冥想练习.mp3"
output_file = r"整合阴影认识真我无限人格-冥想练习.mp3"
# output_file = r"觉察负面情绪收回期待-冥想练习.mp3"
output_file = r"转化成瘾欲望-冥想练习.mp3"
output_file = r"消除日常匮乏感-冥想练习.mp3"
output_file = r"感恩-冥想练习.mp3"
output_file = r"家族链接-冥想练习.mp3"
output_file = r"疗愈伤痛-冥想练习.mp3"
output_file = r"疗愈童年伤痛看见内在小孩-冥想练习.mp3"
# 加载音频文件
audio = AudioSegment.from_file(for_file)
background = AudioSegment.from_file(background_file)
 
# 如果背景音频短于主要音频,则重复背景音乐直到达到所需长度
while len(background) < len(audio):
    background += background
 
# 截取背景音频的长度与主音频相同
background = background[:len(audio)]
 
# 插入3秒静音,使得主音频3秒后开始合并
silence = AudioSegment.silent(duration=3000)  # 表示3000毫秒,即3秒的静音
audio = audio + silence  # 在背景音前加上静音段
 
# 降低背景音量,确保主音频更清晰
background_lower = background - 5  # 根据需要调整减少的 dB
 
# 为背景音乐的最后10秒应用淡出效果
fade_duration = 10000  # 10000毫秒 = 10秒
background_with_fade = background_lower.fade_out(fade_duration)
 
# 混音两个音频文件(从3秒开始)
output = background_with_fade.overlay(audio, position=3000, gain_during_overlay=0)
 
# 导出最终合成音频
output.export(output_file, format="mp3")

  

posted @   bonelee  阅读(34)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
历史上的今天:
2021-10-08 洞见RSA 2021|网络威胁狩猎——回归“乐趣”
2021-10-08 威胁狩猎语言 Kestrel 使用
2020-10-08 计算机原理系列之八 ——– 可执行文件的PLT和GOT 帮助你深刻理解libc库函数调用的细节(动态库)
点击右上角即可分享
微信分享提示